From 1012a8dc41c97497ab50550e810ffb1568b7ea5d Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Sat, 1 Jun 2019 08:34:15 +1200 Subject: [PATCH] Cleanup/rename some commands --- README.md | 4 ++-- src/cli.rs | 4 ++-- src/commands.rs | 4 ++-- src/commands/select.rs | 1 - src/commands/{col_split.rs => split_column.rs} | 3 +-- src/commands/{row_split.rs => split_row.rs} | 6 ++---- 6 files changed, 9 insertions(+), 13 deletions(-) rename src/commands/{col_split.rs => split_column.rs} (95%) rename src/commands/{row_split.rs => split_row.rs} (78%) diff --git a/README.md b/README.md index 5bc546c26..edf57b8b5 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ Nu currently has the following built-in commands: - to-json - from-json - open filename -- column-split sep ...fields -- row-split sep ...fields +- split-column sep ...fields +- split-row sep ...fields - select field # Goals diff --git a/src/cli.rs b/src/cli.rs index 24f9e6197..595138542 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -52,8 +52,8 @@ pub async fn cli() -> Result<(), Box> { command("from-json", from_json::from_json), command("open", open::open), command("column", column::column), - command("column-split", col_split::col_split), - command("row-split", row_split::row_split), + command("split-column", split_column::split_column), + command("split-row", split_row::split_row), command("reject", reject::reject), command("select", select::select), command("to-array", to_array::to_array), diff --git a/src/commands.rs b/src/commands.rs index ca345a751..7978249bd 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -12,8 +12,8 @@ crate mod select; crate mod size; crate mod skip; crate mod sort_by; -crate mod col_split; -crate mod row_split; +crate mod split_column; +crate mod split_row; crate mod take; crate mod to_array; crate mod to_json; diff --git a/src/commands/select.rs b/src/commands/select.rs index 8c05537a0..34020dca1 100644 --- a/src/commands/select.rs +++ b/src/commands/select.rs @@ -1,6 +1,5 @@ use crate::errors::ShellError; use crate::object::Value; -use crate::object::base::select_fields; use crate::prelude::*; fn get_member(path: &str, obj: &Value) -> Option { diff --git a/src/commands/col_split.rs b/src/commands/split_column.rs similarity index 95% rename from src/commands/col_split.rs rename to src/commands/split_column.rs index f0badee0f..9a878d189 100644 --- a/src/commands/col_split.rs +++ b/src/commands/split_column.rs @@ -5,8 +5,7 @@ use log::debug; // TODO: "Amount remaining" wrapper -pub fn col_split(args: CommandArgs) -> Result { - //let splitter = args.args[0].as_string()?; +pub fn split_column(args: CommandArgs) -> Result { let input = args.input; let args = args.args; diff --git a/src/commands/row_split.rs b/src/commands/split_row.rs similarity index 78% rename from src/commands/row_split.rs rename to src/commands/split_row.rs index 06231c906..b443e39f8 100644 --- a/src/commands/row_split.rs +++ b/src/commands/split_row.rs @@ -5,8 +5,7 @@ use log::debug; // TODO: "Amount remaining" wrapper -pub fn row_split(args: CommandArgs) -> Result { - //let splitter = args.args[0].as_string()?; +pub fn split_row(args: CommandArgs) -> Result { let input = args.input; let args = args.args; @@ -26,8 +25,7 @@ pub fn row_split(args: CommandArgs) -> Result { result } _ => { - let mut result = VecDeque::new(); - //result.push_back(ReturnValue::Value(Value::Object(crate::object::Dictionary::default()))); + let result = VecDeque::new(); result } })