summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-04-30 17:33:35 +0200
committerGitHub <noreply@github.com>2018-04-30 17:33:35 +0200
commitebc2e49c5bda8c13d0fbb7cd132cf9b0236a05f2 (patch)
tree0c9bd9a90738b2538b30129f431837ef2540e39e
parent76966bcd6c6e9c330cc97ad230e84f3dbddcba56 (diff)
parent58a6eea573c6887921d7883ed009662439f87c66 (diff)
downloadimag-ebc2e49c5bda8c13d0fbb7cd132cf9b0236a05f2.zip
imag-ebc2e49c5bda8c13d0fbb7cd132cf9b0236a05f2.tar.gz
Merge pull request #1469 from matthiasbeyer/imag-diary/remove-edit-command
Remove the edit command
-rw-r--r--bin/domain/imag-diary/src/edit.rs66
-rw-r--r--bin/domain/imag-diary/src/main.rs3
-rw-r--r--bin/domain/imag-diary/src/ui.rs13
3 files changed, 0 insertions, 82 deletions
diff --git a/bin/domain/imag-diary/src/edit.rs b/bin/domain/imag-diary/src/edit.rs
deleted file mode 100644
index 2c97405..0000000
--- a/bin/domain/imag-diary/src/edit.rs
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// imag - the personal information management suite for the commandline
-// Copyright (C) 2015-2018 Matthias Beyer <mail@beyermatthias.de> and contributors
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; version
-// 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-//
-
-use std::process::exit;
-
-use chrono::naive::NaiveDateTime;
-
-use libimagdiary::diary::Diary;
-use libimagdiary::diaryid::DiaryId;
-use libimagdiary::error::DiaryErrorKind as DEK;
-use libimagdiary::error::DiaryError as DE;
-use libimagdiary::error::ResultExt;
-use libimagentryedit::edit::Edit;
-use libimagrt::runtime::Runtime;
-use libimagerror::trace::MapErrTrace;
-use libimagtimeui::datetime::DateTime;
-use libimagtimeui::parse::Parse;
-use libimagutil::warn_exit::warn_exit;
-
-use util::get_diary_name;
-
-pub fn edit(rt: &Runtime) {
- let diaryname = get_diary_name(rt).unwrap_or_else(|| warn_exit("No diary name", 1));
-
- rt.cli()
- .subcommand_matches("edit")
- .unwrap()
- .value_of("datetime")
- .and_then(DateTime::parse)
- .map(|dt| dt.into())
- .map(|dt: NaiveDateTime| DiaryId::from_datetime(diaryname.clone(), dt))
- .or_else(|| {
- rt.store()
- .get_youngest_entry_id(&diaryname)
- .map(|o| o.map_err_trace_exit_unwrap(1))
- })
- .ok_or_else(|| {
- error!("No entries in diary. Aborting");
- exit(1)
- })
- .and_then(|id| rt.store().get(id))
- .map(|opte| match opte {
- Some(mut e) => e.edit_content(rt).chain_err(|| DEK::IOError),
- None => Err(DE::from_kind(DEK::EntryNotInDiary)),
- })
- .map_err_trace()
- .ok();
-}
-
-
diff --git a/bin/domain/imag-diary/src/main.rs b/bin/domain/imag-diary/src/main.rs
index ebf343d..d48f028 100644
--- a/bin/domain/imag-diary/src/main.rs
+++ b/bin/domain/imag-diary/src/main.rs
@@ -59,7 +59,6 @@ use itertools::Itertools;
mod create;
mod delete;
-mod edit;
mod list;
mod ui;
mod util;
@@ -67,7 +66,6 @@ mod view;
use create::create;
use delete::delete;
-use edit::edit;
use list::list;
use view::view;
@@ -86,7 +84,6 @@ fn main() {
"diaries" => diaries(&rt),
"create" => create(&rt),
"delete" => delete(&rt),
- "edit" => edit(&rt),
"list" => list(&rt),
"view" => view(&rt),
other => {
diff --git a/bin/domain/imag-diary/src/ui.rs b/bin/domain/imag-diary/src/ui.rs
index a5e54bc..fe20ba1 100644
--- a/bin/domain/imag-diary/src/ui.rs
+++ b/bin/domain/imag-diary/src/ui.rs
@@ -77,19 +77,6 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.requires("timed"))
)
- .subcommand(SubCommand::with_name("edit")
- .about("Edit a diary entry")
- .version("0.1")
- .arg(Arg::with_name("datetime")
- .long("datetime")
- .short("d")
- .takes_value(true)
- .required(false)
- .help("Specify the date and time which entry should be edited. If none is
- specified, the last entry is edited. If the diary entry does not exist for
- this time, this fails. Format: YYYY-MM-DDT[HH[:mm[:ss]]]"))
- )
-
.subcommand(SubCommand::with_name("list")
.about("List diary entries")
.version("0.1"))