upstream_rs/application/cli/
labels.rs1use std::fmt;
2
3use crate::application::cli::arguments::{Commands, ConfigAction, PackageAction};
4
5impl fmt::Display for Commands {
6 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7 match self {
8 Commands::Install { .. } => write!(f, "install"),
9 Commands::Remove { .. } => write!(f, "remove"),
10 Commands::Upgrade { .. } => write!(f, "upgrade"),
11 Commands::List { .. } => write!(f, "list"),
12 Commands::Probe { .. } => write!(f, "probe"),
13 Commands::Config { action } => write!(f, "{action}"),
14 Commands::Package { action } => write!(f, "{action}"),
15 Commands::Init { .. } => write!(f, "init"),
16 Commands::Import { .. } => write!(f, "import"),
17 Commands::Export { .. } => write!(f, "export"),
18 Commands::Doctor { .. } => write!(f, "doctor"),
19 }
20 }
21}
22
23impl fmt::Display for ConfigAction {
24 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25 match self {
26 ConfigAction::Set { .. } => write!(f, "config set"),
27 ConfigAction::Get { .. } => write!(f, "config get"),
28 ConfigAction::List => write!(f, "config list"),
29 ConfigAction::Edit => write!(f, "config edit"),
30 ConfigAction::Reset => write!(f, "config reset"),
31 }
32 }
33}
34
35impl fmt::Display for PackageAction {
36 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37 match self {
38 PackageAction::Pin { .. } => write!(f, "package pin"),
39 PackageAction::Unpin { .. } => write!(f, "package unpin"),
40 PackageAction::GetKey { .. } => write!(f, "package get-key"),
41 PackageAction::SetKey { .. } => write!(f, "package set-key"),
42 PackageAction::Rename { .. } => write!(f, "package rename"),
43 PackageAction::Metadata { .. } => write!(f, "package metadata"),
44 }
45 }
46}