hackshell 0.7.1

Lightweight, customizable shell framework
Documentation
use crate::{Command, CommandResult, Hackshell};

pub struct Unset {}

impl Command for Unset {
    fn commands(&self) -> &'static [&'static str] {
        &["unset"]
    }

    fn help(&self) -> &'static str {
        "Unsets an environment variable"
    }

    fn category(&self) -> &'static str {
        "Shell"
    }

    fn run(&self, s: &Hackshell, cmd: &[&str]) -> CommandResult {
        if cmd.len() != 2 {
            return Err("Syntax: unset <name>".into());
        }

        s.unset_var(&cmd[1]);

        Ok(None)
    }
}