Skip to content

Commit

Permalink
Merge pull request #29 from marcransome/list-completion
Browse files Browse the repository at this point in the history
Add list command completion
  • Loading branch information
marcransome authored Feb 16, 2021
2 parents 0f34725 + 529b413 commit d3a8931
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions completions/pond.fish
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set -l commands_without_options edit enable disable load status
set -l commands_without_options edit enable disable load status list
set -l commands_with_options create remove drain unload
set -l commands "$commands_without_options $commands_with_options"

Expand All @@ -8,6 +8,7 @@ complete -c pond -f
# Complete commands if no subcommand has been given so far
complete -c pond -n "not __fish_seen_subcommand_from $commands" -a 'create' -d 'Create a new pond'
complete -c pond -n "not __fish_seen_subcommand_from $commands" -a 'remove' -d 'Remove a pond and associated data'
complete -c pond -n "not __fish_seen_subcommand_from $commands" -a 'list' -d 'List all ponds'
complete -c pond -n "not __fish_seen_subcommand_from $commands" -a 'edit' -d 'Edit an existing pond'
complete -c pond -n "not __fish_seen_subcommand_from $commands" -a 'enable' -d 'Enable a pond for new shell sessions'
complete -c pond -n "not __fish_seen_subcommand_from $commands" -a 'disable' -d 'Disable a pond for new shell sessions'
Expand All @@ -17,7 +18,7 @@ complete -c pond -n "not __fish_seen_subcommand_from $commands" -a 'status' -d '
complete -c pond -n "not __fish_seen_subcommand_from $commands" -a 'drain' -d 'Drain all data from pond'

# Complete pond name for commands that do not support options
complete -c pond -n "__fish_seen_subcommand_from $commands_without_options; and not __fish_seen_subcommand_from (pond list 2>/dev/null)" -a "(pond list 2>/dev/null)"
complete -c pond -n "__fish_seen_subcommand_from $commands_without_options; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from (pond list 2>/dev/null)" -a "(pond list 2>/dev/null)"

# Complete options for create command
complete -c pond -n "__fish_seen_subcommand_from create; and not __fish_seen_subcommand_from -e --empty" -a "-e --empty" -d "Create pond without opening editor"
Expand Down
2 changes: 1 addition & 1 deletion functions/pond.fish
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Application Options:
Commands:
create Create a new pond
remove Remove a pond and associated data
list List ponds
list List all ponds
edit Edit an existing pond
enable Enable a pond for new shell sessions
disable Disable a pond for new shell sessions
Expand Down
2 changes: 1 addition & 1 deletion test/options.fish
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Application Options:
Commands:
create Create a new pond
remove Remove a pond and associated data
list List ponds
list List all ponds
edit Edit an existing pond
enable Enable a pond for new shell sessions
disable Disable a pond for new shell sessions
Expand Down

0 comments on commit d3a8931

Please sign in to comment.