Skip to content

Commit e98310f

Browse files
committed
Update shell tab completion for exercism cli
resolves #666
1 parent 97d69cc commit e98310f

2 files changed

Lines changed: 15 additions & 42 deletions

File tree

shell/exercism_completion.bash

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,10 @@ _exercism () {
55
cur=${COMP_WORDS[COMP_CWORD]}
66
prev=${COMP_WORDS[COMP_CWORD-1]}
77

8-
commands="configure debug download fetch list open
9-
restore skip status submit tracks unsubmit
10-
upgrade help"
11-
tracks="csharp cpp clojure coffeescript lisp crystal
12-
dlang ecmascript elixir elm elisp erlang
13-
fsharp go haskell java javascript kotlin
14-
lfe lua mips ocaml objective-c php
15-
plsql perl5 python racket ruby rust scala
16-
scheme swift typescript bash c ceylon
17-
coldfusion delphi factor groovy haxe
18-
idris julia nim perl6 pony prolog
19-
purescript r sml vbnet powershell"
20-
config_opts="--dir --host --key --api"
21-
submit_opts="--test --comment"
8+
commands="configure download open
9+
submit troubleshoot upgrade version workspace help"
10+
config_opts="--show"
11+
version_opts="--latest"
2212

2313
if [ "${#COMP_WORDS[@]}" -eq 2 ]; then
2414
COMPREPLY=( $( compgen -W "${commands}" "${cur}" ) )
@@ -31,28 +21,8 @@ _exercism () {
3121
COMPREPLY=( $( compgen -W "${config_opts}" -- "${cur}" ) )
3222
return 0
3323
;;
34-
fetch)
35-
COMPREPLY=( $( compgen -W "${tracks}" "${cur}" ) )
36-
return 0
37-
;;
38-
list)
39-
COMPREPLY=( $( compgen -W "${tracks}" "${cur}" ) )
40-
return 0
41-
;;
42-
open)
43-
COMPREPLY=( $( compgen -W "${tracks}" "${cur}" ) )
44-
return 0
45-
;;
46-
skip)
47-
COMPREPLY=( $( compgen -W "${tracks}" "${cur}" ) )
48-
return 0
49-
;;
50-
status)
51-
COMPREPLY=( $( compgen -W "${tracks}" "${cur}" ) )
52-
return 0
53-
;;
54-
submit)
55-
COMPREPLY=( $( compgen -W "${submit_opts}" -- "${cur}" ) )
24+
version)
25+
COMPREPLY=( $( compgen -W "${version_opts}" -- "${cur}" ) )
5626
return 0
5727
;;
5828
help)

shell/exercism_completion.zsh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@ _exercism() {
33
typeset -A opt_args
44

55
local -a options
6-
options=(debug:"Outputs useful debug information."
7-
configure:"Writes config values to a JSON file."
8-
submit:"Submits a new iteration to a problem on exercism.io."
6+
options=(configure:"Writes config values to a JSON file."
97
download:"Downloads and saves a specified submission into the local system"
8+
open:"Opens a browser to exercism.io for the specified submission."
9+
submit:"Submits a new iteration to a problem on exercism.io."
10+
troubleshoot:"Outputs useful debug information."
11+
upgrade:"Upgrades to the latest available version."
12+
version:"Outputs version information."
13+
workspace:"Outputs the root directory for Exercism exercises."
1014
help:"Shows a list of commands or help for one command")
1115

1216
_arguments -s -S \
13-
{-c,--config}"[path to config file]:file:_files" \
14-
{-d,--debug}"[turn on verbose logging]" \
1517
{-h,--help}"[show help]" \
16-
{-v,--version}"[print the version]" \
18+
{-t,--timeout}"[override default HTTP timeout]" \
19+
{-v,--verbose}"[turn on verbose logging]" \
1720
'(-): :->command' \
1821
'(-)*:: :->option-or-argument' \
1922
&& return 0;

0 commit comments

Comments
 (0)