summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2022-08-07 08:48:38 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2022-08-08 23:10:36 +0200
commita3a177159085b7a26d79fb39e2ddda653aac766a (patch)
tree6dbf1fab365b21fc3c9cf96260de0505d36610ef /src
parent3f394af544db5075a8042cf6a45ba4ead85b1601 (diff)
downloadvtcol-a3a177159085b7a26d79fb39e2ddda653aac766a.tar.gz
bin: prepare for scheme editor
Optionally build against slint (sixtyfps) to provide an “edit” subcommand.
Diffstat (limited to 'src')
-rw-r--r--src/vtcol.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/vtcol.rs b/src/vtcol.rs
index 8b86e07..122b471 100644
--- a/src/vtcol.rs
+++ b/src/vtcol.rs
@@ -463,6 +463,17 @@ impl<'a> Job
),
)
.subcommand(
+ SubCommand::with_name("edit")
+ .about("launch a graphical color scheme editor")
+ .arg(
+ Arg::with_name("scheme")
+ .help("name of the scheme to edit")
+ .required(false)
+ .value_name("NAME")
+ .takes_value(true),
+ ),
+ )
+ .subcommand(
SubCommand::with_name("list")
.about("list builtin schemes"),
)
@@ -786,6 +797,20 @@ impl<'a> Job
}
Err(anyhow!("dump requires an argument"))
},
+ ("edit", Some(subm)) => {
+ #[cfg(feature = "gui")]
+ if let Some(name) = subm.value_of("scheme") {
+ let scm = Scheme::from(name);
+ Ok(Self(con, Subcmd::Colors(ColorJob::Dump(scm))))
+ } else {
+ todo!() /* generate generic name */
+ }
+ #[cfg(not(feature = "gui"))]
+ Err(anyhow!(
+ "the ``edit'' subcommand requires vtcol to be \
+ built with the the ``gui'' feature"
+ ))
+ },
("list", _) =>
Ok(Self(con, Subcmd::Colors(ColorJob::List))),
("set", Some(subm)) => {