summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2015-05-08 07:44:11 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2015-05-08 07:46:39 +0200
commit5bf96d61d1a639c607a8d21d475f89031f2c9d5b (patch)
tree15ad1756ca0c25c3b4a95e0ad834412afea25ccc
parent9b022cd4aa4f4cb8c8dce1c164086da857edbabf (diff)
downloadvtcol-5bf96d61d1a639c607a8d21d475f89031f2c9d5b.tar.gz
vtcol.rs: read from stdin if passed dash as file or scheme name
-rw-r--r--README.rst9
-rw-r--r--src/vtcol.rs10
2 files changed, 13 insertions, 6 deletions
diff --git a/README.rst b/README.rst
index 1dc19d1..b66f1d6 100644
--- a/README.rst
+++ b/README.rst
@@ -36,6 +36,9 @@ argument.
vtcol --file ./schemes/solarized
+Instead of an actual scheme or file name, these parameters accept ``-``
+as an argument in order to read from ``stdin``.
+
Also, in order to view a scheme’s definition, for instance in order to verify
that **vtcol** parses it correctly, specify the ``--dump`` option.
@@ -84,9 +87,9 @@ might be achieved using more modern tools.
About
-----
**vtcols** was written mostly during day-long train rides between Tübingen and
-Dresden, so expect the commit history to exhibit a certain lack continuity. Its
-author_ is Philipp Gesang; see the Bitbucket (author-bb_) and Github
-(author-gh_) pages.
+Dresden, so expect the commit history to exhibit a certain lack of
+continuity. Its author_ is Philipp Gesang; see the Bitbucket
+(author-bb_) and Github (author-gh_) pages.
The **vtcol** source code is available from the `canonical repository`_.
diff --git a/src/vtcol.rs b/src/vtcol.rs
index de66928..8e36d0f 100644
--- a/src/vtcol.rs
+++ b/src/vtcol.rs
@@ -184,13 +184,17 @@ impl<'a> Job {
Job::usage(&this, opts);
panic!("no file name specified, aborting")
},
- Some (fname) => Scheme::Custom(Some(fname.clone()))
+ Some (fname) =>
+ if fname == "-" { Job::scheme_from_stdin() }
+ else { Scheme::Custom(Some(fname.clone())) }
}
} else {
match matches.opt_str("s")
{
- Some (name) => Job::pick_scheme(&name),
- None => Job::scheme_from_stdin()
+ None => Job::scheme_from_stdin(),
+ Some (name) =>
+ if name == "-" { Job::scheme_from_stdin() }
+ else { Job::pick_scheme(&name) }
}
}; /* [let scheme] */