forked from extern/nushell
Split key/value in 'config set' (#2151)
This commit is contained in:
parent
e848fc0bbe
commit
1bb6a2d9ed
@ -9,7 +9,8 @@ pub struct SubCommand;
|
|||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct SetArgs {
|
pub struct SetArgs {
|
||||||
set: (Tagged<String>, Value),
|
key: Tagged<String>,
|
||||||
|
value: Value,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
@ -19,11 +20,9 @@ impl WholeStreamCommand for SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("config set").required(
|
Signature::build("config set")
|
||||||
"set",
|
.required("key", SyntaxShape::String, "variable name to set")
|
||||||
SyntaxShape::Any,
|
.required("value", SyntaxShape::Any, "value to use")
|
||||||
"sets a value in the config, eg) set [key value]",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
@ -52,7 +51,7 @@ pub async fn set(
|
|||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
) -> Result<OutputStream, ShellError> {
|
) -> Result<OutputStream, ShellError> {
|
||||||
let name_span = args.call_info.name_tag.clone();
|
let name_span = args.call_info.name_tag.clone();
|
||||||
let (SetArgs { set: (key, value) }, _) = args.process(®istry).await?;
|
let (SetArgs { key, value }, _) = args.process(®istry).await?;
|
||||||
|
|
||||||
// NOTE: None because we are not loading a new config file, we just want to read from the
|
// NOTE: None because we are not loading a new config file, we just want to read from the
|
||||||
// existing config
|
// existing config
|
||||||
|
Loading…
Reference in New Issue
Block a user