forked from extern/nushell
Move run to be async (#1913)
This commit is contained in:
parent
fbc0dd57e9
commit
360e8340d1
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -159,6 +159,17 @@ dependencies = [
|
|||||||
"winapi 0.3.8",
|
"winapi 0.3.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-trait"
|
||||||
|
version = "0.1.31"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "26c4f3195085c36ea8d24d32b2f828d23296a9370a28aa39d111f6f16bef9f3b"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "attohttpc"
|
name = "attohttpc"
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
@ -2193,6 +2204,7 @@ dependencies = [
|
|||||||
"app_dirs",
|
"app_dirs",
|
||||||
"async-recursion",
|
"async-recursion",
|
||||||
"async-stream",
|
"async-stream",
|
||||||
|
"async-trait",
|
||||||
"base64 0.12.1",
|
"base64 0.12.1",
|
||||||
"bigdecimal",
|
"bigdecimal",
|
||||||
"bson",
|
"bson",
|
||||||
|
@ -18,10 +18,10 @@ nu-parser = { version = "0.14.1", path = "../nu-parser" }
|
|||||||
nu-value-ext = { version = "0.14.1", path = "../nu-value-ext" }
|
nu-value-ext = { version = "0.14.1", path = "../nu-value-ext" }
|
||||||
nu-test-support = { version = "0.14.1", path = "../nu-test-support" }
|
nu-test-support = { version = "0.14.1", path = "../nu-test-support" }
|
||||||
|
|
||||||
|
|
||||||
ansi_term = "0.12.1"
|
ansi_term = "0.12.1"
|
||||||
app_dirs = "1.2.1"
|
app_dirs = "1.2.1"
|
||||||
async-recursion = "0.3.1"
|
async-recursion = "0.3.1"
|
||||||
|
async-trait = "0.1.31"
|
||||||
directories = "2.0.2"
|
directories = "2.0.2"
|
||||||
async-stream = "0.2"
|
async-stream = "0.2"
|
||||||
base64 = "0.12.1"
|
base64 = "0.12.1"
|
||||||
|
@ -18,6 +18,7 @@ pub struct AliasArgs {
|
|||||||
pub save: Option<bool>,
|
pub save: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Alias {
|
impl WholeStreamCommand for Alias {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"alias"
|
"alias"
|
||||||
@ -39,7 +40,7 @@ impl WholeStreamCommand for Alias {
|
|||||||
"Define a shortcut for another command."
|
"Define a shortcut for another command."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -11,6 +11,7 @@ struct AppendArgs {
|
|||||||
|
|
||||||
pub struct Append;
|
pub struct Append;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Append {
|
impl WholeStreamCommand for Append {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"append"
|
"append"
|
||||||
@ -28,7 +29,7 @@ impl WholeStreamCommand for Append {
|
|||||||
"Append the given row to the table"
|
"Append the given row to the table"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -10,6 +10,7 @@ use std::sync::atomic::Ordering;
|
|||||||
|
|
||||||
pub struct Autoview;
|
pub struct Autoview;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Autoview {
|
impl WholeStreamCommand for Autoview {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"autoview"
|
"autoview"
|
||||||
@ -23,7 +24,7 @@ impl WholeStreamCommand for Autoview {
|
|||||||
"View the contents of the pipeline as a table or list."
|
"View the contents of the pipeline as a table or list."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
@ -128,7 +129,7 @@ pub fn autoview(context: RunnableContext) -> Result<OutputStream, ShellError> {
|
|||||||
|
|
||||||
if let Some(table) = table {
|
if let Some(table) = table {
|
||||||
let command_args = create_default_command_args(&context).with_input(stream);
|
let command_args = create_default_command_args(&context).with_input(stream);
|
||||||
let result = table.run(command_args, &context.registry);
|
let result = table.run(command_args, &context.registry).await;
|
||||||
result.collect::<Vec<_>>().await;
|
result.collect::<Vec<_>>().await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,7 +143,7 @@ pub fn autoview(context: RunnableContext) -> Result<OutputStream, ShellError> {
|
|||||||
let mut stream = VecDeque::new();
|
let mut stream = VecDeque::new();
|
||||||
stream.push_back(UntaggedValue::string(s).into_value(Tag { anchor, span }));
|
stream.push_back(UntaggedValue::string(s).into_value(Tag { anchor, span }));
|
||||||
let command_args = create_default_command_args(&context).with_input(stream);
|
let command_args = create_default_command_args(&context).with_input(stream);
|
||||||
let result = text.run(command_args, &context.registry);
|
let result = text.run(command_args, &context.registry).await;
|
||||||
result.collect::<Vec<_>>().await;
|
result.collect::<Vec<_>>().await;
|
||||||
} else {
|
} else {
|
||||||
out!("{}", s);
|
out!("{}", s);
|
||||||
@ -162,7 +163,7 @@ pub fn autoview(context: RunnableContext) -> Result<OutputStream, ShellError> {
|
|||||||
let mut stream = VecDeque::new();
|
let mut stream = VecDeque::new();
|
||||||
stream.push_back(UntaggedValue::string(s).into_value(Tag { anchor, span }));
|
stream.push_back(UntaggedValue::string(s).into_value(Tag { anchor, span }));
|
||||||
let command_args = create_default_command_args(&context).with_input(stream);
|
let command_args = create_default_command_args(&context).with_input(stream);
|
||||||
let result = text.run(command_args, &context.registry);
|
let result = text.run(command_args, &context.registry).await;
|
||||||
result.collect::<Vec<_>>().await;
|
result.collect::<Vec<_>>().await;
|
||||||
} else {
|
} else {
|
||||||
out!("{}\n", s);
|
out!("{}\n", s);
|
||||||
@ -233,7 +234,7 @@ pub fn autoview(context: RunnableContext) -> Result<OutputStream, ShellError> {
|
|||||||
let mut stream = VecDeque::new();
|
let mut stream = VecDeque::new();
|
||||||
stream.push_back(x);
|
stream.push_back(x);
|
||||||
let command_args = create_default_command_args(&context).with_input(stream);
|
let command_args = create_default_command_args(&context).with_input(stream);
|
||||||
let result = binary.run(command_args, &context.registry);
|
let result = binary.run(command_args, &context.registry).await;
|
||||||
result.collect::<Vec<_>>().await;
|
result.collect::<Vec<_>>().await;
|
||||||
} else {
|
} else {
|
||||||
use pretty_hex::*;
|
use pretty_hex::*;
|
||||||
@ -328,7 +329,7 @@ pub fn autoview(context: RunnableContext) -> Result<OutputStream, ShellError> {
|
|||||||
let mut stream = VecDeque::new();
|
let mut stream = VecDeque::new();
|
||||||
stream.push_back(x);
|
stream.push_back(x);
|
||||||
let command_args = create_default_command_args(&context).with_input(stream);
|
let command_args = create_default_command_args(&context).with_input(stream);
|
||||||
let result = table.run(command_args, &context.registry);
|
let result = table.run(command_args, &context.registry).await;
|
||||||
result.collect::<Vec<_>>().await;
|
result.collect::<Vec<_>>().await;
|
||||||
} else {
|
} else {
|
||||||
out!("{:?}", item);
|
out!("{:?}", item);
|
||||||
|
@ -12,6 +12,7 @@ pub struct BuildStringArgs {
|
|||||||
|
|
||||||
pub struct BuildString;
|
pub struct BuildString;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for BuildString {
|
impl WholeStreamCommand for BuildString {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"build-string"
|
"build-string"
|
||||||
@ -26,7 +27,7 @@ impl WholeStreamCommand for BuildString {
|
|||||||
"Builds a string from the arguments"
|
"Builds a string from the arguments"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -9,6 +9,7 @@ use nu_protocol::{ReturnSuccess, Signature, SyntaxShape, UntaggedValue, Value};
|
|||||||
|
|
||||||
pub struct Cal;
|
pub struct Cal;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Cal {
|
impl WholeStreamCommand for Cal {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"cal"
|
"cal"
|
||||||
@ -36,7 +37,7 @@ impl WholeStreamCommand for Cal {
|
|||||||
"Display a calendar."
|
"Display a calendar."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -5,6 +5,7 @@ use nu_protocol::{Primitive, ReturnSuccess, UntaggedValue, Value};
|
|||||||
|
|
||||||
pub struct Calc;
|
pub struct Calc;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Calc {
|
impl WholeStreamCommand for Calc {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"calc"
|
"calc"
|
||||||
@ -14,7 +15,7 @@ impl WholeStreamCommand for Calc {
|
|||||||
"Parse a math expression into a number"
|
"Parse a math expression into a number"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -14,6 +14,7 @@ pub struct CdArgs {
|
|||||||
|
|
||||||
pub struct Cd;
|
pub struct Cd;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Cd {
|
impl WholeStreamCommand for Cd {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"cd"
|
"cd"
|
||||||
@ -31,7 +32,7 @@ impl WholeStreamCommand for Cd {
|
|||||||
"Change to a new path."
|
"Change to a new path."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -87,7 +87,7 @@ async fn run_pipeline(
|
|||||||
(_, Some(ClassifiedCommand::Error(err))) => return Err(err.clone().into()),
|
(_, Some(ClassifiedCommand::Error(err))) => return Err(err.clone().into()),
|
||||||
|
|
||||||
(Some(ClassifiedCommand::Internal(left)), _) => {
|
(Some(ClassifiedCommand::Internal(left)), _) => {
|
||||||
run_internal_command(left, ctx, input, it, vars, env)?
|
run_internal_command(left, ctx, input, it, vars, env).await?
|
||||||
}
|
}
|
||||||
|
|
||||||
(None, _) => break,
|
(None, _) => break,
|
||||||
|
@ -7,7 +7,7 @@ use nu_errors::ShellError;
|
|||||||
use nu_protocol::hir::InternalCommand;
|
use nu_protocol::hir::InternalCommand;
|
||||||
use nu_protocol::{CommandAction, Primitive, ReturnSuccess, Scope, UntaggedValue, Value};
|
use nu_protocol::{CommandAction, Primitive, ReturnSuccess, Scope, UntaggedValue, Value};
|
||||||
|
|
||||||
pub(crate) fn run_internal_command(
|
pub(crate) async fn run_internal_command(
|
||||||
command: InternalCommand,
|
command: InternalCommand,
|
||||||
context: &mut Context,
|
context: &mut Context,
|
||||||
input: InputStream,
|
input: InputStream,
|
||||||
@ -28,17 +28,18 @@ pub(crate) fn run_internal_command(
|
|||||||
let objects: InputStream = trace_stream!(target: "nu::trace_stream::internal", "input" = input);
|
let objects: InputStream = trace_stream!(target: "nu::trace_stream::internal", "input" = input);
|
||||||
let internal_command = context.expect_command(&command.name);
|
let internal_command = context.expect_command(&command.name);
|
||||||
|
|
||||||
let result = {
|
let mut result = {
|
||||||
context.run_command(
|
context
|
||||||
internal_command?,
|
.run_command(
|
||||||
Tag::unknown_anchor(command.name_span),
|
internal_command?,
|
||||||
command.args.clone(),
|
Tag::unknown_anchor(command.name_span),
|
||||||
&scope,
|
command.args.clone(),
|
||||||
objects,
|
&scope,
|
||||||
)
|
objects,
|
||||||
|
)
|
||||||
|
.await
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut result = trace_out_stream!(target: "nu::trace_stream::internal", "output" = result);
|
|
||||||
let mut context = context.clone();
|
let mut context = context.clone();
|
||||||
// let scope = scope.clone();
|
// let scope = scope.clone();
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ pub(crate) fn run_internal_command(
|
|||||||
scope: scope.clone(),
|
scope: scope.clone(),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut result = converter.run(new_args.with_input(vec![tagged_contents]), &context.registry);
|
let mut result = converter.run(new_args.with_input(vec![tagged_contents]), &context.registry).await;
|
||||||
let result_vec: Vec<Result<ReturnSuccess, ShellError>> = result.drain_vec().await;
|
let result_vec: Vec<Result<ReturnSuccess, ShellError>> = result.drain_vec().await;
|
||||||
for res in result_vec {
|
for res in result_vec {
|
||||||
match res {
|
match res {
|
||||||
|
@ -6,6 +6,7 @@ use std::process::Command;
|
|||||||
|
|
||||||
pub struct Clear;
|
pub struct Clear;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Clear {
|
impl WholeStreamCommand for Clear {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"clear"
|
"clear"
|
||||||
@ -19,7 +20,7 @@ impl WholeStreamCommand for Clear {
|
|||||||
"clears the terminal"
|
"clears the terminal"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -9,6 +9,7 @@ use clipboard::{ClipboardContext, ClipboardProvider};
|
|||||||
|
|
||||||
pub struct Clip;
|
pub struct Clip;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Clip {
|
impl WholeStreamCommand for Clip {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"clip"
|
"clip"
|
||||||
@ -22,7 +23,7 @@ impl WholeStreamCommand for Clip {
|
|||||||
"Copy the contents of the pipeline to the copy/paste buffer"
|
"Copy the contents of the pipeline to the copy/paste buffer"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -278,6 +278,7 @@ pub struct Example {
|
|||||||
pub result: Option<Vec<Value>>,
|
pub result: Option<Vec<Value>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
pub trait WholeStreamCommand: Send + Sync {
|
pub trait WholeStreamCommand: Send + Sync {
|
||||||
fn name(&self) -> &str;
|
fn name(&self) -> &str;
|
||||||
|
|
||||||
@ -287,7 +288,7 @@ pub trait WholeStreamCommand: Send + Sync {
|
|||||||
|
|
||||||
fn usage(&self) -> &str;
|
fn usage(&self) -> &str;
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
@ -337,7 +338,7 @@ impl Command {
|
|||||||
self.0.usage()
|
self.0.usage()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(&self, args: CommandArgs, registry: &CommandRegistry) -> OutputStream {
|
pub async fn run(&self, args: CommandArgs, registry: &CommandRegistry) -> OutputStream {
|
||||||
if args.call_info.switch_present("help") {
|
if args.call_info.switch_present("help") {
|
||||||
let cl = self.0.clone();
|
let cl = self.0.clone();
|
||||||
let registry = registry.clone();
|
let registry = registry.clone();
|
||||||
@ -346,7 +347,7 @@ impl Command {
|
|||||||
};
|
};
|
||||||
stream.to_output_stream()
|
stream.to_output_stream()
|
||||||
} else {
|
} else {
|
||||||
match self.0.run(args, registry) {
|
match self.0.run(args, registry).await {
|
||||||
Ok(stream) => stream,
|
Ok(stream) => stream,
|
||||||
Err(err) => OutputStream::one(Err(err)),
|
Err(err) => OutputStream::one(Err(err)),
|
||||||
}
|
}
|
||||||
@ -367,6 +368,7 @@ pub struct FnFilterCommand {
|
|||||||
func: fn(EvaluatedFilterCommandArgs) -> Result<OutputStream, ShellError>,
|
func: fn(EvaluatedFilterCommandArgs) -> Result<OutputStream, ShellError>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FnFilterCommand {
|
impl WholeStreamCommand for FnFilterCommand {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
&self.name
|
&self.name
|
||||||
@ -376,7 +378,7 @@ impl WholeStreamCommand for FnFilterCommand {
|
|||||||
"usage"
|
"usage"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ pub struct CompactArgs {
|
|||||||
rest: Vec<Tagged<String>>,
|
rest: Vec<Tagged<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Compact {
|
impl WholeStreamCommand for Compact {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"compact"
|
"compact"
|
||||||
@ -26,7 +27,7 @@ impl WholeStreamCommand for Compact {
|
|||||||
"Creates a table with non-empty rows"
|
"Creates a table with non-empty rows"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -20,6 +20,7 @@ pub struct ConfigArgs {
|
|||||||
path: Tagged<bool>,
|
path: Tagged<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Config {
|
impl WholeStreamCommand for Config {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"config"
|
"config"
|
||||||
@ -65,7 +66,7 @@ impl WholeStreamCommand for Config {
|
|||||||
"Configuration management."
|
"Configuration management."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -7,6 +7,7 @@ use nu_protocol::{ReturnSuccess, Signature, UntaggedValue, Value};
|
|||||||
|
|
||||||
pub struct Count;
|
pub struct Count;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Count {
|
impl WholeStreamCommand for Count {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"count"
|
"count"
|
||||||
@ -20,7 +21,7 @@ impl WholeStreamCommand for Count {
|
|||||||
"Show the total number of rows or items."
|
"Show the total number of rows or items."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -15,6 +15,7 @@ pub struct CopyArgs {
|
|||||||
pub recursive: Tagged<bool>,
|
pub recursive: Tagged<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Cpy {
|
impl WholeStreamCommand for Cpy {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"cp"
|
"cp"
|
||||||
@ -35,7 +36,7 @@ impl WholeStreamCommand for Cpy {
|
|||||||
"Copy files."
|
"Copy files."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -11,6 +11,7 @@ use nu_protocol::{ReturnSuccess, Signature, UntaggedValue};
|
|||||||
|
|
||||||
pub struct Date;
|
pub struct Date;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Date {
|
impl WholeStreamCommand for Date {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"date"
|
"date"
|
||||||
@ -26,7 +27,7 @@ impl WholeStreamCommand for Date {
|
|||||||
"Get the current datetime."
|
"Get the current datetime."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -10,6 +10,7 @@ pub struct DebugArgs {
|
|||||||
raw: bool,
|
raw: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Debug {
|
impl WholeStreamCommand for Debug {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"debug"
|
"debug"
|
||||||
@ -23,7 +24,7 @@ impl WholeStreamCommand for Debug {
|
|||||||
"Print the Rust debug representation of the values"
|
"Print the Rust debug representation of the values"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -14,6 +14,7 @@ struct DefaultArgs {
|
|||||||
|
|
||||||
pub struct Default;
|
pub struct Default;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Default {
|
impl WholeStreamCommand for Default {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"default"
|
"default"
|
||||||
@ -33,7 +34,7 @@ impl WholeStreamCommand for Default {
|
|||||||
"Sets a default row's column if missing."
|
"Sets a default row's column if missing."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -12,6 +12,7 @@ pub struct DropArgs {
|
|||||||
rows: Option<Tagged<u64>>,
|
rows: Option<Tagged<u64>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Drop {
|
impl WholeStreamCommand for Drop {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"drop"
|
"drop"
|
||||||
@ -29,7 +30,7 @@ impl WholeStreamCommand for Drop {
|
|||||||
"Drop the last number of rows."
|
"Drop the last number of rows."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -30,6 +30,7 @@ pub struct DuArgs {
|
|||||||
min_size: Option<Tagged<u64>>,
|
min_size: Option<Tagged<u64>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Du {
|
impl WholeStreamCommand for Du {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
NAME
|
NAME
|
||||||
@ -72,7 +73,7 @@ impl WholeStreamCommand for Du {
|
|||||||
"Find disk usage sizes of specified items"
|
"Find disk usage sizes of specified items"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -17,6 +17,7 @@ pub struct EachArgs {
|
|||||||
block: Block,
|
block: Block,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Each {
|
impl WholeStreamCommand for Each {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"each"
|
"each"
|
||||||
@ -34,7 +35,7 @@ impl WholeStreamCommand for Each {
|
|||||||
"Run a block on each row of the table."
|
"Run a block on each row of the table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ pub struct EchoArgs {
|
|||||||
pub rest: Vec<Value>,
|
pub rest: Vec<Value>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Echo {
|
impl WholeStreamCommand for Echo {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"echo"
|
"echo"
|
||||||
@ -26,7 +27,7 @@ impl WholeStreamCommand for Echo {
|
|||||||
"Echo the arguments back to the user."
|
"Echo the arguments back to the user."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -16,6 +16,7 @@ pub struct EnterArgs {
|
|||||||
location: Tagged<PathBuf>,
|
location: Tagged<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Enter {
|
impl WholeStreamCommand for Enter {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"enter"
|
"enter"
|
||||||
@ -33,7 +34,7 @@ impl WholeStreamCommand for Enter {
|
|||||||
"Create a new shell and begin at this path."
|
"Create a new shell and begin at this path."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
@ -131,7 +132,7 @@ fn enter(raw_args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStre
|
|||||||
let mut result = converter.run(
|
let mut result = converter.run(
|
||||||
new_args.with_input(vec![tagged_contents]),
|
new_args.with_input(vec![tagged_contents]),
|
||||||
®istry,
|
®istry,
|
||||||
);
|
).await;
|
||||||
let result_vec: Vec<Result<ReturnSuccess, ShellError>> =
|
let result_vec: Vec<Result<ReturnSuccess, ShellError>> =
|
||||||
result.drain_vec().await;
|
result.drain_vec().await;
|
||||||
for res in result_vec {
|
for res in result_vec {
|
||||||
|
@ -13,6 +13,7 @@ pub struct EvaluateByArgs {
|
|||||||
evaluate_with: Option<Tagged<String>>,
|
evaluate_with: Option<Tagged<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for EvaluateBy {
|
impl WholeStreamCommand for EvaluateBy {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"evaluate-by"
|
"evaluate-by"
|
||||||
@ -31,7 +32,7 @@ impl WholeStreamCommand for EvaluateBy {
|
|||||||
"Creates a new table with the data from the tables rows evaluated by the column given."
|
"Creates a new table with the data from the tables rows evaluated by the column given."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -6,6 +6,7 @@ use nu_protocol::{CommandAction, ReturnSuccess, Signature};
|
|||||||
|
|
||||||
pub struct Exit;
|
pub struct Exit;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Exit {
|
impl WholeStreamCommand for Exit {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"exit"
|
"exit"
|
||||||
@ -19,7 +20,7 @@ impl WholeStreamCommand for Exit {
|
|||||||
"Exit the current shell (or all shells)"
|
"Exit the current shell (or all shells)"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -12,6 +12,7 @@ pub struct FirstArgs {
|
|||||||
rows: Option<Tagged<usize>>,
|
rows: Option<Tagged<usize>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for First {
|
impl WholeStreamCommand for First {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"first"
|
"first"
|
||||||
@ -29,7 +30,7 @@ impl WholeStreamCommand for First {
|
|||||||
"Show only the first number of rows."
|
"Show only the first number of rows."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -14,6 +14,7 @@ pub struct FormatArgs {
|
|||||||
pattern: Tagged<String>,
|
pattern: Tagged<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Format {
|
impl WholeStreamCommand for Format {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"format"
|
"format"
|
||||||
@ -31,7 +32,7 @@ impl WholeStreamCommand for Format {
|
|||||||
"Format columns into a string using a simple pattern."
|
"Format columns into a string using a simple pattern."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -5,6 +5,7 @@ use nu_protocol::{ReturnSuccess, Signature, UntaggedValue};
|
|||||||
|
|
||||||
pub struct From;
|
pub struct From;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for From {
|
impl WholeStreamCommand for From {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from"
|
"from"
|
||||||
@ -18,7 +19,7 @@ impl WholeStreamCommand for From {
|
|||||||
"Parse content (string or binary) as a table (input format based on subcommand, like csv, ini, json, toml)"
|
"Parse content (string or binary) as a table (input format based on subcommand, like csv, ini, json, toml)"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
_args: CommandArgs,
|
_args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -8,6 +8,7 @@ use std::str::FromStr;
|
|||||||
|
|
||||||
pub struct FromBSON;
|
pub struct FromBSON;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromBSON {
|
impl WholeStreamCommand for FromBSON {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from bson"
|
"from bson"
|
||||||
@ -21,7 +22,7 @@ impl WholeStreamCommand for FromBSON {
|
|||||||
"Parse binary as .bson and create table."
|
"Parse binary as .bson and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -12,6 +12,7 @@ pub struct FromCSVArgs {
|
|||||||
separator: Option<Value>,
|
separator: Option<Value>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromCSV {
|
impl WholeStreamCommand for FromCSV {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from csv"
|
"from csv"
|
||||||
@ -36,7 +37,7 @@ impl WholeStreamCommand for FromCSV {
|
|||||||
"Parse text as .csv and create table."
|
"Parse text as .csv and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -16,6 +16,7 @@ pub struct FromEMLArgs {
|
|||||||
preview_body: Option<Tagged<usize>>,
|
preview_body: Option<Tagged<usize>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromEML {
|
impl WholeStreamCommand for FromEML {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from eml"
|
"from eml"
|
||||||
@ -34,7 +35,7 @@ impl WholeStreamCommand for FromEML {
|
|||||||
"Parse text as .eml and create table."
|
"Parse text as .eml and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -9,6 +9,7 @@ use std::io::BufReader;
|
|||||||
|
|
||||||
pub struct FromIcs;
|
pub struct FromIcs;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromIcs {
|
impl WholeStreamCommand for FromIcs {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from ics"
|
"from ics"
|
||||||
@ -22,7 +23,7 @@ impl WholeStreamCommand for FromIcs {
|
|||||||
"Parse text as .ics and create table."
|
"Parse text as .ics and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -6,6 +6,7 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
pub struct FromINI;
|
pub struct FromINI;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromINI {
|
impl WholeStreamCommand for FromINI {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from ini"
|
"from ini"
|
||||||
@ -19,7 +20,7 @@ impl WholeStreamCommand for FromINI {
|
|||||||
"Parse text as .ini and create table"
|
"Parse text as .ini and create table"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -10,6 +10,7 @@ pub struct FromJSONArgs {
|
|||||||
objects: bool,
|
objects: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromJSON {
|
impl WholeStreamCommand for FromJSON {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from json"
|
"from json"
|
||||||
@ -27,7 +28,7 @@ impl WholeStreamCommand for FromJSON {
|
|||||||
"Parse text as .json and create table."
|
"Parse text as .json and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ pub struct FromODSArgs {
|
|||||||
headerless: bool,
|
headerless: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromODS {
|
impl WholeStreamCommand for FromODS {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from ods"
|
"from ods"
|
||||||
@ -30,7 +31,7 @@ impl WholeStreamCommand for FromODS {
|
|||||||
"Parse OpenDocument Spreadsheet(.ods) data and create table."
|
"Parse OpenDocument Spreadsheet(.ods) data and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -8,6 +8,7 @@ use std::path::Path;
|
|||||||
|
|
||||||
pub struct FromSQLite;
|
pub struct FromSQLite;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromSQLite {
|
impl WholeStreamCommand for FromSQLite {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from sqlite"
|
"from sqlite"
|
||||||
@ -21,7 +22,7 @@ impl WholeStreamCommand for FromSQLite {
|
|||||||
"Parse binary data as sqlite .db and create table."
|
"Parse binary data as sqlite .db and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
@ -32,6 +33,7 @@ impl WholeStreamCommand for FromSQLite {
|
|||||||
|
|
||||||
pub struct FromDB;
|
pub struct FromDB;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromDB {
|
impl WholeStreamCommand for FromDB {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from db"
|
"from db"
|
||||||
@ -45,7 +47,7 @@ impl WholeStreamCommand for FromDB {
|
|||||||
"Parse binary data as db and create table."
|
"Parse binary data as db and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -20,6 +20,7 @@ pub struct FromSSVArgs {
|
|||||||
const STRING_REPRESENTATION: &str = "from ssv";
|
const STRING_REPRESENTATION: &str = "from ssv";
|
||||||
const DEFAULT_MINIMUM_SPACES: usize = 2;
|
const DEFAULT_MINIMUM_SPACES: usize = 2;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromSSV {
|
impl WholeStreamCommand for FromSSV {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
STRING_REPRESENTATION
|
STRING_REPRESENTATION
|
||||||
@ -45,7 +46,7 @@ impl WholeStreamCommand for FromSSV {
|
|||||||
"Parse text as space-separated values and create a table. The default minimum number of spaces counted as a separator is 2."
|
"Parse text as space-separated values and create a table. The default minimum number of spaces counted as a separator is 2."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -5,6 +5,7 @@ use nu_protocol::{Primitive, ReturnSuccess, Signature, TaggedDictBuilder, Untagg
|
|||||||
|
|
||||||
pub struct FromTOML;
|
pub struct FromTOML;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromTOML {
|
impl WholeStreamCommand for FromTOML {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from toml"
|
"from toml"
|
||||||
@ -18,7 +19,7 @@ impl WholeStreamCommand for FromTOML {
|
|||||||
"Parse text as .toml and create table."
|
"Parse text as .toml and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -11,6 +11,7 @@ pub struct FromTSVArgs {
|
|||||||
headerless: bool,
|
headerless: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromTSV {
|
impl WholeStreamCommand for FromTSV {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from tsv"
|
"from tsv"
|
||||||
@ -28,7 +29,7 @@ impl WholeStreamCommand for FromTSV {
|
|||||||
"Parse text as .tsv and create table."
|
"Parse text as .tsv and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -5,6 +5,7 @@ use nu_protocol::{ReturnSuccess, Signature, TaggedDictBuilder, UntaggedValue};
|
|||||||
|
|
||||||
pub struct FromURL;
|
pub struct FromURL;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromURL {
|
impl WholeStreamCommand for FromURL {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from url"
|
"from url"
|
||||||
@ -18,7 +19,7 @@ impl WholeStreamCommand for FromURL {
|
|||||||
"Parse url-encoded string as a table."
|
"Parse url-encoded string as a table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -9,6 +9,7 @@ use std::io::BufReader;
|
|||||||
|
|
||||||
pub struct FromVcf;
|
pub struct FromVcf;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromVcf {
|
impl WholeStreamCommand for FromVcf {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from vcf"
|
"from vcf"
|
||||||
@ -22,7 +23,7 @@ impl WholeStreamCommand for FromVcf {
|
|||||||
"Parse text as .vcf and create table."
|
"Parse text as .vcf and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ pub struct FromXLSXArgs {
|
|||||||
headerless: bool,
|
headerless: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromXLSX {
|
impl WholeStreamCommand for FromXLSX {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from xlsx"
|
"from xlsx"
|
||||||
@ -30,7 +31,7 @@ impl WholeStreamCommand for FromXLSX {
|
|||||||
"Parse binary Excel(.xlsx) data and create table."
|
"Parse binary Excel(.xlsx) data and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -5,6 +5,7 @@ use nu_protocol::{Primitive, ReturnSuccess, Signature, TaggedDictBuilder, Untagg
|
|||||||
|
|
||||||
pub struct FromXML;
|
pub struct FromXML;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromXML {
|
impl WholeStreamCommand for FromXML {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from xml"
|
"from xml"
|
||||||
@ -18,7 +19,7 @@ impl WholeStreamCommand for FromXML {
|
|||||||
"Parse text as .xml and create table."
|
"Parse text as .xml and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -5,6 +5,7 @@ use nu_protocol::{Primitive, ReturnSuccess, Signature, TaggedDictBuilder, Untagg
|
|||||||
|
|
||||||
pub struct FromYAML;
|
pub struct FromYAML;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromYAML {
|
impl WholeStreamCommand for FromYAML {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from yaml"
|
"from yaml"
|
||||||
@ -18,7 +19,7 @@ impl WholeStreamCommand for FromYAML {
|
|||||||
"Parse text as .yaml/.yml and create table."
|
"Parse text as .yaml/.yml and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
@ -29,6 +30,7 @@ impl WholeStreamCommand for FromYAML {
|
|||||||
|
|
||||||
pub struct FromYML;
|
pub struct FromYML;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for FromYML {
|
impl WholeStreamCommand for FromYML {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from yml"
|
"from yml"
|
||||||
@ -42,7 +44,7 @@ impl WholeStreamCommand for FromYML {
|
|||||||
"Parse text as .yaml/.yml and create table."
|
"Parse text as .yaml/.yml and create table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -17,6 +17,7 @@ pub struct GetArgs {
|
|||||||
rest: Vec<ColumnPath>,
|
rest: Vec<ColumnPath>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Get {
|
impl WholeStreamCommand for Get {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"get"
|
"get"
|
||||||
@ -33,7 +34,7 @@ impl WholeStreamCommand for Get {
|
|||||||
"Open given cells as text."
|
"Open given cells as text."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -12,6 +12,7 @@ pub struct GroupByArgs {
|
|||||||
column_name: Option<Tagged<String>>,
|
column_name: Option<Tagged<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for GroupBy {
|
impl WholeStreamCommand for GroupBy {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"group-by"
|
"group-by"
|
||||||
@ -29,7 +30,7 @@ impl WholeStreamCommand for GroupBy {
|
|||||||
"Creates a new table with the data from the table rows grouped by the column given."
|
"Creates a new table with the data from the table rows grouped by the column given."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -12,6 +12,7 @@ pub struct GroupByDateArgs {
|
|||||||
format: Option<Tagged<String>>,
|
format: Option<Tagged<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for GroupByDate {
|
impl WholeStreamCommand for GroupByDate {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"group-by date"
|
"group-by date"
|
||||||
@ -36,7 +37,7 @@ impl WholeStreamCommand for GroupByDate {
|
|||||||
"Creates a new table with the data from the table rows grouped by the column given."
|
"Creates a new table with the data from the table rows grouped by the column given."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -9,6 +9,7 @@ use nu_protocol::{ReturnSuccess, Signature, UntaggedValue, Value};
|
|||||||
|
|
||||||
pub struct Headers;
|
pub struct Headers;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Headers {
|
impl WholeStreamCommand for Headers {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"headers"
|
"headers"
|
||||||
@ -22,7 +23,7 @@ impl WholeStreamCommand for Headers {
|
|||||||
"Use the first row of the table as column names"
|
"Use the first row of the table as column names"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -17,6 +17,7 @@ pub struct HelpArgs {
|
|||||||
rest: Vec<Tagged<String>>,
|
rest: Vec<Tagged<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Help {
|
impl WholeStreamCommand for Help {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"help"
|
"help"
|
||||||
@ -30,7 +31,7 @@ impl WholeStreamCommand for Help {
|
|||||||
"Display help information about commands."
|
"Display help information about commands."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -17,6 +17,7 @@ pub struct HistogramArgs {
|
|||||||
rest: Vec<Tagged<String>>,
|
rest: Vec<Tagged<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Histogram {
|
impl WholeStreamCommand for Histogram {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"histogram"
|
"histogram"
|
||||||
@ -39,7 +40,7 @@ impl WholeStreamCommand for Histogram {
|
|||||||
"Creates a new table with a histogram based on the column name passed in."
|
"Creates a new table with a histogram based on the column name passed in."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -8,6 +8,7 @@ use std::io::{BufRead, BufReader};
|
|||||||
|
|
||||||
pub struct History;
|
pub struct History;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for History {
|
impl WholeStreamCommand for History {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"history"
|
"history"
|
||||||
@ -21,7 +22,7 @@ impl WholeStreamCommand for History {
|
|||||||
"Display command history."
|
"Display command history."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ pub struct InsertArgs {
|
|||||||
value: Value,
|
value: Value,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Insert {
|
impl WholeStreamCommand for Insert {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"insert"
|
"insert"
|
||||||
@ -36,7 +37,7 @@ impl WholeStreamCommand for Insert {
|
|||||||
"Insert a new column with a given value."
|
"Insert a new column with a given value."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -20,6 +20,7 @@ pub struct IsEmptyArgs {
|
|||||||
rest: Vec<Value>,
|
rest: Vec<Value>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for IsEmpty {
|
impl WholeStreamCommand for IsEmpty {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"empty?"
|
"empty?"
|
||||||
@ -36,7 +37,7 @@ impl WholeStreamCommand for IsEmpty {
|
|||||||
"Checks emptiness. The last value is the replacement value for any empty column(s) given to check against the table."
|
"Checks emptiness. The last value is the replacement value for any empty column(s) given to check against the table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -12,6 +12,7 @@ pub struct KeepArgs {
|
|||||||
rows: Option<Tagged<usize>>,
|
rows: Option<Tagged<usize>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Keep {
|
impl WholeStreamCommand for Keep {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"keep"
|
"keep"
|
||||||
@ -29,7 +30,7 @@ impl WholeStreamCommand for Keep {
|
|||||||
"Keep the number of rows only"
|
"Keep the number of rows only"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -9,6 +9,7 @@ use nu_protocol::{
|
|||||||
|
|
||||||
pub struct KeepUntil;
|
pub struct KeepUntil;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for KeepUntil {
|
impl WholeStreamCommand for KeepUntil {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"keep-until"
|
"keep-until"
|
||||||
@ -28,7 +29,7 @@ impl WholeStreamCommand for KeepUntil {
|
|||||||
"Keeps rows until the condition matches."
|
"Keeps rows until the condition matches."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -9,6 +9,7 @@ use nu_protocol::{
|
|||||||
|
|
||||||
pub struct KeepWhile;
|
pub struct KeepWhile;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for KeepWhile {
|
impl WholeStreamCommand for KeepWhile {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"keep-while"
|
"keep-while"
|
||||||
@ -28,7 +29,7 @@ impl WholeStreamCommand for KeepWhile {
|
|||||||
"Keeps rows while the condition matches."
|
"Keeps rows while the condition matches."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -16,6 +16,7 @@ pub struct KillArgs {
|
|||||||
pub quiet: Tagged<bool>,
|
pub quiet: Tagged<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Kill {
|
impl WholeStreamCommand for Kill {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"kill"
|
"kill"
|
||||||
@ -37,7 +38,7 @@ impl WholeStreamCommand for Kill {
|
|||||||
"Kill a process using the process id."
|
"Kill a process using the process id."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -12,6 +12,7 @@ pub struct LastArgs {
|
|||||||
rows: Option<Tagged<u64>>,
|
rows: Option<Tagged<u64>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Last {
|
impl WholeStreamCommand for Last {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"last"
|
"last"
|
||||||
@ -29,7 +30,7 @@ impl WholeStreamCommand for Last {
|
|||||||
"Show only the last number of rows."
|
"Show only the last number of rows."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -5,6 +5,7 @@ use nu_protocol::{Primitive, ReturnSuccess, Signature, UntaggedValue, Value};
|
|||||||
|
|
||||||
pub struct Lines;
|
pub struct Lines;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Lines {
|
impl WholeStreamCommand for Lines {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"lines"
|
"lines"
|
||||||
@ -18,7 +19,7 @@ impl WholeStreamCommand for Lines {
|
|||||||
"Split single string into rows, one per line."
|
"Split single string into rows, one per line."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -20,6 +20,7 @@ pub struct LsArgs {
|
|||||||
pub du: bool,
|
pub du: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Ls {
|
impl WholeStreamCommand for Ls {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"ls"
|
"ls"
|
||||||
@ -59,7 +60,7 @@ impl WholeStreamCommand for Ls {
|
|||||||
"View the contents of the current or given path."
|
"View the contents of the current or given path."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -14,6 +14,7 @@ pub struct MapMaxByArgs {
|
|||||||
column_name: Option<Tagged<String>>,
|
column_name: Option<Tagged<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for MapMaxBy {
|
impl WholeStreamCommand for MapMaxBy {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"map-max-by"
|
"map-max-by"
|
||||||
@ -32,7 +33,7 @@ impl WholeStreamCommand for MapMaxBy {
|
|||||||
"Creates a new table with the data from the tables rows maxed by the column given."
|
"Creates a new table with the data from the tables rows maxed by the column given."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -14,6 +14,7 @@ pub struct MergeArgs {
|
|||||||
block: Block,
|
block: Block,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Merge {
|
impl WholeStreamCommand for Merge {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"merge"
|
"merge"
|
||||||
@ -31,7 +32,7 @@ impl WholeStreamCommand for Merge {
|
|||||||
"Merge a table."
|
"Merge a table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ pub struct MkdirArgs {
|
|||||||
pub rest: Vec<Tagged<PathBuf>>,
|
pub rest: Vec<Tagged<PathBuf>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Mkdir {
|
impl WholeStreamCommand for Mkdir {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"mkdir"
|
"mkdir"
|
||||||
@ -26,7 +27,7 @@ impl WholeStreamCommand for Mkdir {
|
|||||||
"Make directories, creates intermediary directories as required."
|
"Make directories, creates intermediary directories as required."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -14,6 +14,7 @@ pub struct MoveArgs {
|
|||||||
pub dst: Tagged<PathBuf>,
|
pub dst: Tagged<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Move {
|
impl WholeStreamCommand for Move {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"mv"
|
"mv"
|
||||||
@ -37,7 +38,7 @@ impl WholeStreamCommand for Move {
|
|||||||
"Move files or directories."
|
"Move files or directories."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -5,6 +5,7 @@ use nu_protocol::{CommandAction, ReturnSuccess, Signature};
|
|||||||
|
|
||||||
pub struct Next;
|
pub struct Next;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Next {
|
impl WholeStreamCommand for Next {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"n"
|
"n"
|
||||||
@ -18,7 +19,7 @@ impl WholeStreamCommand for Next {
|
|||||||
"Go to next shell."
|
"Go to next shell."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ struct NthArgs {
|
|||||||
|
|
||||||
pub struct Nth;
|
pub struct Nth;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Nth {
|
impl WholeStreamCommand for Nth {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"nth"
|
"nth"
|
||||||
@ -32,7 +33,7 @@ impl WholeStreamCommand for Nth {
|
|||||||
"Return only the selected rows"
|
"Return only the selected rows"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ pub struct OpenArgs {
|
|||||||
raw: Tagged<bool>,
|
raw: Tagged<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Open {
|
impl WholeStreamCommand for Open {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"open"
|
"open"
|
||||||
@ -36,7 +37,7 @@ impl WholeStreamCommand for Open {
|
|||||||
"Load a file into a cell, convert to table if possible (avoid by appending '--raw')"
|
"Load a file into a cell, convert to table if possible (avoid by appending '--raw')"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -18,6 +18,7 @@ pub struct PivotArgs {
|
|||||||
ignore_titles: bool,
|
ignore_titles: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Pivot {
|
impl WholeStreamCommand for Pivot {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"pivot"
|
"pivot"
|
||||||
@ -45,7 +46,7 @@ impl WholeStreamCommand for Pivot {
|
|||||||
"Pivots the table contents so rows become columns and columns become rows."
|
"Pivots the table contents so rows become columns and columns become rows."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -42,6 +42,7 @@ pub struct PluginCommand {
|
|||||||
config: Signature,
|
config: Signature,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for PluginCommand {
|
impl WholeStreamCommand for PluginCommand {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
&self.name
|
&self.name
|
||||||
@ -55,7 +56,7 @@ impl WholeStreamCommand for PluginCommand {
|
|||||||
&self.config.usage
|
&self.config.usage
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
@ -271,6 +272,7 @@ pub struct PluginSink {
|
|||||||
config: Signature,
|
config: Signature,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for PluginSink {
|
impl WholeStreamCommand for PluginSink {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
&self.name
|
&self.name
|
||||||
@ -284,7 +286,7 @@ impl WholeStreamCommand for PluginSink {
|
|||||||
&self.config.usage
|
&self.config.usage
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -11,6 +11,7 @@ struct PrependArgs {
|
|||||||
|
|
||||||
pub struct Prepend;
|
pub struct Prepend;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Prepend {
|
impl WholeStreamCommand for Prepend {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"prepend"
|
"prepend"
|
||||||
@ -28,7 +29,7 @@ impl WholeStreamCommand for Prepend {
|
|||||||
"Prepend the given row to the front of the table"
|
"Prepend the given row to the front of the table"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -6,6 +6,7 @@ use crate::commands::WholeStreamCommand;
|
|||||||
|
|
||||||
pub struct Previous;
|
pub struct Previous;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Previous {
|
impl WholeStreamCommand for Previous {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"p"
|
"p"
|
||||||
@ -19,7 +20,7 @@ impl WholeStreamCommand for Previous {
|
|||||||
"Go to previous shell."
|
"Go to previous shell."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -5,6 +5,7 @@ use nu_protocol::Signature;
|
|||||||
|
|
||||||
pub struct Pwd;
|
pub struct Pwd;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Pwd {
|
impl WholeStreamCommand for Pwd {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"pwd"
|
"pwd"
|
||||||
@ -18,7 +19,7 @@ impl WholeStreamCommand for Pwd {
|
|||||||
"Output the current working directory."
|
"Output the current working directory."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ struct RangeArgs {
|
|||||||
|
|
||||||
pub struct Range;
|
pub struct Range;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Range {
|
impl WholeStreamCommand for Range {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"range"
|
"range"
|
||||||
@ -30,7 +31,7 @@ impl WholeStreamCommand for Range {
|
|||||||
"Return only the selected rows"
|
"Return only the selected rows"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ pub struct ReduceByArgs {
|
|||||||
reduce_with: Option<Tagged<String>>,
|
reduce_with: Option<Tagged<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for ReduceBy {
|
impl WholeStreamCommand for ReduceBy {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"reduce-by"
|
"reduce-by"
|
||||||
@ -31,7 +32,7 @@ impl WholeStreamCommand for ReduceBy {
|
|||||||
"Creates a new table with the data from the tables rows reduced by the command given."
|
"Creates a new table with the data from the tables rows reduced by the command given."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -12,6 +12,7 @@ pub struct RejectArgs {
|
|||||||
|
|
||||||
pub struct Reject;
|
pub struct Reject;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Reject {
|
impl WholeStreamCommand for Reject {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"reject"
|
"reject"
|
||||||
@ -25,7 +26,7 @@ impl WholeStreamCommand for Reject {
|
|||||||
"Remove the given columns from the table."
|
"Remove the given columns from the table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ pub struct Arguments {
|
|||||||
rest: Vec<Tagged<String>>,
|
rest: Vec<Tagged<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Rename {
|
impl WholeStreamCommand for Rename {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"rename"
|
"rename"
|
||||||
@ -32,7 +33,7 @@ impl WholeStreamCommand for Rename {
|
|||||||
"Creates a new table with columns renamed."
|
"Creates a new table with columns renamed."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -6,6 +6,7 @@ use nu_protocol::{ReturnSuccess, Signature, UntaggedValue};
|
|||||||
|
|
||||||
pub struct Reverse;
|
pub struct Reverse;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Reverse {
|
impl WholeStreamCommand for Reverse {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"reverse"
|
"reverse"
|
||||||
@ -19,7 +20,7 @@ impl WholeStreamCommand for Reverse {
|
|||||||
"Reverses the table."
|
"Reverses the table."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -16,6 +16,7 @@ pub struct RemoveArgs {
|
|||||||
pub trash: Tagged<bool>,
|
pub trash: Tagged<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Remove {
|
impl WholeStreamCommand for Remove {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"rm"
|
"rm"
|
||||||
@ -36,7 +37,7 @@ impl WholeStreamCommand for Remove {
|
|||||||
"Remove file(s)"
|
"Remove file(s)"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ pub struct AliasCommand {
|
|||||||
block: Block,
|
block: Block,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for AliasCommand {
|
impl WholeStreamCommand for AliasCommand {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
&self.name
|
&self.name
|
||||||
@ -32,7 +33,7 @@ impl WholeStreamCommand for AliasCommand {
|
|||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -37,6 +37,7 @@ fn spanned_expression_to_string(expr: SpannedExpression) -> Result<String, Shell
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for RunExternalCommand {
|
impl WholeStreamCommand for RunExternalCommand {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"run_external"
|
"run_external"
|
||||||
@ -50,7 +51,7 @@ impl WholeStreamCommand for RunExternalCommand {
|
|||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -129,6 +129,7 @@ pub struct SaveArgs {
|
|||||||
raw: bool,
|
raw: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Save {
|
impl WholeStreamCommand for Save {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"save"
|
"save"
|
||||||
@ -148,7 +149,7 @@ impl WholeStreamCommand for Save {
|
|||||||
"Save the contents of the pipeline to a file."
|
"Save the contents of the pipeline to a file."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
@ -232,7 +233,7 @@ fn save(raw_args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStrea
|
|||||||
scope,
|
scope,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut result = converter.run(new_args.with_input(input), ®istry);
|
let mut result = converter.run(new_args.with_input(input), ®istry).await;
|
||||||
let result_vec: Vec<Result<ReturnSuccess, ShellError>> = result.drain_vec().await;
|
let result_vec: Vec<Result<ReturnSuccess, ShellError>> = result.drain_vec().await;
|
||||||
if converter.is_binary() {
|
if converter.is_binary() {
|
||||||
process_binary_return_success!('scope, result_vec, name_tag)
|
process_binary_return_success!('scope, result_vec, name_tag)
|
||||||
|
@ -16,6 +16,7 @@ struct SelectArgs {
|
|||||||
|
|
||||||
pub struct Select;
|
pub struct Select;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Select {
|
impl WholeStreamCommand for Select {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"select"
|
"select"
|
||||||
@ -32,7 +33,7 @@ impl WholeStreamCommand for Select {
|
|||||||
"Down-select table to only these columns."
|
"Down-select table to only these columns."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -6,6 +6,7 @@ use std::sync::atomic::Ordering;
|
|||||||
|
|
||||||
pub struct Shells;
|
pub struct Shells;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Shells {
|
impl WholeStreamCommand for Shells {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"shells"
|
"shells"
|
||||||
@ -19,7 +20,7 @@ impl WholeStreamCommand for Shells {
|
|||||||
"Display the list of current shells."
|
"Display the list of current shells."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -9,6 +9,7 @@ use rand::thread_rng;
|
|||||||
|
|
||||||
pub struct Shuffle;
|
pub struct Shuffle;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Shuffle {
|
impl WholeStreamCommand for Shuffle {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"shuffle"
|
"shuffle"
|
||||||
@ -18,7 +19,7 @@ impl WholeStreamCommand for Shuffle {
|
|||||||
"Shuffle rows randomly."
|
"Shuffle rows randomly."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -6,6 +6,7 @@ use nu_protocol::{ReturnSuccess, Signature, TaggedDictBuilder, UntaggedValue, Va
|
|||||||
|
|
||||||
pub struct Size;
|
pub struct Size;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Size {
|
impl WholeStreamCommand for Size {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"size"
|
"size"
|
||||||
@ -19,7 +20,7 @@ impl WholeStreamCommand for Size {
|
|||||||
"Gather word count statistics on the text."
|
"Gather word count statistics on the text."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -12,6 +12,7 @@ pub struct SkipArgs {
|
|||||||
rows: Option<Tagged<usize>>,
|
rows: Option<Tagged<usize>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Skip {
|
impl WholeStreamCommand for Skip {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"skip"
|
"skip"
|
||||||
@ -25,7 +26,7 @@ impl WholeStreamCommand for Skip {
|
|||||||
"Skip some number of rows."
|
"Skip some number of rows."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -9,6 +9,7 @@ use nu_protocol::{
|
|||||||
|
|
||||||
pub struct SkipUntil;
|
pub struct SkipUntil;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for SkipUntil {
|
impl WholeStreamCommand for SkipUntil {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"skip-until"
|
"skip-until"
|
||||||
@ -28,7 +29,7 @@ impl WholeStreamCommand for SkipUntil {
|
|||||||
"Skips rows until the condition matches."
|
"Skips rows until the condition matches."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -9,6 +9,7 @@ use nu_protocol::{
|
|||||||
|
|
||||||
pub struct SkipWhile;
|
pub struct SkipWhile;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for SkipWhile {
|
impl WholeStreamCommand for SkipWhile {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"skip-while"
|
"skip-while"
|
||||||
@ -28,7 +29,7 @@ impl WholeStreamCommand for SkipWhile {
|
|||||||
"Skips rows while the condition matches."
|
"Skips rows while the condition matches."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -12,6 +12,7 @@ pub struct SortByArgs {
|
|||||||
rest: Vec<Tagged<String>>,
|
rest: Vec<Tagged<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for SortBy {
|
impl WholeStreamCommand for SortBy {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"sort-by"
|
"sort-by"
|
||||||
@ -25,7 +26,7 @@ impl WholeStreamCommand for SortBy {
|
|||||||
"Sort by the given columns, in increasing order."
|
"Sort by the given columns, in increasing order."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -17,6 +17,7 @@ struct SplitColumnArgs {
|
|||||||
|
|
||||||
pub struct SubCommand;
|
pub struct SubCommand;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for SubCommand {
|
impl WholeStreamCommand for SubCommand {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"split column"
|
"split column"
|
||||||
@ -37,7 +38,7 @@ impl WholeStreamCommand for SubCommand {
|
|||||||
"splits contents across multiple columns via the separator."
|
"splits contents across multiple columns via the separator."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -6,6 +6,7 @@ use nu_protocol::{ReturnSuccess, Signature, UntaggedValue};
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Command;
|
pub struct Command;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Command {
|
impl WholeStreamCommand for Command {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"split"
|
"split"
|
||||||
@ -19,7 +20,7 @@ impl WholeStreamCommand for Command {
|
|||||||
"split contents across desired subcommand (like row, column) via the separator."
|
"split contents across desired subcommand (like row, column) via the separator."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
_args: CommandArgs,
|
_args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -12,6 +12,7 @@ struct SplitRowArgs {
|
|||||||
|
|
||||||
pub struct SubCommand;
|
pub struct SubCommand;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for SubCommand {
|
impl WholeStreamCommand for SubCommand {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"split row"
|
"split row"
|
||||||
@ -29,7 +30,7 @@ impl WholeStreamCommand for SubCommand {
|
|||||||
"splits contents over multiple rows via the separator."
|
"splits contents over multiple rows via the separator."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -13,6 +13,7 @@ pub struct SplitByArgs {
|
|||||||
column_name: Tagged<String>,
|
column_name: Tagged<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for SplitBy {
|
impl WholeStreamCommand for SplitBy {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"split-by"
|
"split-by"
|
||||||
@ -30,7 +31,7 @@ impl WholeStreamCommand for SplitBy {
|
|||||||
"Creates a new table with the data from the inner tables split by the column given."
|
"Creates a new table with the data from the inner tables split by the column given."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -15,6 +15,7 @@ struct Arguments {
|
|||||||
|
|
||||||
pub struct SubCommand;
|
pub struct SubCommand;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for SubCommand {
|
impl WholeStreamCommand for SubCommand {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"str capitalize"
|
"str capitalize"
|
||||||
@ -31,7 +32,7 @@ impl WholeStreamCommand for SubCommand {
|
|||||||
"capitalizes text"
|
"capitalizes text"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -5,6 +5,7 @@ use nu_protocol::{ReturnSuccess, Signature, SyntaxShape, UntaggedValue};
|
|||||||
|
|
||||||
pub struct Command;
|
pub struct Command;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for Command {
|
impl WholeStreamCommand for Command {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"str"
|
"str"
|
||||||
@ -21,7 +22,7 @@ impl WholeStreamCommand for Command {
|
|||||||
"Apply string function."
|
"Apply string function."
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
_args: CommandArgs,
|
_args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -15,6 +15,7 @@ struct Arguments {
|
|||||||
|
|
||||||
pub struct SubCommand;
|
pub struct SubCommand;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for SubCommand {
|
impl WholeStreamCommand for SubCommand {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"str downcase"
|
"str downcase"
|
||||||
@ -31,7 +32,7 @@ impl WholeStreamCommand for SubCommand {
|
|||||||
"downcases text"
|
"downcases text"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
@ -19,6 +19,7 @@ struct Arguments {
|
|||||||
|
|
||||||
pub struct SubCommand;
|
pub struct SubCommand;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
impl WholeStreamCommand for SubCommand {
|
impl WholeStreamCommand for SubCommand {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"str find-replace"
|
"str find-replace"
|
||||||
@ -38,7 +39,7 @@ impl WholeStreamCommand for SubCommand {
|
|||||||
"finds and replaces text"
|
"finds and replaces text"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
async fn run(
|
||||||
&self,
|
&self,
|
||||||
args: CommandArgs,
|
args: CommandArgs,
|
||||||
registry: &CommandRegistry,
|
registry: &CommandRegistry,
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user