diff options
author | Nora <nora.widdecke@tu-bs.de> | 2019-02-25 00:12:01 +0100 |
---|---|---|
committer | Nora <nora.widdecke@tu-bs.de> | 2019-02-25 00:12:01 +0100 |
commit | e460f5fc6787726e4971df512187eaa6c4725d2b (patch) | |
tree | bed16dfbf56baa54a505e61305cd42af86a6ccb3 | |
parent | 470ac304102864fd61e30656c73c623efe2e1874 (diff) |
structopt seq
-rw-r--r-- | src/actions/seq.rs | 8 | ||||
-rw-r--r-- | src/bin/khaleesi.rs | 2 | ||||
-rw-r--r-- | src/cli.rs | 6 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/actions/seq.rs b/src/actions/seq.rs index 83487ce..7cdfe90 100644 --- a/src/actions/seq.rs +++ b/src/actions/seq.rs @@ -2,7 +2,7 @@ use crate::seqfile; use crate::utils::stdioutils; use crate::KhResult; -pub fn action_seq(_args: &[&str]) -> KhResult<()> { +pub fn action_seq() -> KhResult<()> { if !stdioutils::is_stdin_tty() { write_stdin_to_seqfile()?; } else { @@ -47,7 +47,7 @@ mod integration { let testdir = testutils::prepare_testdir_empty(); stdioutils::test_stdin_write("hi\nthere"); - action_seq(&[]).unwrap(); + action_seq().unwrap(); testdir.child(".khaleesi/seq").assert("hi\nthere\n"); } @@ -56,7 +56,7 @@ mod integration { fn test_no_stdin() { let testdir = testutils::prepare_testdir("testdir_with_seq"); - action_seq(&[]).unwrap(); + action_seq().unwrap(); let out = stdioutils::test_stdout_clear(); let predicate = predicate::str::similar(out); @@ -69,7 +69,7 @@ mod integration { stdioutils::test_stdin_write("hi\nthere"); stdioutils::test_stdout_set_tty(false); - action_seq(&[]).unwrap(); + action_seq().unwrap(); let out = stdioutils::test_stdout_clear(); testdir.child(".khaleesi/seq").assert("hi\nthere\n"); diff --git a/src/bin/khaleesi.rs b/src/bin/khaleesi.rs index 0a454b5..76f4188 100644 --- a/src/bin/khaleesi.rs +++ b/src/bin/khaleesi.rs @@ -56,7 +56,7 @@ fn main_internal(args: &cli::CommandLine, config: &Config) -> KhResult<()> { cli::Command::Select(x) => { select::select_by_args(&x.args.iter().map(|x| x.as_ref()).collect::<Vec<&str>>()) } - // "seq" => seq::action_seq(args), + cli::Command::Seq => seq::action_seq(), // "pretty" => prettyprint::prettyprint(), // "show" => show::do_show(args), // "undo" => undo::do_undo(args), @@ -44,6 +44,12 @@ pub enum Command { /// Select from the index #[structopt(name = "select")] Select(Select), + /// Interact with the sequence + #[structopt(name = "seq")] + Seq, + /// Show the raw ical file of an event + #[structopt(name = "show")] + Show, } #[derive(Debug, StructOpt)] |