2020-06-25 07:51:09 +02:00
|
|
|
use crate::prelude::*;
|
2021-01-10 03:50:49 +01:00
|
|
|
use nu_engine::WholeStreamCommand;
|
2020-06-25 07:51:09 +02:00
|
|
|
use nu_errors::ShellError;
|
|
|
|
use nu_protocol::{ReturnSuccess, 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 {
|
2021-03-08 00:57:58 +01:00
|
|
|
"Generate random values."
|
2020-06-25 07:51:09 +02:00
|
|
|
}
|
|
|
|
|
2021-04-12 04:35:01 +02:00
|
|
|
fn run_with_actions(&self, args: CommandArgs) -> Result<ActionStream, ShellError> {
|
|
|
|
Ok(ActionStream::one(Ok(ReturnSuccess::Value(
|
2021-05-03 01:45:55 +02:00
|
|
|
UntaggedValue::string(get_full_help(&Command, args.scope())).into_value(Tag::unknown()),
|
2020-06-25 07:51:09 +02:00
|
|
|
))))
|
|
|
|
}
|
|
|
|
}
|