Skip to content

Commit 2a29b07

Browse files
committed
feat: Add --fetch flag to list to fetch updates. Closes #51
1 parent ca19b9d commit 2a29b07

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pkg/lib/commands/do-list.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
do-list() {
44
local flag_outdated='no'
55
local flag_simple='no'
6+
local flag_fetch='no'
67

78
for arg; do
89
case "$arg" in
910
--simple)
1011
flag_simple='yes'
1112
;;
13+
--fetch)
14+
flag_fetch='yes'
1215
esac
1316
done
1417

@@ -64,6 +67,13 @@ do-list() {
6467
printf -v pkg_output "%s %s\n" "$pkg_output" "$repo_branch_str"
6568

6669
if git -C "$pkg_path" config remote.origin.url &>/dev/null; then
70+
if [ "$flag_fetch" = yes ]; then
71+
local git_output=
72+
if ! git_output="$(git -C "$pkg_path" fetch)"; then
73+
printf "%s" "$git_output"
74+
fi
75+
fi
76+
6777
# shellcheck disable=SC1083
6878
if [ "$(git -C "$pkg_path" rev-list --count HEAD...HEAD@{upstream})" -gt 0 ]; then
6979
if [ -n "${NO_COLOR+x}" ] || [ "$TERM" = dumb ]; then

pkg/lib/util/util.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ Subcommands:
268268
Installs a local directory as a bpm package. These show up with
269269
a namespace of 'local'
270270
271-
list [--outdated]
271+
list [--simple] [--fetch]
272272
List installed packages
273273
274274
package-path <package>

0 commit comments

Comments
 (0)