Skip to content

Commit

Permalink
shell: update generate completions
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Aug 27, 2024
1 parent f48ecf4 commit d6a0935
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion completions/configlet.bash
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ _configlet_complete_lint_() {
}

_configlet_complete_generate_() {
_configlet_complete_options_ "$global_opts"
case $prev in
'-e' | '--exercise')
_configlet_complete_slugs_ "practice" "concept"
;;
*)
_configlet_complete_options_ "-e --exercise -u --update -y --yes $global_opts"
;;
esac
}

_configlet_complete_info_() {
Expand Down
7 changes: 6 additions & 1 deletion completions/configlet.fish
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ end
complete -c configlet -f

# subcommands with no options
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"

# subcommands with options
Expand Down Expand Up @@ -37,6 +36,12 @@ complete -c configlet -n "__fish_seen_subcommand_from fmt" -s e -l exerci
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"

# generate subcommand
complete -c configlet -n "__fish_seen_subcommand_from generate" -s e -l exercise -d "exercise slug" \
-xa '(__fish_configlet_find_dirs ./exercises/{concept,practice})'
complete -c configlet -n "__fish_seen_subcommand_from generate" -s u -l update -d "Write changes"
complete -c configlet -n "__fish_seen_subcommand_from generate" -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"

Expand Down
3 changes: 3 additions & 0 deletions completions/configlet.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ _configlet() {
(generate)
_arguments "${_arguments_options[@]}" \
"$_configlet_global_opts[@]" \
'(-e --exercise)'{-e+,--exercise=}'[exercise slug]:slug:_configlet_complete_any_exercise_slug' \
{-u,--update}'[Write changes]' \
{-y,--yes}'[Auto-confirm update]' \
;;
(lint)
_arguments "${_arguments_options[@]}" \
Expand Down

0 comments on commit d6a0935

Please sign in to comment.