Make arg eval lazy, remove old arg evaluation code (#3603)

* Remove old argument eval

* Merge main

* fmt

* clippy

* clippy

* clippy
This commit is contained in:
JT
2021-06-11 13:57:01 +12:00
committed by GitHub
parent c4163c3621
commit 8ac572ed27
218 changed files with 448 additions and 1075 deletions

View File

@ -44,7 +44,6 @@ impl WholeStreamCommand for Date {
pub fn format(args: CommandArgs) -> Result<OutputStream, ShellError> {
let tag = args.call_info.name_tag.clone();
let args = args.evaluate_once()?;
let format: Tagged<String> = args.req(0)?;
let table: Option<bool> = args.get_flag("table")?;

View File

@ -41,8 +41,7 @@ impl WholeStreamCommand for Date {
}
fn list_timezone(args: CommandArgs) -> Result<OutputStream, ShellError> {
let args = args.evaluate_once()?;
let tag = args.call_info.name_tag.clone();
let tag = args.call_info.name_tag;
let list = TZ_VARIANTS.iter().map(move |tz| {
let mut entries = IndexMap::new();

View File

@ -31,8 +31,6 @@ pub fn date_now(tag: &Tag) -> Value {
}
pub fn now(args: CommandArgs) -> Result<OutputStream, ShellError> {
let args = args.evaluate_once()?;
let value = date_now(&args.call_info.name_tag);
Ok(OutputStream::one(value))

View File

@ -34,7 +34,6 @@ impl WholeStreamCommand for Date {
}
fn to_table(args: CommandArgs) -> Result<OutputStream, ShellError> {
let args = args.evaluate_once()?;
let tag = args.call_info.name_tag.clone();
let input = if args.input.is_empty() {
InputStream::one(crate::commands::date::now::date_now(&tag))

View File

@ -55,7 +55,6 @@ impl WholeStreamCommand for Date {
fn to_timezone(args: CommandArgs) -> Result<OutputStream, ShellError> {
let tag = args.call_info.name_tag.clone();
let args = args.evaluate_once()?;
let timezone: Tagged<String> = args.req(0)?;