summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--src/vtcol.rs25
2 files changed, 27 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index ac7f62c..6aca9fc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,9 +18,11 @@ libc = "0.2"
clap = { version = "2.33", optional = true }
anyhow = { version = "1.0", optional = true }
base64 = "0.13"
+slint = { version = "0.2", optional = true }
[features]
vtcol-bin = [ "anyhow", "clap" ]
+gui = [ "vtcol-bin", "slint" ]
[[bin]]
name = "vtcol"
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)) => {