Refactor Fetch command (No logic changes) (#2131)

* Refactoring unrelated to Streaming...

Mainly keeping code DRY

* Remove cli as dependency
This commit is contained in:
Arash Outadi
2020-07-08 09:49:27 -07:00
committed by GitHub
parent b004236927
commit ed6f337a48
2 changed files with 75 additions and 128 deletions

View File

@ -3,7 +3,7 @@ use nu_errors::ShellError;
use nu_plugin::Plugin;
use nu_protocol::{CallInfo, ReturnValue, Signature, SyntaxShape};
use crate::fetch::fetch_helper;
use crate::fetch::fetch;
use crate::Fetch;
impl Plugin for Fetch {
@ -33,7 +33,7 @@ impl Plugin for Fetch {
fn begin_filter(&mut self, callinfo: CallInfo) -> Result<Vec<ReturnValue>, ShellError> {
self.setup(callinfo)?;
Ok(vec![block_on(fetch_helper(
Ok(vec![block_on(fetch(
&self.path.clone().ok_or_else(|| {
ShellError::labeled_error("internal error: path not set", "path not set", &self.tag)
})?,