From 50102bf69ba7a14a02d892e28c1d78d26d66354f Mon Sep 17 00:00:00 2001 From: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com> Date: Fri, 15 Dec 2023 13:17:12 +0100 Subject: [PATCH] Move history into their own module (#11308) # Description Since there are plans to add more history commands, it seems sensible to put them into their own module and category https://github.com/nushell/nushell/pull/10440#issuecomment-1731408785 # User-Facing Changes The history commands are in the category "History" rather than "Misc" --- .../nu-cli/src/commands/{history.rs => history/history_.rs} | 2 +- crates/nu-cli/src/commands/{ => history}/history_session.rs | 2 +- crates/nu-cli/src/commands/history/mod.rs | 5 +++++ crates/nu-cli/src/commands/mod.rs | 4 +--- crates/nu-protocol/src/signature.rs | 2 ++ 5 files changed, 10 insertions(+), 5 deletions(-) rename crates/nu-cli/src/commands/{history.rs => history/history_.rs} (99%) rename crates/nu-cli/src/commands/{ => history}/history_session.rs (96%) create mode 100644 crates/nu-cli/src/commands/history/mod.rs diff --git a/crates/nu-cli/src/commands/history.rs b/crates/nu-cli/src/commands/history/history_.rs similarity index 99% rename from crates/nu-cli/src/commands/history.rs rename to crates/nu-cli/src/commands/history/history_.rs index 0031851883..c4d15a9548 100644 --- a/crates/nu-cli/src/commands/history.rs +++ b/crates/nu-cli/src/commands/history/history_.rs @@ -34,7 +34,7 @@ impl Command for History { "Show long listing of entries for sqlite history", Some('l'), ) - .category(Category::Misc) + .category(Category::History) } fn run( diff --git a/crates/nu-cli/src/commands/history_session.rs b/crates/nu-cli/src/commands/history/history_session.rs similarity index 96% rename from crates/nu-cli/src/commands/history_session.rs rename to crates/nu-cli/src/commands/history/history_session.rs index 5d08b4e7e2..9f423f6417 100644 --- a/crates/nu-cli/src/commands/history_session.rs +++ b/crates/nu-cli/src/commands/history/history_session.rs @@ -18,7 +18,7 @@ impl Command for HistorySession { fn signature(&self) -> nu_protocol::Signature { Signature::build("history session") - .category(Category::Misc) + .category(Category::History) .input_output_types(vec![(Type::Nothing, Type::Int)]) } diff --git a/crates/nu-cli/src/commands/history/mod.rs b/crates/nu-cli/src/commands/history/mod.rs new file mode 100644 index 0000000000..be7d1fc11f --- /dev/null +++ b/crates/nu-cli/src/commands/history/mod.rs @@ -0,0 +1,5 @@ +mod history_; +mod history_session; + +pub use history_::History; +pub use history_session::HistorySession; diff --git a/crates/nu-cli/src/commands/mod.rs b/crates/nu-cli/src/commands/mod.rs index 00580ebafd..6089d79293 100644 --- a/crates/nu-cli/src/commands/mod.rs +++ b/crates/nu-cli/src/commands/mod.rs @@ -1,15 +1,13 @@ mod commandline; mod default_context; mod history; -mod history_session; mod keybindings; mod keybindings_default; mod keybindings_list; mod keybindings_listen; pub use commandline::Commandline; -pub use history::History; -pub use history_session::HistorySession; +pub use history::{History, HistorySession}; pub use keybindings::Keybindings; pub use keybindings_default::KeybindingsDefault; pub use keybindings_list::KeybindingsList; diff --git a/crates/nu-protocol/src/signature.rs b/crates/nu-protocol/src/signature.rs index e17f47c359..7e5b64b78f 100644 --- a/crates/nu-protocol/src/signature.rs +++ b/crates/nu-protocol/src/signature.rs @@ -58,6 +58,7 @@ pub enum Category { Formats, Generators, Hash, + History, Math, Misc, Network, @@ -91,6 +92,7 @@ impl std::fmt::Display for Category { Category::Formats => "formats", Category::Generators => "generators", Category::Hash => "hash", + Category::History => "history", Category::Math => "math", Category::Misc => "misc", Category::Network => "network",