mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 00:13:21 +01:00
Add type signature example for def command (#13561)
# Description By popular demand (a.k.a. https://github.com/nushell/nushell.github.io/issues/1035), provide an example of a type signature in the `def` help. # User-Facing Changes Help/Doc # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib # After Submitting N/A
This commit is contained in:
parent
bc6947cd09
commit
c18e6bfca0
@ -70,6 +70,11 @@ impl Command for Def {
|
||||
example: r#"def --wrapped my-echo [...rest] { ^echo ...$rest }; my-echo -e 'spam\tspam'"#,
|
||||
result: Some(Value::test_string("spam\tspam")),
|
||||
},
|
||||
Example {
|
||||
description: "Define a custom command with a type signature. Passing a non-int value will result in an error",
|
||||
example: r#"def only_int []: int -> int { $in }; 42 | only_int"#,
|
||||
result: Some(Value::test_int(42)),
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user