-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathusage.usage.kdl
More file actions
151 lines (150 loc) · 7.25 KB
/
usage.usage.kdl
File metadata and controls
151 lines (150 loc) · 7.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// @generated by usage-cli from clap metadata
name usage-cli
bin usage
version "2.18.3"
about "CLI for working with usage-based CLIs"
usage "Usage: usage-cli [OPTIONS] [COMPLETIONS] <COMMAND>"
flag --usage-spec help="Outputs a `usage.kdl` spec for this CLI itself"
arg "[COMPLETIONS]" help="Outputs completions for the specified shell for completing the `usage` CLI itself" required=#false
cmd bash help="Execute a shell script using bash" {
long_help "Execute a shell script with the specified shell\n\nTypically, this will be called by a script's shebang.\n\nIf using `var=#true` on args/flags, they will be joined with spaces using `shell_words::join()`\nto properly escape and quote values with spaces in them."
flag -h help="Show help"
flag --help help="Show help"
arg <SCRIPT>
arg "[ARGS]…" help="Arguments to pass to script" required=#false var=#true
}
cmd complete-word help="Generate shell completion candidates for a partial command line" {
alias cw
long_help "Generate shell completion candidates for a partial command line\n\nThis is used internally by shell completion scripts to provide intelligent completions for commands, flags, and arguments."
flag "-f --file" help="Usage spec file or script with usage shebang" {
arg <FILE>
}
flag "-s --spec" help="Raw string spec input" {
arg <SPEC>
}
flag --cword help="Current word index" {
arg <CWORD>
}
flag --shell default=bash {
arg <SHELL> {
choices bash fish nu powershell zsh
}
}
arg "[WORDS]…" help="User's input from the command line" required=#false var=#true
}
cmd exec help="Execute a script, parsing args and exposing them as environment variables" {
alias x
flag -h help="Show help"
flag --help help="Show help"
arg <COMMAND> help="command to execute after parsing usage spec"
arg <BIN> help="path to script to execute"
arg "[ARGS]…" help="arguments to pass to script" required=#false var=#true
}
cmd fish help="Execute a shell script using fish" {
long_help "Execute a shell script with the specified shell\n\nTypically, this will be called by a script's shebang.\n\nIf using `var=#true` on args/flags, they will be joined with spaces using `shell_words::join()`\nto properly escape and quote values with spaces in them."
flag -h help="Show help"
flag --help help="Show help"
arg <SCRIPT>
arg "[ARGS]…" help="Arguments to pass to script" required=#false var=#true
}
cmd generate subcommand_required=#true help="Generate completions, documentation, and other artifacts from usage specs" {
alias g
cmd completion help="Generate shell completion scripts for bash, fish, nu, powershell, or zsh" {
alias c
alias complete completions hide=#true
flag "-f --file" help="A .usage.kdl spec file to use for generating completions" {
arg <FILE>
}
flag --cache-key help="A cache key to use for storing the results of calling the CLI with --usage-cmd" {
arg <CACHE_KEY>
}
flag --include-bash-completion-lib help="Include https://github.com/scop/bash-completion" {
long_help "Include https://github.com/scop/bash-completion\n\nThis is required for usage completions to work in bash, but the user may already provide it"
}
flag --usage-bin help="Override the bin used for calling back to usage-cli" default=usage {
long_help "Override the bin used for calling back to usage-cli\n\nYou may need to set this if you have a different bin named \"usage\""
arg <USAGE_BIN>
}
flag --usage-cmd help="A command which generates a usage spec e.g.: `mycli --usage` or `mycli completion usage` Defaults to \"$bin --usage\"" {
arg <USAGE_CMD>
}
arg <SHELL> help="Shell to generate completions for" {
choices bash fish nu powershell zsh
}
arg <BIN> help="The CLI which we're generating completions for"
}
cmd fig help="Generate Fig completion spec for Amazon Q / Fig" {
flag "-f --file" help="A usage spec taken in as a file" {
arg <FILE>
}
flag --out-file help="File path where the generated Fig spec will be saved" {
arg <OUT_FILE>
}
flag --spec help="Raw string spec input" {
arg <SPEC>
}
}
cmd json help="Outputs a usage spec in json format" {
flag "-f --file" help="A usage spec taken in as a file" {
arg <FILE>
}
flag --spec help="raw string spec input" {
arg <SPEC>
}
}
cmd manpage {
alias man
flag "-f --file" help="A usage spec taken in as a file" required=#true {
arg <FILE>
}
flag "-o --out-file" help="Output file path (defaults to stdout)" {
arg <OUT_FILE>
}
flag "-s --section" help="Manual section number (default: 1)" default="1" {
long_help "Manual section number (default: 1)\n\nCommon sections: - 1: User commands - 5: File formats - 7: Miscellaneous - 8: System administration commands"
arg <SECTION>
}
}
cmd markdown help="Generate markdown documentation from usage specs" {
alias md
flag "-f --file" help="A usage spec taken in as a file" required=#true {
arg <FILE>
}
flag "-m --multi" help="Render each subcommand as a separate markdown file"
flag --html-encode help="Escape HTML in markdown"
flag --out-dir help="Output markdown files to this directory (required when using --multi)" {
arg <OUT_DIR>
}
flag --out-file help="Output file path for single-file markdown generation" {
arg <OUT_FILE>
}
flag --replace-pre-with-code-fences help="Replace `<pre>` tags with markdown code fences"
flag --url-prefix help="Prefix to add to all URLs" {
arg <URL_PREFIX>
}
}
}
cmd lint help="Lint a usage spec file for common issues" {
flag "-f --format" help="Output format" default=text {
arg <FORMAT> {
choices text json
}
}
flag "-W --warnings-as-errors" help="Treat warnings as errors"
arg <FILE> help="A usage spec file to lint"
}
cmd powershell help="Execute a shell script using PowerShell" {
long_help "Execute a shell script with the specified shell\n\nTypically, this will be called by a script's shebang.\n\nIf using `var=#true` on args/flags, they will be joined with spaces using `shell_words::join()`\nto properly escape and quote values with spaces in them."
flag -h help="Show help"
flag --help help="Show help"
arg <SCRIPT>
arg "[ARGS]…" help="Arguments to pass to script" required=#false var=#true
}
cmd zsh help="Execute a shell script using zsh" {
long_help "Execute a shell script with the specified shell\n\nTypically, this will be called by a script's shebang.\n\nIf using `var=#true` on args/flags, they will be joined with spaces using `shell_words::join()`\nto properly escape and quote values with spaces in them."
flag -h help="Show help"
flag --help help="Show help"
arg <SCRIPT>
arg "[ARGS]…" help="Arguments to pass to script" required=#false var=#true
}
source_code_link_template "https://github.com/jdx/usage/blob/main/cli/src/cli/{{path}}.rs"