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(fish): refactor exercise slug completion #660

Merged
Merged
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
8 changes: 6 additions & 2 deletions completions/configlet.fish
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
function __fish_configlet_find_dirs
find $argv -maxdepth 1 -mindepth 1 -type d -printf '%P\n' | sort
end

# disable file completions everywhere
complete -c configlet -f

Expand Down Expand Up @@ -30,7 +34,7 @@ complete -c configlet -n "__fish_use_subcommand" -a fmt -d "Format the exercise
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 "(find ./exercises/{concept,practice} -maxdepth 1 -mindepth 1 -type d -printf '%P\n' | sort)"
-x -a '(__fish_configlet_find_dirs ./exercises/{concept,practice})'

# sync subcommand
complete -c configlet -n "__fish_use_subcommand" -a sync -d "Check or update Practice Exercise docs, metadata, and tests"
Expand All @@ -42,4 +46,4 @@ complete -c configlet -n "__fish_seen_subcommand_from sync" -l filepaths -d
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 "(find ./exercises/practice -maxdepth 1 -mindepth 1 -type d -printf '%P\n' | sort)"
-x -a '(__fish_configlet_find_dirs ./exercises/practice)'