-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
explore
: cleanup params/flags and add more keybindings
#1652
Conversation
The book can be updated but the command docs cannot be updated here. They are autogenerated from the commands themselves. So, if the command help needs to change, the rust code needs to change. |
Oh, I think the problem is that the diff --git a/make_docs.nu b/make_docs.nu
index 5c5a353a..405cd5bf 100644
--- a/make_docs.nu
+++ b/make_docs.nu
@@ -168,13 +168,18 @@ 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)"
+ ($command.signatures | get $columns.0 | each { |param| (
+ try {
+ 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))
+ ) } | str join (char newline))
}
let flags = if $no_flags { "" } else { |
It looks like @Hofer-Julian was the last person that touched that part of the Should that be in a separate PR? If so, should I undo the |
yes, you should remove the command docs and @hustcer may be able to chime when he has time. |
OK, I removed the manual diff --git a/make_docs.nu b/make_docs.nu
index 5c5a353a..a322b570 100644
--- a/make_docs.nu
+++ b/make_docs.nu
@@ -26,7 +26,7 @@ def plugin-paths [ nu_path?: path ] {
# get all command names from a clean scope
def command-names [] {
let plugins = (plugin-paths)
- nu --no-config-file --plugins ($plugins | to nuon) --commands $'scope commands | select name | to json'
+ nu --no-config-file --commands $'scope commands | select name | to json'
| from json
}
@@ -58,7 +58,7 @@ def make_docs [
] {
let $nu_path = ($nu_path | default $nu.current-exe)
let plugins = (plugin-paths $nu_path)
- run-external $nu_path "--no-config-file" $"--plugins ($plugins | to nuon)" "make_docs.nu"
+ run-external $nu_path "--no-config-file" "make_docs.nu"
}
# generate the YAML frontmatter of a command
@@ -169,10 +169,13 @@ 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))
} NOTE: I had to remove the plugins stuff to be able to run the script, since the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes!
Feel free to open a PR for the make_docs.nu
script!
OK, I created PR #1658, and I used my Windows WSL Ubuntu, since I couldn't run |
some of the keybindings added to the documentation are existing (i.e. the
Vim
keybindings), and some of them will be added via nushell/nushell#14468 (i.e. theEmacs
keybindings)