mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tools: add help for v complete
(#13098)
This commit is contained in:
parent
b44b8c472d
commit
05ec8ec15b
@ -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)
|
||||
|
28
cmd/v/help/complete.txt
Normal file
28
cmd/v/help/complete.txt
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user