nushell/crates/nu-cli/src/commands/autoenv.rs
Sam Hedin 15a8e26664 Revert "OsString and paths"
This reverts commit e6eedf8824.
2020-06-21 21:39:43 +02:00

46 lines
1.3 KiB
Rust

use crate::commands::WholeStreamCommand;
use crate::prelude::*;
use nu_errors::ShellError;
use nu_protocol::{ReturnSuccess, UntaggedValue, Signature};
use serde::Deserialize;
use serde::Serialize;
pub struct Autoenv;
#[derive(Deserialize, Serialize)]
pub struct Allowed {
pub dirs: IndexMap<String, String>,
}
#[async_trait]
impl WholeStreamCommand for Autoenv {
fn name(&self) -> &str {
"autoenv"
}
fn usage(&self) -> &str {
// "Mark a .nu-env file in a directory as trusted. Needs to be re-run after each change to the file or its filepath."
"Manage directory specific environments"
}
fn signature(&self) -> Signature {
Signature::build("autoenv")
}
async fn run(
&self,
_args: CommandArgs,
registry: &CommandRegistry,
) -> Result<OutputStream, ShellError> {
let registry = registry.clone();
Ok(OutputStream::one(ReturnSuccess::value(
UntaggedValue::string(crate::commands::help::get_help(&Autoenv, &registry))
.into_value(Tag::unknown()),
)))
}
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Allow .nu-env file in current directory",
example: "autoenv trust",
result: None
}]
}
}