diff --git a/cmd/tools/vcomplete.v b/cmd/tools/vcomplete.v index 342db79e0c..74a0c7030f 100644 --- a/cmd/tools/vcomplete.v +++ b/cmd/tools/vcomplete.v @@ -44,6 +44,34 @@ import os const ( auto_complete_shells = ['bash', 'fish', 'zsh', 'powershell'] // list of supported shells vexe = os.getenv('VEXE') + help_text = "Usage: + v complete [options] [SUBCMD] QUERY... + +Description: + Tool for bridging auto completion between various shells and v + +Supported shells: + bash, fish, zsh, powershell + +Examples: + Echo auto-detected shell install script to STDOUT + v complete + Echo specific shell install script to STDOUT + v complete setup bash + Auto complete input `v tes`*USER PUSHES TAB* (in Bash compatible format). + This is not meant for manual invocation - it's called by the relevant + shell via the script installed with `v complete` or `v complete setup SHELL`. + v complete bash v tes + +Options: + -h, --help Show this help text. + +SUBCMD: + setup : setup [SHELL] - returns the code for completion setup for SHELL + bash : [QUERY] - returns Bash compatible completion code with completions computed from QUERY + fish : [QUERY] - returns Fish compatible completion code with completions computed from QUERY + zsh : [QUERY] - returns ZSH compatible completion code with completions computed from QUERY + powershell: [QUERY] - returns PowerShell compatible completion code with completions computed from QUERY" ) // Snooped from cmd/v/v.v, vlib/v/pref/pref.v @@ -289,6 +317,9 @@ fn auto_complete(args []string) { } println(lines.join('\n')) } + '-h', '--help' { + println(help_text) + } else {} } exit(0) diff --git a/cmd/v/help/complete.txt b/cmd/v/help/complete.txt new file mode 100644 index 0000000000..f89f8c099c --- /dev/null +++ b/cmd/v/help/complete.txt @@ -0,0 +1,28 @@ +Usage: + v complete [options] [SUBCMD] QUERY... + +Description: + Tool for bridging auto completion between various shells and v + +Supported shells: + bash, fish, zsh, powershell + +Examples: + Echo auto-detected shell install script to STDOUT + v complete + Echo specific shell install script to STDOUT + v complete setup bash + Auto complete input `v tes`*USER PUSHES TAB* (in Bash compatible format). + This is not meant for manual invocation - it's called by the relevant + shell via the script installed with `v complete` or `v complete setup SHELL`. + v complete bash v tes + +Options: + -h, --help Show this help text. + +SUBCMD: + setup : setup [SHELL] - returns the code for completion setup for SHELL + bash : [QUERY] - returns Bash compatible completion code with completions computed from QUERY + fish : [QUERY] - returns Fish compatible completion code with completions computed from QUERY + zsh : [QUERY] - returns ZSH compatible completion code with completions computed from QUERY + powershell: [QUERY] - returns PowerShell compatible completion code with completions computed from QUERY \ No newline at end of file