diff --git a/crates/nu-command/src/path/basename.rs b/crates/nu-command/src/path/basename.rs index 5ac44040bf..562a3464c2 100644 --- a/crates/nu-command/src/path/basename.rs +++ b/crates/nu-command/src/path/basename.rs @@ -1,15 +1,14 @@ use std::path::Path; +use super::PathSubcommandArguments; use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ - engine::Command, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, - Type, Value, + engine::Command, Category, Example, PipelineData, ShellError, Signature, Span, Spanned, + SyntaxShape, Type, Value, }; -use super::PathSubcommandArguments; - struct Arguments { replace: Option>, } @@ -39,6 +38,7 @@ impl Command for SubCommand { "Return original path with basename replaced by this string", Some('r'), ) + .category(Category::Path) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/path/dirname.rs b/crates/nu-command/src/path/dirname.rs index 2b2df8a13d..95b2a8e821 100644 --- a/crates/nu-command/src/path/dirname.rs +++ b/crates/nu-command/src/path/dirname.rs @@ -4,8 +4,8 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ - engine::Command, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, - Type, Value, + engine::Command, Category, Example, PipelineData, ShellError, Signature, Span, Spanned, + SyntaxShape, Type, Value, }; use super::PathSubcommandArguments; @@ -46,6 +46,7 @@ impl Command for SubCommand { "Number of directories to walk up", Some('n'), ) + .category(Category::Path) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/path/exists.rs b/crates/nu-command/src/path/exists.rs index 765f847b63..d457cd51db 100644 --- a/crates/nu-command/src/path/exists.rs +++ b/crates/nu-command/src/path/exists.rs @@ -5,7 +5,7 @@ use nu_path::expand_path_with; use nu_protocol::ast::Call; use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ - engine::Command, Example, PipelineData, ShellError, Signature, Span, Type, Value, + engine::Command, Category, Example, PipelineData, ShellError, Signature, Span, Type, Value, }; use super::PathSubcommandArguments; @@ -25,13 +25,15 @@ impl Command for SubCommand { } fn signature(&self) -> Signature { - Signature::build("path exists").input_output_types(vec![ - (Type::String, Type::Bool), - ( - Type::List(Box::new(Type::String)), - Type::List(Box::new(Type::Bool)), - ), - ]) + Signature::build("path exists") + .input_output_types(vec![ + (Type::String, Type::Bool), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::Bool)), + ), + ]) + .category(Category::Path) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/path/expand.rs b/crates/nu-command/src/path/expand.rs index f64ac582c9..99e72e3d5e 100644 --- a/crates/nu-command/src/path/expand.rs +++ b/crates/nu-command/src/path/expand.rs @@ -5,7 +5,7 @@ use nu_path::{canonicalize_with, expand_path_with}; use nu_protocol::ast::Call; use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ - engine::Command, Example, PipelineData, ShellError, Signature, Span, Type, Value, + engine::Command, Category, Example, PipelineData, ShellError, Signature, Span, Type, Value, }; use super::PathSubcommandArguments; @@ -41,6 +41,7 @@ impl Command for SubCommand { Some('s'), ) .switch("no-symlink", "Do not resolve symbolic links", Some('n')) + .category(Category::Path) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/path/join.rs b/crates/nu-command/src/path/join.rs index 1000760db2..44a3a4ac5d 100644 --- a/crates/nu-command/src/path/join.rs +++ b/crates/nu-command/src/path/join.rs @@ -5,8 +5,8 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ - engine::Command, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, - Type, Value, + engine::Command, Category, Example, PipelineData, ShellError, Signature, Span, Spanned, + SyntaxShape, Type, Value, }; use super::PathSubcommandArguments; @@ -34,6 +34,7 @@ impl Command for SubCommand { (Type::Table(vec![]), Type::List(Box::new(Type::String))), ]) .rest("append", SyntaxShape::String, "Path to append to the input") + .category(Category::Path) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/path/parse.rs b/crates/nu-command/src/path/parse.rs index 66ef503c56..d8972e19c1 100644 --- a/crates/nu-command/src/path/parse.rs +++ b/crates/nu-command/src/path/parse.rs @@ -5,8 +5,8 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ - engine::Command, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, - Type, Value, + engine::Command, Category, Example, PipelineData, ShellError, Signature, Span, Spanned, + SyntaxShape, Type, Value, }; use super::PathSubcommandArguments; @@ -37,6 +37,7 @@ impl Command for SubCommand { "Manually supply the extension (without the dot)", Some('e'), ) + .category(Category::Path) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/path/path_.rs b/crates/nu-command/src/path/path_.rs index 97c8b5197d..4c1a2dc524 100644 --- a/crates/nu-command/src/path/path_.rs +++ b/crates/nu-command/src/path/path_.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -14,7 +14,9 @@ impl Command for PathCommand { } fn signature(&self) -> Signature { - Signature::build("path").input_output_types(vec![(Type::Nothing, Type::String)]) + Signature::build("path") + .input_output_types(vec![(Type::Nothing, Type::String)]) + .category(Category::Path) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/path/relative_to.rs b/crates/nu-command/src/path/relative_to.rs index f56e86c1af..5b12986f07 100644 --- a/crates/nu-command/src/path/relative_to.rs +++ b/crates/nu-command/src/path/relative_to.rs @@ -5,8 +5,8 @@ use nu_path::expand_to_real_path; use nu_protocol::ast::Call; use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ - engine::Command, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, - Type, Value, + engine::Command, Category, Example, PipelineData, ShellError, Signature, Span, Spanned, + SyntaxShape, Type, Value, }; use super::PathSubcommandArguments; @@ -39,6 +39,7 @@ impl Command for SubCommand { SyntaxShape::String, "Parent shared with the input path", ) + .category(Category::Path) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/path/split.rs b/crates/nu-command/src/path/split.rs index bbce5baebf..ab70d49664 100644 --- a/crates/nu-command/src/path/split.rs +++ b/crates/nu-command/src/path/split.rs @@ -3,7 +3,7 @@ use std::path::{Component, Path}; use nu_protocol::ast::Call; use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ - engine::Command, Example, PipelineData, ShellError, Signature, Span, Type, Value, + engine::Command, Category, Example, PipelineData, ShellError, Signature, Span, Type, Value, }; use super::PathSubcommandArguments; @@ -21,13 +21,15 @@ impl Command for SubCommand { } fn signature(&self) -> Signature { - Signature::build("path split").input_output_types(vec![ - (Type::String, Type::List(Box::new(Type::String))), - ( - Type::List(Box::new(Type::String)), - Type::List(Box::new(Type::List(Box::new(Type::String)))), - ), - ]) + Signature::build("path split") + .input_output_types(vec![ + (Type::String, Type::List(Box::new(Type::String))), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::List(Box::new(Type::String)))), + ), + ]) + .category(Category::Path) } fn usage(&self) -> &str { diff --git a/crates/nu-command/src/path/type.rs b/crates/nu-command/src/path/type.rs index 665ae82967..2660cbf2f5 100644 --- a/crates/nu-command/src/path/type.rs +++ b/crates/nu-command/src/path/type.rs @@ -4,7 +4,7 @@ use nu_path::expand_tilde; use nu_protocol::ast::Call; use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ - engine::Command, Example, PipelineData, ShellError, Signature, Span, Type, Value, + engine::Command, Category, Example, PipelineData, ShellError, Signature, Span, Type, Value, }; use super::PathSubcommandArguments; @@ -31,6 +31,7 @@ impl Command for SubCommand { ), ]) .allow_variants_without_examples(true) + .category(Category::Path) } fn usage(&self) -> &str { diff --git a/crates/nu-protocol/src/signature.rs b/crates/nu-protocol/src/signature.rs index ad2b65f7f0..8b453d7d71 100644 --- a/crates/nu-protocol/src/signature.rs +++ b/crates/nu-protocol/src/signature.rs @@ -60,6 +60,7 @@ pub enum Category { Math, Misc, Network, + Path, Platform, Random, Shells, @@ -91,6 +92,7 @@ impl std::fmt::Display for Category { Category::Math => "math", Category::Misc => "misc", Category::Network => "network", + Category::Path => "path", Category::Platform => "platform", Category::Random => "random", Category::Shells => "shells",