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
20 changes: 15 additions & 5 deletions make_docs.nu
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

def plugin-paths [ nu_path?: path ] {
const PLUGINS = [
nu_plugin_inc,
Expand Down Expand Up @@ -243,10 +242,21 @@ $"## Notes
# FIXME: Parentheses are required here to mutate $input_output, otherwise it won't work, maybe a bug?
$input_output = ($input_output | append [[input output]; [$input $output]])
}
let in_out = if ($input_output | length) > 0 {
let markdown = ($input_output | sort-by input | to md --pretty | str replace -a '<' '\<' | str replace -a '>' '\>')
['', '## Input/output types:', '', $markdown, ''] | str join (char newline)
} else { '' }
# Input/output types: use help commands
let input_output_table = (
help commands
| where name == $command.name
| get input_output
| first
| to md --pretty
| str replace -a '<' '&lt;'
| str replace -a '>' '&gt;'
)
let in_out = if ($input_output_table | is-empty) {
''
} else {
['', '## Input/output types:', '', $input_output_table, ''] | str join (char newline)
}

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