cratification: part III of the math commands to nu-cmd-extra (#9674)

The following math commands are being moved to nu-cmd-extra

* e (euler)
* exp
* ln

This should conclude moving the extra math commands as discussed in
yesterday's
core team meeting...

The remaining math commands will stay in nu-command (for now)....
This commit is contained in:
Michael Angerman 2023-07-13 09:11:26 -07:00 committed by GitHub
parent 9a6a3a731e
commit 3c583c9a20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 17 additions and 14 deletions

View file

@ -15,6 +15,7 @@ mod test_examples {
check_example_input_and_output_types_match_command_signature,
};
use crate::MathEuler;
use crate::MathPi;
use nu_protocol::{
engine::{Command, EngineState, StateWorkingSet},
@ -65,6 +66,7 @@ mod test_examples {
working_set.add_decl(Box::new(nu_command::Enumerate));
working_set.add_decl(Box::new(nu_cmd_lang::If));
// math commands
working_set.add_decl(Box::new(MathEuler));
working_set.add_decl(Box::new(MathPi));
working_set.add_decl(Box::new(nu_command::MathRound));

View file

@ -6,6 +6,9 @@ mod tan;
mod tanh;
mod egamma;
mod euler;
mod exp;
mod ln;
mod phi;
mod pi;
mod tau;
@ -25,6 +28,9 @@ pub use tan::SubCommand as MathTan;
pub use tanh::SubCommand as MathTanH;
pub use egamma::SubCommand as MathEulerGamma;
pub use euler::SubCommand as MathEuler;
pub use exp::SubCommand as MathExp;
pub use ln::SubCommand as MathLn;
pub use phi::SubCommand as MathPhi;
pub use pi::SubCommand as MathPi;
pub use tau::SubCommand as MathTau;

View file

@ -38,7 +38,10 @@ pub use math::MathSinH;
pub use math::MathTan;
pub use math::MathTanH;
pub use math::MathEuler;
pub use math::MathEulerGamma;
pub use math::MathExp;
pub use math::MathLn;
pub use math::MathPhi;
pub use math::MathPi;
pub use math::MathTau;
@ -133,7 +136,10 @@ pub fn add_extra_command_context(mut engine_state: EngineState) -> EngineState {
MathCosH,
MathTanH,
MathPi,
MathTau
MathTau,
MathEuler,
MathExp,
MathLn
};
working_set.render()

View file

@ -327,9 +327,6 @@ pub fn add_shell_command_context(mut engine_state: EngineState) -> EngineState {
MathStddev,
MathSum,
MathVariance,
MathEuler,
MathExp,
MathLn,
MathLog,
};

View file

@ -9,8 +9,8 @@ pub fn test_examples(cmd: impl Command + 'static) {
#[cfg(test)]
mod test_examples {
use super::super::{
Ansi, Date, Enumerate, Flatten, From, Get, Into, IntoString, Math, MathEuler, MathRound,
ParEach, Path, PathParse, Random, Sort, SortBy, Split, SplitColumn, SplitRow, Str, StrJoin,
Ansi, Date, Enumerate, Flatten, From, Get, Into, IntoString, Math, MathRound, ParEach,
Path, PathParse, Random, Sort, SortBy, Split, SplitColumn, SplitRow, Str, StrJoin,
StrLength, StrReplace, Update, Url, Values, Wrap,
};
use crate::{Each, To};
@ -79,7 +79,6 @@ mod test_examples {
working_set.add_decl(Box::new(IntoString));
working_set.add_decl(Box::new(Let));
working_set.add_decl(Box::new(Math));
working_set.add_decl(Box::new(MathEuler));
working_set.add_decl(Box::new(MathRound));
working_set.add_decl(Box::new(Mut));
working_set.add_decl(Box::new(Path));

View file

@ -1,10 +1,7 @@
mod abs;
mod avg;
mod ceil;
mod euler;
mod exp;
mod floor;
mod ln;
mod log;
pub mod math_;
mod max;
@ -36,8 +33,4 @@ pub use stddev::SubCommand as MathStddev;
pub use sum::SubCommand as MathSum;
pub use variance::SubCommand as MathVariance;
pub use euler::SubCommand as MathEuler;
pub use self::log::SubCommand as MathLog;
pub use exp::SubCommand as MathExp;
pub use ln::SubCommand as MathLn;