diff --git a/crates/nu-cmd-lang/src/core_commands/def.rs b/crates/nu-cmd-lang/src/core_commands/def.rs index 913f74803c..7f8613f315 100644 --- a/crates/nu-cmd-lang/src/core_commands/def.rs +++ b/crates/nu-cmd-lang/src/core_commands/def.rs @@ -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)), + }, ] } }