Skip to content

Commit

Permalink
completions: add bash completions for flux-update(1)
Browse files Browse the repository at this point in the history
Problem: There are no tab completions for the flux-update(1) command.

Add a completion handler for flux-update(1) to
etc/completions/flux.pre.
  • Loading branch information
grondo committed Aug 24, 2023
1 parent f0fd4ef commit 3e89a0b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions etc/completions/flux.pre
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,29 @@ _flux_cancel()
return 0
}

# flux-update(1) completions
_flux_update()
{
local cmd=$1
OPTS="\
-v, --verbose \
-n, --dry-run \
"
if [[ $cur != -* ]]; then
# Attempt to substibute a pending jobid
compopt +o filenames
pending_jobs=$(flux jobs -f pending -no {id})
COMPREPLY=( $(compgen -W "${pending_jobs}" -- "$cur") )
return 0
fi
COMPREPLY=( $(compgen -W "${OPTS} -h --help" -- "$cur") )
if [[ "${COMPREPLY[@]}" == *= ]]; then
# Add space if there is not a '=' in suggestions
compopt -o nospace
fi
return 0
}

# flux-mini(1) completions
_flux_mini()
{
Expand Down Expand Up @@ -1474,6 +1497,9 @@ _flux_core()
watch)
_flux_watch $subcmd
;;
update)
_flux_update $subcmd
;;
-*)
COMPREPLY=( $(compgen -W "${FLUX_OPTS}" -- "$cur") )
;;
Expand Down

0 comments on commit 3e89a0b

Please sign in to comment.