forked from extern/nushell
fmt
This commit is contained in:
parent
878b1e1603
commit
6d951751cf
@ -16,7 +16,7 @@ use std::collections::HashMap;
|
||||
use std::io::BufReader;
|
||||
|
||||
use reqwest::StatusCode;
|
||||
use std::path::{PathBuf, Path};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use std::time::Duration;
|
||||
|
||||
@ -108,12 +108,14 @@ impl Command for SubCommand {
|
||||
let output = call.has_flag("output");
|
||||
if !output {
|
||||
run_fetch(engine_state, stack, call, input)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
match run_fetch(engine_state, stack, call, input) {
|
||||
Err(err) => Err(err),
|
||||
Ok(value) => {
|
||||
let path:Value = call.get_flag(engine_state, stack, "output").expect("there should be a value").expect("value should be unwrappable");
|
||||
let path: Value = call
|
||||
.get_flag(engine_state, stack, "output")
|
||||
.expect("there should be a value")
|
||||
.expect("value should be unwrappable");
|
||||
let bin = call.has_flag("bin");
|
||||
let append = call.has_flag("append");
|
||||
let span = call.head;
|
||||
@ -131,7 +133,8 @@ impl Command for SubCommand {
|
||||
let mut file = match file {
|
||||
Ok(file) => file,
|
||||
Err(err) => {
|
||||
let arg_span = call.get_named_arg("output").expect("arg should exist").span;
|
||||
let arg_span =
|
||||
call.get_named_arg("output").expect("arg should exist").span;
|
||||
return Ok(PipelineData::Value(
|
||||
Value::Error {
|
||||
error: ShellError::GenericError(
|
||||
@ -155,7 +158,8 @@ impl Command for SubCommand {
|
||||
};
|
||||
|
||||
if let Some(ext) = ext {
|
||||
let output = match engine_state.find_decl(format!("to {}", ext).as_bytes(), &[]) {
|
||||
let output =
|
||||
match engine_state.find_decl(format!("to {}", ext).as_bytes(), &[]) {
|
||||
Some(converter_id) => {
|
||||
let output = engine_state.get_decl(converter_id).run(
|
||||
engine_state,
|
||||
@ -211,7 +215,9 @@ impl Command for SubCommand {
|
||||
}
|
||||
} else {
|
||||
match value {
|
||||
PipelineData::ExternalStream { stdout: None, .. } => Ok(PipelineData::new(span)),
|
||||
PipelineData::ExternalStream { stdout: None, .. } => {
|
||||
Ok(PipelineData::new(span))
|
||||
}
|
||||
PipelineData::ExternalStream {
|
||||
stdout: Some(mut stream),
|
||||
..
|
||||
@ -283,7 +289,7 @@ impl Command for SubCommand {
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user