Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions make_docs.nu
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,14 @@ def command-doc [command] {

let flags = if $no_flags { '' } else {
($command.signatures | get $columns.0 | each { |param|
if $param.parameter_type == "switch" {
$" - `--($param.parameter_name), -($param.short_flag)`: ($param.description)"
} else if $param.parameter_type == "named" {
$" - `--($param.parameter_name), -($param.short_flag) {($param.syntax_shape)}`: ($param.description)"
}
let start = $' - `--($param.parameter_name)'
let end = $'`: ($param.description)'
let short_flag = (if ($param.short_flag | is-empty) {''} else {$', -($param.short_flag)'})
if $param.parameter_type == 'switch' {
$'($start)($short_flag)($end)'
} else if $param.parameter_type == 'named' {
$'($start)($short_flag) {($param.syntax_shape)}($end)'
}
} | str join (char newline))
}

Expand Down
Loading