mirror of
https://github.com/nushell/nushell
synced 2025-01-12 05:09:04 +00:00
add content type metadata to config nu
commands
This commit is contained in:
parent
fb26109049
commit
0117c70372
1 changed files with 11 additions and 2 deletions
13
crates/nu-command/src/env/config/config_nu.rs
vendored
13
crates/nu-command/src/env/config/config_nu.rs
vendored
|
@ -1,4 +1,5 @@
|
||||||
use nu_engine::command_prelude::*;
|
use nu_engine::command_prelude::*;
|
||||||
|
use nu_protocol::PipelineMetadata;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ConfigNu;
|
pub struct ConfigNu;
|
||||||
|
@ -70,13 +71,21 @@ impl Command for ConfigNu {
|
||||||
// `--default` flag handling
|
// `--default` flag handling
|
||||||
if default_flag {
|
if default_flag {
|
||||||
let head = call.head;
|
let head = call.head;
|
||||||
return Ok(Value::string(nu_utils::get_default_config(), head).into_pipeline_data());
|
return Ok(Value::string(nu_utils::get_default_config(), head)
|
||||||
|
.into_pipeline_data_with_metadata(
|
||||||
|
PipelineMetadata::default()
|
||||||
|
.with_content_type("application/x-nuscript".to_string().into()),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// `--doc` flag handling
|
// `--doc` flag handling
|
||||||
if doc_flag {
|
if doc_flag {
|
||||||
let head = call.head;
|
let head = call.head;
|
||||||
return Ok(Value::string(nu_utils::get_doc_config(), head).into_pipeline_data());
|
return Ok(Value::string(nu_utils::get_doc_config(), head)
|
||||||
|
.into_pipeline_data_with_metadata(
|
||||||
|
PipelineMetadata::default()
|
||||||
|
.with_content_type("application/x-nuscript".to_string().into()),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
super::config_::start_editor("config-path", engine_state, stack, call)
|
super::config_::start_editor("config-path", engine_state, stack, call)
|
||||||
|
|
Loading…
Reference in a new issue