forked from extern/nushell
Categorification: move Path commands out of the default category (#9937)
Path commands were incorrectly located in the default category... This PR moves all of the *Path* commands into their own Category called *Path*
This commit is contained in:
parent
c8f3799c20
commit
bb6335830a
@ -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<Spanned<String>>,
|
||||
}
|
||||
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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![
|
||||
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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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![
|
||||
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 {
|
||||
|
@ -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 {
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user