forked from extern/nushell
b2c5af457e
This improves incremental build time when working on what was previously the root package. For example, previously all plugins would be rebuilt with a change to `src/commands/classified/external.rs`, but now only `nu-cli` will have to be rebuilt (and anything that depends on it).
19 lines
474 B
Rust
19 lines
474 B
Rust
use nu_parser::Number;
|
|
use nu_protocol::Primitive;
|
|
|
|
pub fn number(number: impl Into<Number>) -> Primitive {
|
|
let number = number.into();
|
|
|
|
match number {
|
|
Number::Int(int) => Primitive::Int(int),
|
|
Number::Decimal(decimal) => Primitive::Decimal(decimal),
|
|
}
|
|
}
|
|
|
|
pub fn style_primitive(primitive: &Primitive) -> &'static str {
|
|
match primitive {
|
|
Primitive::Int(_) | Primitive::Bytes(_) | Primitive::Decimal(_) => "r",
|
|
_ => "",
|
|
}
|
|
}
|