Skip to content

Commit

Permalink
Add completions for create options author and difficulty. (#869)
Browse files Browse the repository at this point in the history
Remove completion for exercise name in fish completion: if creating, slug won't exist to complete.
  • Loading branch information
glennj authored May 1, 2024
1 parent e1211dc commit 1c6ce62
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
12 changes: 11 additions & 1 deletion completions/configlet.bash
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,17 @@ _configlet_complete_create_() {
_configlet_complete_slugs_ "practice" "concept"
;;
*)
_configlet_complete_options_ "--approach --article --concept-exercise -e --exercise --practice-exercise -o --offline $global_opts"
local options=(
--approach
--article
-a --author
--concept-exercise
-d --difficulty
-e --exercise
--practice-exercise
-o --offline
)
_configlet_complete_options_ "${options[*]} $global_opts"
;;
esac
}
Expand Down
5 changes: 3 additions & 2 deletions completions/configlet.fish
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ complete -c configlet -n "__fish_seen_subcommand_from completion" -s s -l shell
-xa "bash fish zsh"

# create subcommand
complete -c configlet -n "__fish_seen_subcommand_from create" -s e -l exercise -d "exercise slug" \
-xa '(__fish_configlet_find_dirs ./exercises/{concept,practice})'
complete -c configlet -n "__fish_seen_subcommand_from create" -s e -l exercise -d "exercise slug"
complete -c configlet -n "__fish_seen_subcommand_from create" -s a -l author -d "The implementation author"
complete -c configlet -n "__fish_seen_subcommand_from create" -s d -l difficulty -d "The exerise difficulty (default 1)"
complete -c configlet -n "__fish_seen_subcommand_from create" -s o -l offline -d "Do not update prob-specs cache"
complete -c configlet -n "__fish_seen_subcommand_from create" -l approach -d "The slug of the approach"
complete -c configlet -n "__fish_seen_subcommand_from create" -l article -d "The slug of the article"
Expand Down
2 changes: 2 additions & 0 deletions completions/configlet.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ _configlet() {
_arguments "${_arguments_options[@]}" \
"$_configlet_global_opts[@]" \
'(-e --exercise)'{-e+,--exercise=}'[exercise slug]:slug:_configlet_complete_any_exercise_slug' \
{-a,--author}'[The author of this implementation]' \
{-d,--difficulty}'[The exercise difficulty (default 1)]' \
{-o,--offline}'[Do not update prob-specs cache]' \
'--approach=[The slug of the approach]' \
'--article=[The slug of the article]' \
Expand Down

0 comments on commit 1c6ce62

Please sign in to comment.