forked from extern/nushell
Move format duration
/filesize
back into core (#9978)
# Description Those two commands are very complementary to `into duration` and `into filesize` when you want to coerce a particular string output. This keeps the old `format` command with its separate formatting syntax still in `nu-cmd-extra`. # User-Facing Changes `format filesize` is back accessible with the default build. The new `format duration` command is also available to everybody # Tests + Formatting
This commit is contained in:
parent
23170ff368
commit
a0cecf7658
@ -85,8 +85,6 @@ pub fn add_extra_command_context(mut engine_state: EngineState) -> EngineState {
|
||||
|
||||
bind_command!(
|
||||
strings::format::Format,
|
||||
strings::format::FileSize,
|
||||
strings::format::FormatDuration,
|
||||
strings::encode_decode::EncodeHex,
|
||||
strings::encode_decode::DecodeHex,
|
||||
strings::str_::case::Str,
|
||||
|
@ -1,7 +1,3 @@
|
||||
mod command;
|
||||
mod duration;
|
||||
mod filesize;
|
||||
|
||||
pub(crate) use command::Format;
|
||||
pub(crate) use duration::FormatDuration;
|
||||
pub(crate) use filesize::FileSize;
|
||||
|
@ -192,7 +192,9 @@ pub fn add_shell_command_context(mut engine_state: EngineState) -> EngineState {
|
||||
StrSubstring,
|
||||
StrTrim,
|
||||
StrUpcase,
|
||||
FormatDate
|
||||
FormatDate,
|
||||
FormatDuration,
|
||||
FormatFilesize,
|
||||
};
|
||||
|
||||
// FileSystem
|
||||
|
@ -19,9 +19,9 @@ impl CmdArgument for Arguments {
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct FileSize;
|
||||
pub struct FormatFilesize;
|
||||
|
||||
impl Command for FileSize {
|
||||
impl Command for FormatFilesize {
|
||||
fn name(&self) -> &str {
|
||||
"format filesize"
|
||||
}
|
||||
@ -129,6 +129,6 @@ mod tests {
|
||||
fn test_examples() {
|
||||
use crate::test_examples;
|
||||
|
||||
test_examples(FileSize)
|
||||
test_examples(FormatFilesize)
|
||||
}
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
mod date;
|
||||
mod duration;
|
||||
mod filesize;
|
||||
|
||||
pub use self::filesize::FormatFilesize;
|
||||
pub use date::FormatDate;
|
||||
pub use duration::FormatDuration;
|
||||
|
@ -10,7 +10,7 @@ mod str_;
|
||||
pub use char_::Char;
|
||||
pub use detect_columns::*;
|
||||
pub use encode_decode::*;
|
||||
pub use format::FormatDate;
|
||||
pub use format::*;
|
||||
pub use parse::*;
|
||||
pub use size::Size;
|
||||
pub use split::*;
|
||||
|
Loading…
Reference in New Issue
Block a user