mirror of
https://github.com/nushell/nushell
synced 2024-11-15 17:27:58 +00:00
relocate debug commands (#8071)
# Description Now that we've landed the debug commands we were working on, let's relocate them to an easier place to find all of them. That's what this PR does. The only actual code change was changing the `timeit` command to a `Category::Debug` command. The rest is just moving things around and hooking them up. # User-Facing Changes # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date.
This commit is contained in:
parent
8136170431
commit
4c787af26d
18 changed files with 40 additions and 34 deletions
|
@ -75,7 +75,6 @@ regex = "1.7.1"
|
|||
reqwest = { version = "0.11", features = ["blocking", "json"] }
|
||||
roxmltree = "0.18.0"
|
||||
rust-embed = "6.3.0"
|
||||
rust-ini = "0.18.0"
|
||||
same-file = "1.0.6"
|
||||
serde = { version = "1.0.123", features = ["derive"] }
|
||||
serde_urlencoded = "0.7.0"
|
||||
|
|
|
@ -4,7 +4,6 @@ mod break_;
|
|||
mod commandline;
|
||||
mod const_;
|
||||
mod continue_;
|
||||
mod debug;
|
||||
mod def;
|
||||
mod def_env;
|
||||
mod describe;
|
||||
|
@ -30,7 +29,6 @@ mod if_;
|
|||
mod ignore;
|
||||
mod let_;
|
||||
mod loop_;
|
||||
mod metadata;
|
||||
mod module;
|
||||
mod mut_;
|
||||
pub(crate) mod overlay;
|
||||
|
@ -46,7 +44,6 @@ pub use break_::Break;
|
|||
pub use commandline::Commandline;
|
||||
pub use const_::Const;
|
||||
pub use continue_::Continue;
|
||||
pub use debug::Debug;
|
||||
pub use def::Def;
|
||||
pub use def_env::DefEnv;
|
||||
pub use describe::Describe;
|
||||
|
@ -72,7 +69,6 @@ pub use if_::If;
|
|||
pub use ignore::Ignore;
|
||||
pub use let_::Let;
|
||||
pub use loop_::Loop;
|
||||
pub use metadata::Metadata;
|
||||
pub use module::Module;
|
||||
pub use mut_::Mut;
|
||||
pub use overlay::*;
|
||||
|
|
|
@ -118,7 +118,7 @@ mod truncate_table {
|
|||
}
|
||||
|
||||
mod util {
|
||||
use crate::system::explain::debug_string_without_formatting;
|
||||
use crate::debug::explain::debug_string_without_formatting;
|
||||
use nu_engine::get_columns;
|
||||
use nu_protocol::{ast::PathMember, Span, Value};
|
||||
|
23
crates/nu-command/src/debug/mod.rs
Normal file
23
crates/nu-command/src/debug/mod.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
mod debug_;
|
||||
mod explain;
|
||||
mod inspect;
|
||||
mod inspect_table;
|
||||
mod metadata;
|
||||
mod profile;
|
||||
mod timeit;
|
||||
mod view;
|
||||
mod view_files;
|
||||
mod view_source;
|
||||
mod view_span;
|
||||
|
||||
pub use debug_::Debug;
|
||||
pub use explain::Explain;
|
||||
pub use inspect::Inspect;
|
||||
pub use inspect_table::build_table;
|
||||
pub use metadata::Metadata;
|
||||
pub use profile::Profile;
|
||||
pub use timeit::TimeIt;
|
||||
pub use view::View;
|
||||
pub use view_files::ViewFiles;
|
||||
pub use view_source::ViewSource;
|
||||
pub use view_span::ViewSpan;
|
|
@ -31,7 +31,7 @@ impl Command for TimeIt {
|
|||
(Type::Nothing, Type::Duration),
|
||||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.category(Category::System)
|
||||
.category(Category::Debug)
|
||||
}
|
||||
|
||||
fn search_terms(&self) -> Vec<&str> {
|
|
@ -34,7 +34,6 @@ pub fn create_default_context() -> EngineState {
|
|||
Commandline,
|
||||
Const,
|
||||
Continue,
|
||||
Debug,
|
||||
Def,
|
||||
DefEnv,
|
||||
Describe,
|
||||
|
@ -65,7 +64,6 @@ pub fn create_default_context() -> EngineState {
|
|||
OverlayHide,
|
||||
Let,
|
||||
Loop,
|
||||
Metadata,
|
||||
Module,
|
||||
Mut,
|
||||
Return,
|
||||
|
@ -173,12 +171,23 @@ pub fn create_default_context() -> EngineState {
|
|||
// System
|
||||
bind_command! {
|
||||
Complete,
|
||||
Explain,
|
||||
External,
|
||||
Inspect,
|
||||
NuCheck,
|
||||
Sys,
|
||||
};
|
||||
|
||||
// Debug
|
||||
bind_command! {
|
||||
Debug,
|
||||
Explain,
|
||||
Inspect,
|
||||
Metadata,
|
||||
Profile,
|
||||
TimeIt,
|
||||
View,
|
||||
ViewFiles,
|
||||
ViewSource,
|
||||
ViewSpan,
|
||||
};
|
||||
|
||||
#[cfg(unix)]
|
||||
|
@ -471,11 +480,6 @@ pub fn create_default_context() -> EngineState {
|
|||
// Experimental
|
||||
bind_command! {
|
||||
IsAdmin,
|
||||
Profile,
|
||||
View,
|
||||
ViewFiles,
|
||||
ViewSource,
|
||||
ViewSpan,
|
||||
};
|
||||
|
||||
// Deprecated
|
||||
|
|
|
@ -1,13 +1,3 @@
|
|||
mod is_admin;
|
||||
mod profile;
|
||||
mod view;
|
||||
mod view_files;
|
||||
mod view_source;
|
||||
mod view_span;
|
||||
|
||||
pub use is_admin::IsAdmin;
|
||||
pub use profile::Profile;
|
||||
pub use view::View;
|
||||
pub use view_files::ViewFiles;
|
||||
pub use view_source::ViewSource;
|
||||
pub use view_span::ViewSpan;
|
||||
|
|
|
@ -4,6 +4,7 @@ mod charting;
|
|||
mod conversions;
|
||||
mod core_commands;
|
||||
mod date;
|
||||
mod debug;
|
||||
mod default_context;
|
||||
mod deprecated;
|
||||
mod env;
|
||||
|
@ -34,6 +35,7 @@ pub use charting::*;
|
|||
pub use conversions::*;
|
||||
pub use core_commands::*;
|
||||
pub use date::*;
|
||||
pub use debug::*;
|
||||
pub use default_context::*;
|
||||
pub use deprecated::*;
|
||||
pub use env::*;
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
mod complete;
|
||||
#[cfg(unix)]
|
||||
mod exec;
|
||||
mod explain;
|
||||
mod inspect;
|
||||
mod inspect_table;
|
||||
mod nu_check;
|
||||
#[cfg(any(
|
||||
target_os = "android",
|
||||
|
@ -16,15 +13,11 @@ mod ps;
|
|||
mod registry_query;
|
||||
mod run_external;
|
||||
mod sys;
|
||||
mod timeit;
|
||||
mod which_;
|
||||
|
||||
pub use complete::Complete;
|
||||
#[cfg(unix)]
|
||||
pub use exec::Exec;
|
||||
pub use explain::Explain;
|
||||
pub use inspect::Inspect;
|
||||
pub use inspect_table::build_table;
|
||||
pub use nu_check::NuCheck;
|
||||
#[cfg(any(
|
||||
target_os = "android",
|
||||
|
@ -37,5 +30,4 @@ pub use ps::Ps;
|
|||
pub use registry_query::RegistryQuery;
|
||||
pub use run_external::{External, ExternalCommand};
|
||||
pub use sys::Sys;
|
||||
pub use timeit::TimeIt;
|
||||
pub use which_::Which;
|
||||
|
|
Loading…
Reference in a new issue