Skip to content

Commit

Permalink
Merge pull request exercism#763 from John-Goff/fish-completions
Browse files Browse the repository at this point in the history
Fish tab completions
  • Loading branch information
Katrina Owen authored Jan 4, 2019
2 parents acc3a6e + 5266925 commit c5c202e
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
7 changes: 7 additions & 0 deletions shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ the following snippet
#### Oh my Zsh

If you are using the popular [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) framework to manage your zsh plugins, move the file `exercism_completion.zsh` into `~/.oh-my-zsh/custom`.

### Fish

Completions must go in the user defined `$fish_complete_path`. By default, this is `~/.config/fish/completions`

mv ../shell/exercism.fish ~/.config/fish/exercism.fish

54 changes: 54 additions & 0 deletions shell/exercism.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Configure
complete -f -c exercism -n "__fish_use_subcommand" -a "configure" -d "Writes config values to a JSON file."
complete -f -c exercism -n "__fish_seen_subcommand_from configure" -s t -l token -d "Set token"
complete -f -c exercism -n "__fish_seen_subcommand_from configure" -s w -l workspace -d "Set workspace"
complete -f -c exercism -n "__fish_seen_subcommand_from configure" -s a -l api -d "set API base url"
complete -f -c exercism -n "__fish_seen_subcommand_from configure" -s s -l show -d "show settings"

# Download
complete -f -c exercism -n "__fish_use_subcommand" -a "download" -d "Downloads and saves a specified submission into the local system"
complete -f -c exercism -n "__fish_seen_subcommand_from download" -s e -l exercise -d "the exercise slug"
complete -f -c exercism -n "__fish_seen_subcommand_from download" -s h -l help -d "help for download"
complete -f -c exercism -n "__fish_seen_subcommand_from download" -s T -l team -d "the team slug"
complete -f -c exercism -n "__fish_seen_subcommand_from download" -s t -l track -d "the track ID"
complete -f -c exercism -n "__fish_seen_subcommand_from download" -s u -l uuid -d "the solution UUID"

# Help
complete -f -c exercism -n "__fish_use_subcommand" -a "help" -d "Shows a list of commands or help for one command"
complete -f -c exercism -n "__fish_seen_subcommand_from help" -a "configure download help open submit troubleshoot upgrade version workspace"

# Open
complete -f -c exercism -n "__fish_use_subcommand" -a "open" -d "Opens a browser to exercism.io for the specified submission."
complete -f -c exercism -n "__fish_seen_subcommand_from open" -s h -l help -d "help for open"

# Submit
complete -f -c exercism -n "__fish_use_subcommand" -a "submit" -d "Submits a new iteration to a problem on exercism.io."
complete -f -c exercism -n "__fish_seen_subcommand_from submit" -s h -l help -d "help for submit"

# Troubleshoot
complete -f -c exercism -n "__fish_use_subcommand" -a "troubleshoot" -d "Outputs useful debug information."
complete -f -c exercism -n "__fish_seen_subcommand_from troubleshoot" -s f -l full-api-key -d "display full API key (censored by default)"
complete -f -c exercism -n "__fish_seen_subcommand_from troubleshoot" -s h -l help -d "help for troubleshoot"

# Upgrade
complete -f -c exercism -n "__fish_use_subcommand" -a "upgrade" -d "Upgrades to the latest available version."
complete -f -c exercism -n "__fish_seen_subcommand_from help" -s h -l help -d "help for help"

# Version
complete -f -c exercism -n "__fish_use_subcommand" -a "version" -d "Outputs version information."
complete -f -c exercism -n "__fish_seen_subcommand_from version" -s l -l latest -d "check latest available version"
complete -f -c exercism -n "__fish_seen_subcommand_from version" -s h -l help -d "help for version"

# Workspace
complete -f -c exercism -n "__fish_use_subcommand" -a "workspace" -d "Outputs the root directory for Exercism exercises."
complete -f -c exercism -n "__fish_seen_subcommand_from workspace" -s h -l help -d "help for workspace"

# Options
complete -f -c exercism -s h -l help -d "show help"
complete -f -c exercism -l timeout -a "10" -d "10 seconds"
complete -f -c exercism -l timeout -a "30" -d "30 seconds"
complete -f -c exercism -l timeout -a "60" -d "1 minute"
complete -f -c exercism -l timeout -a "300" -d "5 minutes"
complete -f -c exercism -l timeout -a "600" -d "10 minutes"
complete -f -c exercism -l timeout -a "" -d "override default HTTP timeout"
complete -f -c exercism -s v -l verbose -d "turn on verbose logging"

0 comments on commit c5c202e

Please sign in to comment.