Skip to main content

upstream_rs/application/cli/
labels.rs

1use std::fmt;
2
3use crate::application::cli::arguments::{Commands, ConfigAction, HooksAction, 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::Build { .. } => write!(f, "build"),
10            Commands::Remove { .. } => write!(f, "remove"),
11            Commands::Rollback { .. } => write!(f, "rollback"),
12            Commands::Reinstall { .. } => write!(f, "reinstall"),
13            Commands::Upgrade { .. } => write!(f, "upgrade"),
14            Commands::List { .. } => write!(f, "list"),
15            Commands::Changelog { .. } => write!(f, "changelog"),
16            Commands::Probe { .. } => write!(f, "probe"),
17            Commands::Search { .. } => write!(f, "search"),
18            Commands::Find { .. } => write!(f, "find"),
19            Commands::Config { action } => write!(f, "{action}"),
20            Commands::Package { action } => write!(f, "{action}"),
21            Commands::Hooks { action } => write!(f, "{action}"),
22            Commands::Import { .. } => write!(f, "import"),
23            Commands::Export { .. } => write!(f, "export"),
24            Commands::Migrate => write!(f, "migrate"),
25            Commands::Doctor { .. } => write!(f, "doctor"),
26        }
27    }
28}
29
30impl fmt::Display for ConfigAction {
31    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32        match self {
33            ConfigAction::Set { .. } => write!(f, "config set"),
34            ConfigAction::Get { .. } => write!(f, "config get"),
35            ConfigAction::List => write!(f, "config list"),
36            ConfigAction::Edit => write!(f, "config edit"),
37            ConfigAction::Reset => write!(f, "config reset"),
38        }
39    }
40}
41
42impl fmt::Display for HooksAction {
43    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
44        match self {
45            HooksAction::Init => write!(f, "hooks init"),
46            HooksAction::Check => write!(f, "hooks check"),
47            HooksAction::Clean => write!(f, "hooks clean"),
48            HooksAction::Purge => write!(f, "hooks purge"),
49        }
50    }
51}
52
53impl fmt::Display for PackageAction {
54    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
55        match self {
56            PackageAction::Pin { .. } => write!(f, "package pin"),
57            PackageAction::Unpin { .. } => write!(f, "package unpin"),
58            PackageAction::Rename { .. } => write!(f, "package rename"),
59        }
60    }
61}