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, check_example_input_and_output_types_match_command_signature,
}; };
use crate::MathEuler;
use crate::MathPi; use crate::MathPi;
use nu_protocol::{ use nu_protocol::{
engine::{Command, EngineState, StateWorkingSet}, 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_command::Enumerate));
working_set.add_decl(Box::new(nu_cmd_lang::If)); working_set.add_decl(Box::new(nu_cmd_lang::If));
// math commands // math commands
working_set.add_decl(Box::new(MathEuler));
working_set.add_decl(Box::new(MathPi)); working_set.add_decl(Box::new(MathPi));
working_set.add_decl(Box::new(nu_command::MathRound)); working_set.add_decl(Box::new(nu_command::MathRound));

View File

@ -6,6 +6,9 @@ mod tan;
mod tanh; mod tanh;
mod egamma; mod egamma;
mod euler;
mod exp;
mod ln;
mod phi; mod phi;
mod pi; mod pi;
mod tau; mod tau;
@ -25,6 +28,9 @@ pub use tan::SubCommand as MathTan;
pub use tanh::SubCommand as MathTanH; pub use tanh::SubCommand as MathTanH;
pub use egamma::SubCommand as MathEulerGamma; 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 phi::SubCommand as MathPhi;
pub use pi::SubCommand as MathPi; pub use pi::SubCommand as MathPi;
pub use tau::SubCommand as MathTau; pub use tau::SubCommand as MathTau;

View File

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

View File

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

View File

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

View File

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