Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completions(bash, fish): tweak formatting #650

Merged
merged 8 commits into from
Aug 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion completions/configlet.bash
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# completions for the configlet command, bash flavour

# remove any prior completions
complete -r bin/configlet configlet 2>/dev/null
complete -r bin/configlet configlet 2> /dev/null
# and install this one
complete -F _configlet_completion_ configlet

Expand Down
72 changes: 38 additions & 34 deletions completions/configlet.fish
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,49 @@ end
# disable file completions everywhere
complete -c configlet -f

# global options
complete -c configlet -s h -l help -d "Show help"
complete -c configlet -l version -d "Show version info"
complete -c configlet -s t -l track-dir -d "Select a track directory" \
-x -a "(__fish_complete_directories)"
complete -c configlet -s v -l verbosity -x -a "quiet normal detailed" -d "Verbose level"

# subcommands with no options
complete -c configlet -n "__fish_use_subcommand" -a lint -d "Check the track configuration for correctness"
complete -c configlet -n "__fish_use_subcommand" -a generate -d "Generate concept exercise introductions"
complete -c configlet -n "__fish_use_subcommand" -a generate -d "Generate concept exercise introductions"
complete -c configlet -n "__fish_use_subcommand" -a lint -d "Check the track configuration for correctness"

# completion subcommand
# subcommands with options
complete -c configlet -n "__fish_use_subcommand" -a completion -d "Output a completion script for a given shell"
complete -c configlet -n "__fish_seen_subcommand_from completion" -s s -l shell -d "Shell type" \
-x -a "bash fish zsh"
complete -c configlet -n "__fish_use_subcommand" -a fmt -d "Format the exercise '.meta/config.json' files"
complete -c configlet -n "__fish_use_subcommand" -a info -d "Track info"
complete -c configlet -n "__fish_use_subcommand" -a sync -d "Check or update Practice Exercise docs, metadata, and tests"
complete -c configlet -n "__fish_use_subcommand" -a uuid -d "Output a UUID"

# info subcommand
complete -c configlet -n "__fish_use_subcommand" -a info -d "Track info"
complete -c configlet -n "__fish_seen_subcommand_from info" -s o -l offline -d "Do not update prob-specs cache"

# uuid subcommand
complete -c configlet -n "__fish_use_subcommand" -a uuid -d "Output a UUID"
complete -c configlet -n "__fish_seen_subcommand_from uuid" -s n -l num -x -d "How many UUIDs"
# completion subcommand
complete -c configlet -n "__fish_seen_subcommand_from completion" -s s -l shell -d "Shell type" \
-xa "bash fish zsh"

# fmt subcommand
complete -c configlet -n "__fish_use_subcommand" -a fmt -d "Format the exercise '.meta/config.json' files"
complete -c configlet -n "__fish_seen_subcommand_from fmt" -s u -l update -d "Write changes"
complete -c configlet -n "__fish_seen_subcommand_from fmt" -s y -l yes -d "Auto-confirm update"
complete -c configlet -n "__fish_seen_subcommand_from fmt" -s e -l exercise -d "exercise slug" \
-x -a '(__fish_configlet_find_dirs ./exercises/{concept,practice})'
complete -c configlet -n "__fish_seen_subcommand_from fmt" -s e -l exercise -d "exercise slug" \
-xa '(__fish_configlet_find_dirs ./exercises/{concept,practice})'
complete -c configlet -n "__fish_seen_subcommand_from fmt" -s u -l update -d "Write changes"
complete -c configlet -n "__fish_seen_subcommand_from fmt" -s y -l yes -d "Auto-confirm update"

# info subcommand
complete -c configlet -n "__fish_seen_subcommand_from info" -s o -l offline -d "Do not update prob-specs cache"

# sync subcommand
complete -c configlet -n "__fish_use_subcommand" -a sync -d "Check or update Practice Exercise docs, metadata, and tests"
complete -c configlet -n "__fish_seen_subcommand_from sync" -s o -l offline -d "Do not update prob-specs cache"
complete -c configlet -n "__fish_seen_subcommand_from sync" -s u -l update -d "Write changes"
complete -c configlet -n "__fish_seen_subcommand_from sync" -s y -l yes -d "Auto-confirm update"
complete -c configlet -n "__fish_seen_subcommand_from sync" -l docs -d "Sync docs only"
complete -c configlet -n "__fish_seen_subcommand_from sync" -l filepaths -d 'Populate .meta/config.json "files" entry'
complete -c configlet -n "__fish_seen_subcommand_from sync" -l metadata -d "Sync metadata only"
complete -c configlet -n "__fish_seen_subcommand_from sync" -l tests -d "For auto-confirming" -x -a "choose include exclude"
complete -c configlet -n "__fish_seen_subcommand_from sync" -s e -l exercise -d "exercise slug" \
-x -a '(__fish_configlet_find_dirs ./exercises/practice)'
complete -c configlet -n "__fish_seen_subcommand_from sync" -s e -l exercise -d "exercise slug" \
-xa '(__fish_configlet_find_dirs ./exercises/practice)'
complete -c configlet -n "__fish_seen_subcommand_from sync" -s o -l offline -d "Do not update prob-specs cache"
complete -c configlet -n "__fish_seen_subcommand_from sync" -s u -l update -d "Write changes"
complete -c configlet -n "__fish_seen_subcommand_from sync" -s y -l yes -d "Auto-confirm update"
complete -c configlet -n "__fish_seen_subcommand_from sync" -l docs -d "Sync docs only"
complete -c configlet -n "__fish_seen_subcommand_from sync" -l filepaths -d 'Populate .meta/config.json "files" entry'
complete -c configlet -n "__fish_seen_subcommand_from sync" -l metadata -d "Sync metadata only"
complete -c configlet -n "__fish_seen_subcommand_from sync" -l tests -d "For auto-confirming" \
-xa "choose include exclude"

# uuid subcommand
complete -c configlet -n "__fish_seen_subcommand_from uuid" -s n -l num -d "How many UUIDs" -x

# global options
complete -c configlet -s h -l help -d "Show help"
complete -c configlet -l version -d "Show version info"
complete -c configlet -s t -l track-dir -d "Select a track directory" \
-xa "(__fish_complete_directories)"
complete -c configlet -s v -l verbosity -d "Verbose level" \
-xa "quiet normal detailed"