From be79f6373e6b4340d856586344178b22c054a2f2 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 21 Oct 2017 14:12:21 +0200 Subject: [PATCH] Import crate for imag-habit --- Cargo.toml | 1 + bin/domain/imag-habit/Cargo.toml | 33 +++++++++++ bin/domain/imag-habit/src/main.rs | 98 +++++++++++++++++++++++++++++++ bin/domain/imag-habit/src/ui.rs | 24 ++++++++ doc/src/09020-changelog.md | 1 + 5 files changed, 157 insertions(+) create mode 100644 bin/domain/imag-habit/Cargo.toml create mode 100644 bin/domain/imag-habit/src/main.rs create mode 100644 bin/domain/imag-habit/src/ui.rs diff --git a/Cargo.toml b/Cargo.toml index 03400335..c8a2b9f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ members = [ "bin/domain/imag-bookmark", "bin/domain/imag-contact", "bin/domain/imag-diary", + "bin/domain/imag-habit", "bin/domain/imag-mail", "bin/domain/imag-notes", "bin/domain/imag-timetrack", diff --git a/bin/domain/imag-habit/Cargo.toml b/bin/domain/imag-habit/Cargo.toml new file mode 100644 index 00000000..d8f58506 --- /dev/null +++ b/bin/domain/imag-habit/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "imag-habit" +version = "0.5.0" +authors = ["Matthias Beyer "] + +description = "Part of the imag core distribution: imag-habit command" + +keywords = ["imag", "PIM", "personal", "information", "management"] +readme = "../../../README.md" +license = "LGPL-2.1" + +documentation = "https://matthiasbeyer.github.io/imag/imag_documentation/index.html" +repository = "https://github.com/matthiasbeyer/imag" +homepage = "http://imag-pim.org" + +[dependencies] +chrono = "0.4" +version = "2.0" +clap = ">=2.17" +log = "0.3" +toml = "0.4" +toml-query = "^0.4" +kairos = "0.1.0-beta-2" + +libimagerror = { version = "0.5.0", path = "../../../lib/core/libimagerror" } +libimagstore = { version = "0.5.0", path = "../../../lib/core/libimagstore" } +libimagrt = { version = "0.5.0", path = "../../../lib/core/libimagrt" } +libimagentryedit = { version = "0.5.0", path = "../../../lib/entry/libimagentryedit" } +libimaginteraction = { version = "0.5.0", path = "../../../lib/etc/libimaginteraction" } +libimagutil = { version = "0.5.0", path = "../../../lib/etc/libimagutil" } +libimagtimeui = { version = "0.5.0", path = "../../../lib/etc/libimagtimeui" } +libimaghabit = { version = "0.5.0", path = "../../../lib/domain/libimaghabit" } + diff --git a/bin/domain/imag-habit/src/main.rs b/bin/domain/imag-habit/src/main.rs new file mode 100644 index 00000000..76ea37cb --- /dev/null +++ b/bin/domain/imag-habit/src/main.rs @@ -0,0 +1,98 @@ +// +// imag - the personal information management suite for the commandline +// Copyright (C) 2015, 2016 Matthias Beyer 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 +// + +#![deny( + non_camel_case_types, + non_snake_case, + path_statements, + trivial_numeric_casts, + unstable_features, + unused_allocation, + unused_import_braces, + unused_imports, + unused_must_use, + unused_mut, + unused_qualifications, + while_true, +)] + +extern crate clap; +#[macro_use] extern crate log; +#[macro_use] extern crate version; +extern crate toml; +extern crate toml_query; +extern crate kairos; + +extern crate libimaghabit; +extern crate libimagstore; +extern crate libimagrt; +extern crate libimagerror; +extern crate libimagutil; + +use std::process::exit; + +use libimagrt::runtime::Runtime; +use libimagrt::setup::generate_runtime_setup; +use libimagerror::trace::{MapErrTrace, trace_error}; +use libimaghabit::store::HabitStore; +use libimaghabit::habit::builder::HabitBuilder; +use libimaghabit::habit::HabitTemplate; + +mod ui; + +fn main() { + let rt = generate_runtime_setup("imag-habit", + &version!()[..], + "Habit tracking tool", + ui::build_ui); + + + rt.cli() + .subcommand_name() + .map(|name| { + debug!("Call {}", name); + match name { + "create" => create(&rt), + "delete" => delete(&rt), + "list" => list(&rt), + "show" => show(&rt), + _ => { + debug!("Unknown command"); // More error handling + exit(1) + }, + } + }); +} + +fn create(rt: &Runtime) { + unimplemented!() +} + +fn delete(rt: &Runtime) { + unimplemented!() +} + +fn list(rt: &Runtime) { + unimplemented!() +} + +fn show(rt: &Runtime) { + unimplemented!() +} + diff --git a/bin/domain/imag-habit/src/ui.rs b/bin/domain/imag-habit/src/ui.rs new file mode 100644 index 00000000..f0259e36 --- /dev/null +++ b/bin/domain/imag-habit/src/ui.rs @@ -0,0 +1,24 @@ +// +// imag - the personal information management suite for the commandline +// Copyright (C) 2015, 2016 Matthias Beyer 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 clap::{Arg, App, SubCommand}; + +pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { + app +} diff --git a/doc/src/09020-changelog.md b/doc/src/09020-changelog.md index a0004df1..bb3246ad 100644 --- a/doc/src/09020-changelog.md +++ b/doc/src/09020-changelog.md @@ -34,6 +34,7 @@ This section contains the changelog from the last release to the next release. Specifying an editor either via CLI or via the `$EDITOR` environment variable still possible. * `imag-contact` was added (with basic contact support so far). + * `imag-habit` was introduced * Minor changes * `libimagentryannotation` got a rewrite, is not based on `libimagnotes`