cratification: start moving over the math commands to nu-cmd-extra (#9647)

* arccos
* arccosh
* arcsin
* arcsinh
* arctan
* arctanh

The above commands are being ported over to nu-cmd-extra

I initially moved all of the math commands over but there are some
issues with the tests...

So we will move them over slowly --- and actually I kind of like this
idea better...

Because some of the math commands we might want to leave in the core
nushell...

Stay tuned...

For more details 👍 
Read this document:

https://github.com/stormasm/nutmp/blob/main/commands/math.md
This commit is contained in:
Michael Angerman 2023-07-10 12:08:45 -07:00 committed by GitHub
parent cf36f052c4
commit e10d84b72f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 31 additions and 19 deletions

View File

@ -0,0 +1,13 @@
mod arccos;
mod arccosh;
mod arcsin;
mod arcsinh;
mod arctan;
mod arctanh;
pub use arccos::SubCommand as MathArcCos;
pub use arccosh::SubCommand as MathArcCosH;
pub use arcsin::SubCommand as MathArcSin;
pub use arcsinh::SubCommand as MathArcSinH;
pub use arctan::SubCommand as MathArcTan;
pub use arctanh::SubCommand as MathArcTanH;

View File

@ -3,6 +3,7 @@ mod bytes;
mod conversions; mod conversions;
mod filters; mod filters;
mod formats; mod formats;
mod math;
mod platform; mod platform;
mod strings; mod strings;
@ -30,6 +31,13 @@ pub use bits::BitsShl;
pub use bits::BitsShr; pub use bits::BitsShr;
pub use bits::BitsXor; pub use bits::BitsXor;
pub use math::MathArcCos;
pub use math::MathArcCosH;
pub use math::MathArcSin;
pub use math::MathArcSinH;
pub use math::MathArcTan;
pub use math::MathArcTanH;
use nu_protocol::engine::{EngineState, StateWorkingSet}; use nu_protocol::engine::{EngineState, StateWorkingSet};
pub fn add_extra_command_context(mut engine_state: EngineState) -> EngineState { pub fn add_extra_command_context(mut engine_state: EngineState) -> EngineState {
@ -98,6 +106,16 @@ pub fn add_extra_command_context(mut engine_state: EngineState) -> EngineState {
BytesBuild BytesBuild
} }
// Math
bind_command! {
MathArcSin,
MathArcCos,
MathArcTan,
MathArcSinH,
MathArcCosH,
MathArcTanH
};
working_set.render() working_set.render()
}; };

View File

@ -333,12 +333,6 @@ pub fn add_shell_command_context(mut engine_state: EngineState) -> EngineState {
MathSinH, MathSinH,
MathCosH, MathCosH,
MathTanH, MathTanH,
MathArcSin,
MathArcCos,
MathArcTan,
MathArcSinH,
MathArcCosH,
MathArcTanH,
MathPi, MathPi,
MathTau, MathTau,
MathEuler, MathEuler,

View File

@ -1,10 +1,4 @@
mod abs; mod abs;
mod arccos;
mod arccosh;
mod arcsin;
mod arcsinh;
mod arctan;
mod arctanh;
mod avg; mod avg;
mod ceil; mod ceil;
mod cos; mod cos;
@ -59,13 +53,6 @@ pub use sinh::SubCommand as MathSinH;
pub use tan::SubCommand as MathTan; pub use tan::SubCommand as MathTan;
pub use tanh::SubCommand as MathTanH; pub use tanh::SubCommand as MathTanH;
pub use arccos::SubCommand as MathArcCos;
pub use arccosh::SubCommand as MathArcCosH;
pub use arcsin::SubCommand as MathArcSin;
pub use arcsinh::SubCommand as MathArcSinH;
pub use arctan::SubCommand as MathArcTan;
pub use arctanh::SubCommand as MathArcTanH;
pub use egamma::SubCommand as MathEulerGamma; pub use egamma::SubCommand as MathEulerGamma;
pub use euler::SubCommand as MathEuler; pub use euler::SubCommand as MathEuler;
pub use phi::SubCommand as MathPhi; pub use phi::SubCommand as MathPhi;