summaryrefslogtreecommitdiff
path: root/src/vtcol.rs
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2021-11-25 00:11:08 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2021-11-25 00:11:14 +0100
commitd6e8a37767644b50001e14ebbab594e799a94db7 (patch)
treed5b91ee3b1dd0adc25e8dd245e4dde5b63522726 /src/vtcol.rs
parenta96f86710eaabe5ae8c235ca537ad5b156884fc9 (diff)
downloadvtcol-d6e8a37767644b50001e14ebbab594e799a94db7.tar.gz
move base64 handling out of Palette
Try and not encumber the lower level types with more dependencies than needed.
Diffstat (limited to 'src/vtcol.rs')
-rw-r--r--src/vtcol.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/vtcol.rs b/src/vtcol.rs
index 256d137..9a78d2f 100644
--- a/src/vtcol.rs
+++ b/src/vtcol.rs
@@ -187,8 +187,7 @@ 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)?;
+ let scheme = Scheme::from_base64(b64)?;
return Ok(Self::Dump(scheme));
}
if let Some(name) = subm.value_of("scheme") {
@@ -200,8 +199,7 @@ impl<'a> Job
("list", _) => Ok(Self::List),
("set", Some(subm)) => {
if let Some(b64) = subm.value_of("base64") {
- let scheme =
- Palette::from_base64(&b64).map(Scheme::from)?;
+ let scheme = Scheme::from_base64(&b64)?;
return Ok(Self::Set(scheme));
}
let scheme = match subm.value_of("scheme") {
@@ -353,16 +351,14 @@ impl<'a> Job
let fd = Console::current()?;
vrb!("console fd: {}", fd);
+ let scm = fd.current_scheme()?;
if b64 {
- let pal = fd.current_palette()?;
- println!("{}", pal.base64());
+ print!("{}", scm.base64()?);
+ } else {
+ vrb!("active scheme:");
+ println!("{}", scm);
}
- let scm = fd.current_scheme()?;
-
- vrb!("active scheme:");
- println!("{}", scm);
-
Ok(())
}