Make config default if broken (#482)

* Make config default if broken

* Make config default if broken
This commit is contained in:
JT
2021-12-13 16:16:51 +13:00
committed by GitHub
parent 90ddb23492
commit 2013e9300a
26 changed files with 47 additions and 31 deletions

View File

@ -79,7 +79,7 @@ fn from_csv(
let noheaders = call.has_flag("noheaders");
let separator: Option<Value> = call.get_flag(engine_state, stack, "separator")?;
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
let sep = match separator {
Some(Value::String { val: s, span }) => {

View File

@ -45,7 +45,7 @@ impl Command for FromEml {
let head = call.head;
let preview_body: Option<Spanned<i64>> =
call.get_flag(engine_state, stack, "preview-body")?;
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
from_eml(input, preview_body, head, &config)
}

View File

@ -34,7 +34,7 @@ impl Command for FromIcs {
input: PipelineData,
) -> Result<nu_protocol::PipelineData, ShellError> {
let head = call.head;
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
from_ics(input, head, &config)
}

View File

@ -56,7 +56,7 @@ b=2' | from ini",
input: PipelineData,
) -> Result<nu_protocol::PipelineData, ShellError> {
let head = call.head;
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
from_ini(input, head, &config)
}
}

View File

@ -75,7 +75,7 @@ impl Command for FromJson {
input: PipelineData,
) -> Result<nu_protocol::PipelineData, ShellError> {
let span = call.head;
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
let mut string_input = input.collect_string("", &config);
string_input.push('\n');

View File

@ -267,7 +267,7 @@ fn from_ssv(
call: &Call,
input: PipelineData,
) -> Result<PipelineData, ShellError> {
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
let name = call.head;
let noheaders = call.has_flag("noheaders");

View File

@ -73,7 +73,7 @@ b = [1, 2]' | from toml",
input: PipelineData,
) -> Result<nu_protocol::PipelineData, ShellError> {
let span = call.head;
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
let mut string_input = input.collect_string("", &config);
string_input.push('\n');
Ok(convert_string_to_value(string_input, span)?.into_pipeline_data())

View File

@ -33,7 +33,7 @@ impl Command for FromTsv {
call: &Call,
input: PipelineData,
) -> Result<nu_protocol::PipelineData, ShellError> {
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
from_tsv(call, input, &config)
}
}

View File

@ -26,7 +26,7 @@ impl Command for FromUrl {
input: PipelineData,
) -> Result<nu_protocol::PipelineData, ShellError> {
let head = call.head;
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
from_url(input, head, &config)
}

View File

@ -32,7 +32,7 @@ impl Command for FromVcf {
input: PipelineData,
) -> Result<nu_protocol::PipelineData, ShellError> {
let head = call.head;
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
from_vcf(input, head, &config)
}

View File

@ -30,7 +30,7 @@ impl Command for FromXml {
input: PipelineData,
) -> Result<nu_protocol::PipelineData, ShellError> {
let head = call.head;
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
from_xml(input, head, &config)
}

View File

@ -71,7 +71,7 @@ impl Command for FromYaml {
input: PipelineData,
) -> Result<nu_protocol::PipelineData, ShellError> {
let head = call.head;
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
from_yaml(input, head, &config)
}
}
@ -100,7 +100,7 @@ impl Command for FromYml {
input: PipelineData,
) -> Result<nu_protocol::PipelineData, ShellError> {
let head = call.head;
let config = stack.get_config()?;
let config = stack.get_config().unwrap_or_default();
from_yaml(input, head, &config)
}
}