mirror of
https://github.com/nushell/nushell.git
synced 2025-05-16 12:44:34 +00:00
* Add possibility to declare optional parameters and switch flags With this commit applied it is now possible to specify optional parameters and flags as switches. This PR **only** makes guarantees about **parsing** optional flags and switches correctly. This PR **does not guarantee flawless functionality** of optional parameters / switches within scripts. functionality within scripts. Example: test.nu ```shell def my_command [ opt_param? opt_param2?: int --switch ] {echo hi nushell} ``` ```shell > source test.nu > my_command -h ───┬───────── 0 │ hi 1 │ nushell ───┴───────── Usage: > my_command <mandatory_param> (opt_param) (opt_param2) {flags} Parameters: <mandatory_param> (opt_param) (opt_param2) Flags: -h, --help: Display this help message --switch --opt_flag <any> ``` * Update def docs
How do I get started?
Pick any command from the checklist and write a comment acknowledging you started work.
Instructions for documenting a Nu command of your choosing
Name the file after the command, like so:
command.md
Example: If you want to add documentation for the Nu command enter
, create a file named enter.md
, write documentation, save it at /docs/commands/[your_command_picked].md
as and create your pull request.
What kind of documentation should I write?
Anything you want that you believe it best documents the command and the way you would like to see it. Here are some of our ideas of documentation we would love to see (feel free to add yours):
- Examples of using the command (max creativity welcomed!)
- Description of the command.
- Command usage.
Anything else?
Of course! (These are drafts) so feel free to leave feedback and suggestions in the same file.
Happy Documenting.