summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vtcol.rs30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/vtcol.rs b/src/vtcol.rs
index 8161241..256d137 100644
--- a/src/vtcol.rs
+++ b/src/vtcol.rs
@@ -48,13 +48,24 @@ impl<'a> Job
.author(clap::crate_authors!())
.about(clap::crate_description!())
.subcommand(
- SubCommand::with_name("dump").about("dump a color scheme").arg(
- Arg::with_name("scheme")
- .help("name of the scheme")
- .required(true)
- .value_name("NAME")
- .takes_value(true),
- ),
+ SubCommand::with_name("dump")
+ .about("dump a color scheme")
+ .arg(
+ Arg::with_name("scheme")
+ .help("name of the scheme")
+ .required(false)
+ .value_name("NAME")
+ .takes_value(true),
+ )
+ .arg(
+ Arg::with_name("base64")
+ .short("b")
+ .long("base64")
+ .value_name("DATA")
+ .help("base64 encoded binary input")
+ .required(false)
+ .takes_value(true),
+ ),
)
.subcommand(
SubCommand::with_name("list").about("list available schemes"),
@@ -175,6 +186,11 @@ impl<'a> Job
match matches.subcommand() {
("dump", Some(subm)) => {
+ if let Some(b64) = subm.value_of("base64") {
+ let scheme =
+ Palette::from_base64(&b64).map(Scheme::from)?;
+ return Ok(Self::Dump(scheme));
+ }
if let Some(name) = subm.value_of("scheme") {
let scm = Scheme::from(name);
return Ok(Self::Dump(scm));