summaryrefslogtreecommitdiffstats
path: root/src/actions
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/cursor.rs14
-rw-r--r--src/actions/get.rs8
-rw-r--r--src/actions/index/action.rs4
-rw-r--r--src/actions/new.rs10
-rw-r--r--src/actions/unroll.rs4
5 files changed, 20 insertions, 20 deletions
diff --git a/src/actions/cursor.rs b/src/actions/cursor.rs
index f881aef..6293a56 100644
--- a/src/actions/cursor.rs
+++ b/src/actions/cursor.rs
@@ -2,14 +2,14 @@ use crate::cursorfile;
use crate::utils::stdioutils;
use crate::KhResult;
use crate::seqfile;
-use crate::cli::{Cursor,Direction as CursorDirection};
+use crate::cli::{CursorArgs,Direction as CursorDirection};
enum Direction {
Up,
Down,
}
-pub fn do_cursor(args: &Cursor) -> KhResult<()> {
+pub fn do_cursor(args: &CursorArgs) -> KhResult<()> {
if !stdioutils::is_stdin_tty() {
write_stdin_to_cursorfile()?;
} else {
@@ -85,7 +85,7 @@ mod integration {
let expected_str = "hi there";
stdioutils::test_stdin_write(expected_str);
- let args = Cursor{direction: None};
+ let args = CursorArgs{direction: None};
do_cursor(&args).unwrap();
testdir.child(".khaleesi/cursor").assert(expected_str);
@@ -94,7 +94,7 @@ mod integration {
#[test]
fn test_cursor_sequence_move_next() {
let testdir = testutils::prepare_testdir("testdir_with_seq_and_cursor");
- let args = Cursor{direction: Some(CursorDirection::next)};
+ let args = CursorArgs{direction: Some(CursorDirection::next)};
do_cursor(&args).unwrap();
let out = "1182988800 rfc_multi_day_allday.ics";
@@ -105,7 +105,7 @@ mod integration {
#[test]
fn test_cursor_sequence_move_prev_at_end() {
let testdir = testutils::prepare_testdir("testdir_with_seq_and_cursor");
- let args = Cursor{direction: Some(CursorDirection::prev)};
+ let args = CursorArgs{direction: Some(CursorDirection::prev)};
do_cursor(&args).unwrap();
let out = "1544740200 twodaysacrossbuckets.ics\n";
@@ -119,7 +119,7 @@ mod integration {
let expected_str = "hi\nthere";
stdioutils::test_stdin_write(expected_str);
- let args = Cursor{direction: None};
+ let args = CursorArgs {direction: None};
let result = do_cursor(&args);
assert!(result.is_err());
@@ -130,7 +130,7 @@ mod integration {
fn test_no_stdin() {
let testdir = testutils::prepare_testdir("testdir_with_cursor");
- let args = Cursor{direction: None};
+ let args = CursorArgs {direction: None};
do_cursor(&args).unwrap();
let out = stdioutils::test_stdout_clear();
diff --git a/src/actions/get.rs b/src/actions/get.rs
index bba8a80..f755ee5 100644
--- a/src/actions/get.rs
+++ b/src/actions/get.rs
@@ -1,10 +1,10 @@
use crate::calendars;
use crate::KhResult;
-use crate::cli::{Get, GetArgs};
+use crate::cli::{GetArgs, GetQueryArgs};
-pub fn action_get(args: &Get) -> KhResult<()> {
+pub fn action_get(args: &GetArgs) -> KhResult<()> {
match args.query {
- GetArgs::calendars => action_get_calendars(),
+ GetQueryArgs::calendars => action_get_calendars(),
}
}
@@ -27,7 +27,7 @@ mod integration {
fn test_get_calendars() {
let _testdir = testutils::prepare_testdir("testdir_two_cals");
- let args = Get { query: GetArgs::calendars };
+ let args = GetArgs { query: GetQueryArgs::calendars };
action_get(&args).unwrap();
assert_eq!("first\nsecond\nsecond/second_sub\n", stdioutils::test_stdout_clear());
diff --git a/src/actions/index/action.rs b/src/actions/index/action.rs
index d4f855e..62cdf32 100644
--- a/src/actions/index/action.rs
+++ b/src/actions/index/action.rs
@@ -12,9 +12,9 @@ use crate::utils::fileutil;
use crate::utils::lock;
use crate::utils::misc;
use crate::KhResult;
-use crate::cli::Index;
+use crate::cli::IndexArgs;
-pub fn action_index(args: &Index) -> KhResult<()> {
+pub fn action_index(args: &IndexArgs) -> KhResult<()> {
let reindex = args.reindex;
let indexpath = match &args.path {
Some(path) => path.clone(),
diff --git a/src/actions/new.rs b/src/actions/new.rs
index e1c54f3..dac7931 100644
--- a/src/actions/new.rs
+++ b/src/actions/new.rs
@@ -2,7 +2,7 @@ use crate::defaults;
use crate::icalwrap::{IcalVCalendar,IcalTime,IcalTimeZone};
use crate::khline::KhLine;
use crate::utils::{misc,fileutil};
-use crate::cli::New;
+use crate::cli::NewArgs;
use crate::KhResult;
use crate::cursorfile;
@@ -17,7 +17,7 @@ struct EventProperties {
}
impl EventProperties {
- fn parse_from_args(args: &New) -> KhResult<EventProperties> {
+ fn parse_from_args(args: &NewArgs) -> KhResult<EventProperties> {
let calendar = EventProperties::parse_calendar(&args.calendar)?;
let from = EventProperties::parse_from(&args.from)?;
let to = EventProperties::parse_to(&args.to)?;
@@ -70,7 +70,7 @@ impl EventProperties {
}
}
-pub fn do_new(args: &New) -> KhResult<()> {
+pub fn do_new(args: &NewArgs) -> KhResult<()> {
let uid = misc::make_new_uid();
let ep = EventProperties::parse_from_args(args)?;
@@ -204,7 +204,7 @@ mod integration {
#[test]
fn test_parse_from_args() {
let _testdir = testutils::prepare_testdir("testdir_two_cals");
- let args = New { calendar: "second".to_string(),
+ let args = NewArgs { calendar: "second".to_string(),
from: "2017-11-03T12:30:00".to_string(),
to: "2017-11-07T11:11:00".to_string(),
summary: "summary text".to_string(),
@@ -258,7 +258,7 @@ mod integration {
testdata::setup();
let testdir = testutils::prepare_testdir("testdir_two_cals");
- let args = New { calendar: "second".to_string(),
+ let args = NewArgs { calendar: "second".to_string(),
from: "2017-11-03T12:30:00".to_string(),
to: "2017-11-07T11:11:00".to_string(),
summary: "summary text".to_string(),
diff --git a/src/actions/unroll.rs b/src/actions/unroll.rs
index 044eb59..882da7e 100644
--- a/src/actions/unroll.rs
+++ b/src/actions/unroll.rs
@@ -2,9 +2,9 @@ use std::path::Path;
use crate::khline::KhLine;
use crate::KhResult;
-use crate::cli::Unroll;
+use crate::cli::UnrollArgs;
-pub fn action_unroll(args: &Unroll) -> KhResult<()> {
+pub fn action_unroll(args: &UnrollArgs) -> KhResult<()> {
let filepath = &args.path;
do_unroll(filepath)?;