summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vtcol.rs38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/vtcol.rs b/src/vtcol.rs
index feb8f0b..baf5ae3 100644
--- a/src/vtcol.rs
+++ b/src/vtcol.rs
@@ -254,6 +254,7 @@ enum ColorJob
/** Dump a scheme. */
Dump(Scheme),
/** Launch scheme editor. */
+ #[cfg(feature = "gui")]
Edit(Option<String>, Scheme),
/** Switch to color scheme. */
Set(Scheme),
@@ -271,6 +272,7 @@ impl Run for ColorJob
{
match self {
Self::Dump(scm) => Self::dump(scm),
+ #[cfg(feature = "gui")]
Self::Edit(name, scm) => Self::edit(name, scm),
Self::List => Self::list(),
Self::Set(scm) => Self::set(console, scm),
@@ -335,16 +337,6 @@ impl ColorJob
editor.run()
}
- #[cfg(not(feature = "gui"))]
- fn edit(scm: Scheme) -> Result<()>
- {
- eprintln!(
- "scheme editor not available; try recompiling vtcol with \
- --features=gui!"
- );
- Err(anyhow!("editor not available"))
- }
-
fn set(con: Option<String>, scheme: Scheme) -> Result<()>
{
let fd = open_console(con.as_deref())?;
@@ -842,10 +834,13 @@ impl<'a> Job
))
}
#[cfg(not(feature = "gui"))]
- Err(anyhow!(
- "the ``edit'' subcommand requires vtcol to be \
- built with the the ``gui'' feature"
- ))
+ {
+ let _ = subm; /* silence warn(unused_variables) */
+ Err(anyhow!(
+ "the ``edit'' subcommand requires vtcol to be \
+ built with the the ``gui'' feature"
+ ))
+ }
},
("list", _) =>
Ok(Self(con, Subcmd::Colors(ColorJob::List))),
@@ -1016,14 +1011,13 @@ impl<'a> Job
));
}
- let target =
- if subm.is_present("both") {
- FlagTarget::Both
- } else if subm.is_present("dflt") {
- FlagTarget::Default
- } else {
- FlagTarget::Current
- };
+ let target = if subm.is_present("both") {
+ FlagTarget::Both
+ } else if subm.is_present("dflt") {
+ FlagTarget::Default
+ } else {
+ FlagTarget::Current
+ };
let cap =
subm.value_of("caps").map(|a| a == "on");