Move the history and tutor commands out of core_commands (#5813)

* move history and tutor commands from core to misc

* add in the Misc Category for the history and tutor commands
This commit is contained in:
Michael Angerman 2022-06-16 09:58:38 -07:00 committed by GitHub
parent 28c07a5072
commit bc48b4553c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 8 deletions

View File

@ -16,7 +16,6 @@ mod extern_;
mod for_; mod for_;
mod help; mod help;
mod hide; mod hide;
mod history;
mod if_; mod if_;
mod ignore; mod ignore;
mod let_; mod let_;
@ -24,7 +23,6 @@ mod metadata;
mod module; mod module;
pub(crate) mod overlay; pub(crate) mod overlay;
mod source; mod source;
mod tutor;
mod use_; mod use_;
mod version; mod version;
@ -46,7 +44,6 @@ pub use extern_::Extern;
pub use for_::For; pub use for_::For;
pub use help::Help; pub use help::Help;
pub use hide::Hide; pub use hide::Hide;
pub use history::History;
pub use if_::If; pub use if_::If;
pub use ignore::Ignore; pub use ignore::Ignore;
pub use let_::Let; pub use let_::Let;
@ -54,7 +51,6 @@ pub use metadata::Metadata;
pub use module::Module; pub use module::Module;
pub use overlay::*; pub use overlay::*;
pub use source::Source; pub use source::Source;
pub use tutor::Tutor;
pub use use_::Use; pub use use_::Use;
pub use version::Version; pub use version::Version;
#[cfg(feature = "plugin")] #[cfg(feature = "plugin")]

View File

@ -48,7 +48,6 @@ pub fn create_default_context(cwd: impl AsRef<Path>) -> EngineState {
For, For,
Help, Help,
Hide, Hide,
History,
If, If,
Ignore, Ignore,
Overlay, Overlay,
@ -60,7 +59,6 @@ pub fn create_default_context(cwd: impl AsRef<Path>) -> EngineState {
Metadata, Metadata,
Module, Module,
Source, Source,
Tutor,
Use, Use,
Version, Version,
}; };
@ -134,6 +132,12 @@ pub fn create_default_context(cwd: impl AsRef<Path>) -> EngineState {
Zip, Zip,
}; };
// Misc
bind_command! {
History,
Tutor,
};
// Path // Path
bind_command! { bind_command! {
Path, Path,

View File

@ -13,6 +13,7 @@ mod formats;
mod generators; mod generators;
mod hash; mod hash;
mod math; mod math;
mod misc;
mod network; mod network;
mod path; mod path;
mod platform; mod platform;
@ -38,6 +39,7 @@ pub use formats::*;
pub use generators::*; pub use generators::*;
pub use hash::*; pub use hash::*;
pub use math::*; pub use math::*;
pub use misc::*;
pub use network::*; pub use network::*;
pub use path::*; pub use path::*;
pub use platform::*; pub use platform::*;

View File

@ -24,7 +24,7 @@ impl Command for History {
fn signature(&self) -> nu_protocol::Signature { fn signature(&self) -> nu_protocol::Signature {
Signature::build("history") Signature::build("history")
.switch("clear", "Clears out the history entries", Some('c')) .switch("clear", "Clears out the history entries", Some('c'))
.category(Category::Core) .category(Category::Misc)
} }
fn run( fn run(

View File

@ -0,0 +1,5 @@
mod history;
mod tutor;
pub use history::History;
pub use tutor::Tutor;

View File

@ -28,7 +28,7 @@ impl Command for Tutor {
"Search tutorial for a phrase", "Search tutorial for a phrase",
Some('f'), Some('f'),
) )
.category(Category::Core) .category(Category::Misc)
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -49,6 +49,7 @@ pub enum Category {
Filters, Filters,
Formats, Formats,
Math, Math,
Misc,
Network, Network,
Random, Random,
Platform, Platform,
@ -76,6 +77,7 @@ impl std::fmt::Display for Category {
Category::Filters => "filters", Category::Filters => "filters",
Category::Formats => "formats", Category::Formats => "formats",
Category::Math => "math", Category::Math => "math",
Category::Misc => "misc",
Category::Network => "network", Category::Network => "network",
Category::Random => "random", Category::Random => "random",
Category::Platform => "platform", Category::Platform => "platform",