use std::convert::Infallible;
use std::fmt;
use std::path::PathBuf;
use std::str::FromStr;
use clap::Subcommand;
#[derive(Clone)]
pub(crate) struct ArgText(String);
impl ArgText {
pub(crate) fn text(&self) -> &str {
&self.0
}
}
impl FromStr for ArgText {
type Err = Infallible;
fn from_str(raw: &str) -> Result<Self, Self::Err> {
Ok(Self(raw.to_owned()))
}
}
impl fmt::Debug for ArgText {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("ArgText(<redacted>)")
}
}
#[derive(Debug, Subcommand)]
pub(crate) enum SecretsAction {
Set {
key: ArgText,
group: Option<ArgText>,
#[arg(long, value_name = "-")]
value: Option<ArgText>,
#[arg(hide = true)]
extra: Vec<ArgText>,
},
List,
Remove {
key: ArgText,
group: Option<ArgText>,
},
Import {
path: PathBuf,
group: Option<ArgText>,
},
Copy {
#[arg(long)]
from: String,
#[arg(long)]
to: String,
keys: Vec<ArgText>,
},
Doctor,
}