use crate::cmd;
use crate::options;
use crate::workspaces::Workspace;
use structopt::StructOpt;
use structopt::clap::{AppSettings, Shell};
use sn0int_common::ModuleID;
#[derive(Debug, StructOpt)]
#[structopt(global_settings = &[AppSettings::ColoredHelp])]
pub struct Args {
#[structopt(short="w", long="workspace", env="SN0INT_WORKSPACE")]
pub workspace: Option<Workspace>,
#[structopt(subcommand)]
pub subcommand: Option<SubCommand>,
}
impl Args {
pub fn is_sandbox(&self) -> bool {
matches!(self.subcommand, Some(SubCommand::Sandbox(_)))
}
}
#[derive(Debug, StructOpt)]
pub enum SubCommand {
#[structopt(name="run")]
Run(Run),
#[structopt(name="sandbox")]
Sandbox(Sandbox),
#[structopt(name="login")]
Login(Login),
#[structopt(name="new")]
New(New),
#[structopt(name="publish")]
Publish(Publish),
#[structopt(name="install")]
Install(Install),
#[structopt(name="search")]
Search(Search),
#[structopt(name="pkg")]
Pkg(cmd::pkg_cmd::Args),
#[structopt(name="add")]
Add(cmd::add_cmd::Args),
#[structopt(name="select")]
Select(cmd::select_cmd::Args),
#[structopt(name="delete")]
Delete(cmd::delete_cmd::Args),
#[structopt(name="activity")]
Activity(cmd::activity_cmd::Args),
#[structopt(name="scope")]
Scope(cmd::scope_cmd::Args),
#[structopt(name="noscope")]
Noscope(cmd::noscope_cmd::Args),
Autoscope(cmd::autoscope_cmd::Args),
Autonoscope(cmd::autonoscope_cmd::Args),
Rescope(cmd::rescope_cmd::Args),
#[structopt(name="workspace")]
Workspace(cmd::workspace_cmd::Args),
#[structopt(name="cal")]
Cal(cmd::cal_cmd::Args),
#[structopt(name="notify")]
Notify(cmd::notify_cmd::Args),
#[structopt(name="fsck")]
Fsck(cmd::fsck_cmd::Args),
#[structopt(name="export")]
Export(cmd::export_cmd::Args),
#[structopt(name="stats")]
Stats(cmd::stats_cmd::Args),
#[structopt(name="repl")]
Repl,
#[structopt(name="paths")]
Paths,
#[structopt(name="completions")]
Completions(Completions),
}
#[derive(Debug, StructOpt)]
pub struct Run {
#[structopt(flatten)]
pub run: cmd::run_cmd::Args,
#[structopt(short="f", long="file")]
pub file: bool,
#[structopt(long="stdin")]
pub stdin: bool,
#[structopt(long="grant")]
pub grants: Vec<String>,
#[structopt(long="grant-full-keyring")]
pub grant_full_keyring: bool,
#[structopt(long="deny-keyring")]
pub deny_keyring: bool,
#[structopt(short="x", long="exit-on-error")]
pub exit_on_error: bool,
#[structopt(short="o", long="option")]
pub options: Vec<options::Opt>,
#[structopt(short="t", long="target")]
pub target: Option<String>,
#[structopt(long="dump-sandbox-init-msg")]
pub dump_sandbox_init_msg: bool,
}
#[derive(Debug, StructOpt)]
pub struct Sandbox {
_label: String,
}
#[derive(Debug, StructOpt)]
pub struct Login {
}
#[derive(Debug, StructOpt)]
pub struct New {
pub path: String,
}
#[derive(Debug, StructOpt)]
pub struct Publish {
#[structopt(required = true)]
pub paths: Vec<String>,
}
#[derive(Debug, StructOpt)]
pub struct Install {
pub module: ModuleID,
pub version: Option<String>,
#[structopt(short="f", long="force")]
pub force: bool,
}
#[derive(Debug, StructOpt)]
pub struct Search {
#[structopt(long="new")]
pub new: bool,
pub query: String,
}
#[derive(Debug, StructOpt)]
pub struct Completions {
#[structopt(possible_values=&Shell::variants())]
pub shell: Shell,
}