Skip to content

Commit

Permalink
contrib: add bashcompletion for layers command
Browse files Browse the repository at this point in the history
  • Loading branch information
rhubert committed Sep 19, 2024
1 parent 0a03fc9 commit 66dfe95
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions contrib/bash-completion/bob
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ __bob_complete_dir()
}

__bob_commands="build dev clean graph help init jenkins ls project status \
query-scm query-recipe query-path query-meta show"
query-scm query-recipe query-path query-meta show layers"

# Complete a Bob path
#
Expand Down Expand Up @@ -79,10 +79,13 @@ __bob_complete_path()
# Auto complete config files. They can be in directories and their '.yaml'
# suffix is implicitly added by Bob. The file name might directly start
# after '-c' making it a bit more complicated.
if [[ $prev = "-c" || $cur = -c?* ]] ; then
if [[ $prev = "-c" || $cur = -c?* || $prev = "-lc" || $cur = -lc* ]] ; then
if [[ $cur = -c?* ]] ; then
prefix="-c"
cur="${cur:2}"
elif [[ $cur = -lc?* ]] ; then
prefix="-lc"
cur="${cur:3}"
else
prefix=
fi
Expand Down Expand Up @@ -386,6 +389,21 @@ __bob_status()
__bob_complete_path "--attic --develop --recursive --no-sandbox --release --sandbox --show-clean --show-overrides --verbose -D -c -r -v"
}

__bob_layers_status()
{
__bob_complete_path "-c -D -v -lc --attic --no-attic"
}

__bob_layers_update()
{
__bob_complete_path "-c -D -v -lc --attic --no-attic"
}

__bob_layers()
{
__bob_subcommands "status update" "layers"
}

__bob_show()
{
if [[ "$prev" = "--format" ]] ; then
Expand Down

0 comments on commit 66dfe95

Please sign in to comment.