Skip to content

Commit 2e9a206

Browse files
committed
feature(make_docs.nu): adjust the input/output section generation
now uses the data directly from help {command} to ensure that the table is fully populated by all input/output combinations.
1 parent 4dc7585 commit 2e9a206

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

make_docs.nu

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
def plugin-paths [ nu_path?: path ] {
32
const PLUGINS = [
43
nu_plugin_inc,
@@ -243,10 +242,13 @@ $"## Notes
243242
# FIXME: Parentheses are required here to mutate $input_output, otherwise it won't work, maybe a bug?
244243
$input_output = ($input_output | append [[input output]; [$input $output]])
245244
}
246-
let in_out = if ($input_output | length) > 0 {
247-
let markdown = ($input_output | sort-by input | to md --pretty | str replace -a '<' '\<' | str replace -a '>' '\>')
248-
['', '## Input/output types:', '', $markdown, ''] | str join (char newline)
249-
} else { '' }
245+
# Input/output types: use help commands
246+
let input_output_table = help commands | where name == $command.name | get input_output | first | to md
247+
let in_out = if ($input_output_table | is-empty) {
248+
''
249+
} else {
250+
['', '## Input/output types:', '', $input_output_table, ''] | str join (char newline)
251+
}
250252

251253
let examples = if ($command.examples | length) > 0 {
252254
let example_top = $"## Examples(char newline)(char newline)"

0 commit comments

Comments
 (0)