summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vtcol.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/vtcol.rs b/vtcol.rs
index acf8db7..f734525 100644
--- a/vtcol.rs
+++ b/vtcol.rs
@@ -6,6 +6,8 @@ extern crate getopts;
#[derive(Show)]
enum Scheme { Default, SolarizedDark, SolarizedLight }
+extern { fn exit (code : libc::c_int) -> !; }
+
/* struct Job -- Runtime parameters.
*/
#[derive(Show)]
@@ -24,6 +26,7 @@ impl Job {
let this = argv[0].clone();
let opts = &[
getopts::optopt("s", "scheme", "predefined color scheme", "NAME"),
+ getopts::optflag("l", "list", "list available color schemes"),
getopts::optflag("h", "help", "print this message")
];
let matches = match getopts::getopts(argv.tail(), opts)
@@ -31,6 +34,10 @@ impl Job {
Ok(m) => m,
Err(f) => panic!(f.to_string())
};
+ if matches.opt_present("l") {
+ Job::schemes();
+ unsafe { exit(0) };
+ };
let scheme = match matches.opt_str("s") {
None => {
Job::usage(&this, opts);
@@ -61,6 +68,15 @@ impl Job {
print!("{}", getopts::usage(brief.as_slice(), opts));
}
+ fn
+ schemes ()
+ {
+ println!("Available color schemes:");
+ println!(" · solarized_dark");
+ println!(" · solarized_light");
+ println!(" · default");
+ }
+
} /* [impl Job] */
/* Rust appears to come with two wrappers for ``ioctl(2)``, but neither can be utilized for our