nushell/crates/nu-command/src/commands/random/command.rs
Jakub Žádník 7a583083b8
Convert the rest of "random" subcommands to engine-p (#3399)
* Convert "random bool" to engine-p

Also implements FromValue for Tagged<BigDecimal> and Tagged<f64>.

* Convert "random dice" to engine-p

* Convert "random uuid" to engine-p

* Covert "random chars" to engine-p

* Convert "random" command to engine-p
2021-05-10 19:07:57 +12:00

28 lines
605 B
Rust

use crate::prelude::*;
use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{Signature, UntaggedValue};
pub struct Command;
impl WholeStreamCommand for Command {
fn name(&self) -> &str {
"random"
}
fn signature(&self) -> Signature {
Signature::build("random")
}
fn usage(&self) -> &str {
"Generate random values."
}
fn run(&self, args: CommandArgs) -> Result<OutputStream, ShellError> {
Ok(OutputStream::one(UntaggedValue::string(get_full_help(
&Command,
args.scope(),
))))
}
}