mirror of
https://github.com/nushell/nushell.git
synced 2024-12-03 05:44:09 +01:00
7a583083b8
* 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
28 lines
605 B
Rust
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(),
|
|
))))
|
|
}
|
|
}
|