summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorArtyom Belousov <flygrounder@yandex.ru>2022-08-02 12:51:15 +0300
committerGitHub <noreply@github.com>2022-08-02 11:51:15 +0200
commitc8a5adb412e98b07017ffa0edea5554b0a23b840 (patch)
tree3b5f61fd8926446626b4b63f5aeb7d20fdb611bd /src/main.rs
parentb456b9c5191eca3844ab4a561b41a97396f7262f (diff)
feat: Add starship preset command (#4112)
* Add starship preset command * Use ValueEnum for preset command * Generate ValueEnum struct in build.rs * Use absolute paths and refactor codegen * Use dunce to canonicalize path * Use raw string literal in include_bytes! * Use .cloned() * Apply fixes * Fix path escaping * Removed error message if stdout is unavailable Co-authored-by: David Knaack <davidkna@users.noreply.github.com> Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index fba5a094f..0e4ba6538 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -63,6 +63,15 @@ enum Commands {
#[clap(flatten)]
properties: Properties,
},
+ /// Prints a preset config
+ Preset {
+ /// The name of preset to be printed
+ #[clap(required_unless_present("list"), value_enum)]
+ name: Option<print::Preset>,
+ /// List out all preset names
+ #[clap(short, long)]
+ list: bool,
+ },
/// Prints the computed starship configuration
PrintConfig {
/// Print the default instead of the computed config
@@ -182,6 +191,7 @@ fn main() {
print::module(&module_name, properties);
}
}
+ Commands::Preset { name, list } => print::preset_command(name, list),
Commands::Config { name, value } => {
if let Some(name) = name {
if let Some(value) = value {