forked from extern/nushell
Split OutputStream into ActionStream/OutputStream (#3304)
* Split OutputStream into ActionStream/OutputStream * Fmt * Missed update * Cleanup helper names * Fmt
This commit is contained in:
@ -18,8 +18,8 @@ impl WholeStreamCommand for Command {
|
||||
"Apply date function."
|
||||
}
|
||||
|
||||
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
Ok(OutputStream::one(ReturnSuccess::value(
|
||||
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||
Ok(ActionStream::one(ReturnSuccess::value(
|
||||
UntaggedValue::string(get_full_help(&Command, &args.scope)).into_value(Tag::unknown()),
|
||||
)))
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ impl WholeStreamCommand for Date {
|
||||
"Format a given date using the given format string."
|
||||
}
|
||||
|
||||
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||
format(args)
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ impl WholeStreamCommand for Date {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn format(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
pub fn format(args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||
let tag = args.call_info.name_tag.clone();
|
||||
let (FormatArgs { format, table }, input) = args.process()?;
|
||||
|
||||
@ -91,7 +91,7 @@ pub fn format(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
&tag,
|
||||
)),
|
||||
})
|
||||
.to_output_stream())
|
||||
.to_action_stream())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -20,7 +20,7 @@ impl WholeStreamCommand for Date {
|
||||
"List supported time zones."
|
||||
}
|
||||
|
||||
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||
list_timezone(args)
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ impl WholeStreamCommand for Date {
|
||||
}
|
||||
}
|
||||
|
||||
fn list_timezone(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
fn list_timezone(args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||
let args = args.evaluate_once()?;
|
||||
let tag = args.call_info.name_tag.clone();
|
||||
|
||||
@ -57,7 +57,7 @@ fn list_timezone(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
))
|
||||
});
|
||||
|
||||
Ok(list.into_iter().to_output_stream())
|
||||
Ok(list.into_iter().to_action_stream())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -19,12 +19,12 @@ impl WholeStreamCommand for Date {
|
||||
"Get the current date."
|
||||
}
|
||||
|
||||
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||
now(args)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn now(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
pub fn now(args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||
let args = args.evaluate_once()?;
|
||||
let tag = args.call_info.name_tag.clone();
|
||||
|
||||
@ -32,7 +32,7 @@ pub fn now(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
|
||||
let value = UntaggedValue::date(now.with_timezone(now.offset())).into_value(&tag);
|
||||
|
||||
Ok(OutputStream::one(value))
|
||||
Ok(ActionStream::one(value))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -20,7 +20,7 @@ impl WholeStreamCommand for Date {
|
||||
"Print the date in a structured table."
|
||||
}
|
||||
|
||||
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||
to_table(args)
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ impl WholeStreamCommand for Date {
|
||||
}
|
||||
}
|
||||
|
||||
fn to_table(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
fn to_table(args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||
let args = args.evaluate_once()?;
|
||||
let tag = args.call_info.name_tag.clone();
|
||||
let input = args.input;
|
||||
@ -87,7 +87,7 @@ fn to_table(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
&tag,
|
||||
)),
|
||||
})
|
||||
.to_output_stream())
|
||||
.to_action_stream())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -33,7 +33,7 @@ impl WholeStreamCommand for Date {
|
||||
"Use 'date list-timezone' to list all supported time zones."
|
||||
}
|
||||
|
||||
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||
to_timezone(args)
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ impl WholeStreamCommand for Date {
|
||||
}
|
||||
}
|
||||
|
||||
fn to_timezone(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
fn to_timezone(args: CommandArgs) -> Result<ActionStream, ShellError> {
|
||||
let tag = args.call_info.name_tag.clone();
|
||||
let (DateToTimeZoneArgs { timezone }, input) = args.process()?;
|
||||
|
||||
@ -85,7 +85,7 @@ fn to_timezone(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
&tag,
|
||||
)),
|
||||
})
|
||||
.to_output_stream())
|
||||
.to_action_stream())
|
||||
}
|
||||
|
||||
fn error_message(err: ParseErrorKind) -> &'static str {
|
||||
|
@ -21,7 +21,7 @@ impl WholeStreamCommand for Date {
|
||||
"return the current date in utc."
|
||||
}
|
||||
|
||||
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
fn run_with_actions(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
|
||||
utc(args)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user