diff --git a/crates/nu-command/src/filesystem/open.rs b/crates/nu-command/src/filesystem/open.rs index 4ff8fca58..94ac2ff9a 100644 --- a/crates/nu-command/src/filesystem/open.rs +++ b/crates/nu-command/src/filesystem/open.rs @@ -30,6 +30,10 @@ impl Command for Open { "Load a file into a cell, converting to table if possible (avoid by appending '--raw')." } + fn extra_usage(&self) -> &str { + "Support to automatically parse files with an extension `.xyz` can be provided by a `from xyz` command in scope." + } + fn search_terms(&self) -> Vec<&str> { vec!["load", "read", "load_file", "read_file"] } @@ -241,6 +245,11 @@ impl Command for Open { example: "open myfile.txt --raw | decode utf-8", result: None, }, + Example { + description: "Create a custom `from` parser to open newline-delimited JSON files with `open`", + example: r#"def "from ndjson" [] { from json -o }; open myfile.ndjson"#, + result: None, + }, ] } }