diff --git a/.travis.yml b/.travis.yml index 3d4aa4b0..5b0a0af3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,16 @@ matrix: script: - cargo build --all --all-features -j 1 || exit 1 - cargo test --all --all-features -j 1 || exit 1 + - language: rust + rust: beta + cache: + directories: + - /home/travis/.cargo + before_cache: + - rm -rf /home/travis/.cargo/registry + script: + - cargo build --all --all-features -j 1 || exit 1 + - cargo test --all --all-features -j 1 || exit 1 addons: diff --git a/README.md b/README.md index a645196d..05efdba3 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,6 @@ `imag` is a commandline personal information management suite. -[![Build Status](https://travis-ci.org/matthiasbeyer/imag.svg?branch=master)](https://travis-ci.org/matthiasbeyer/imag) -[![Issue Stats](http://www.issuestats.com/github/matthiasbeyer/imag/badge/pr?style=flat-square)](http://www.issuestats.com/github/matthiasbeyer/imag) -[![Issue Stats](http://www.issuestats.com/github/matthiasbeyer/imag/badge/issue?style=flat-square)](http://www.issuestats.com/github/matthiasbeyer/imag) -[![license](https://img.shields.io/github/license/matthiasbeyer/imag.svg?maxAge=2592000?style=flat-square)]() -[![Tokei](https://tokei.rs/b1/github/matthiasbeyer/imag)](https://github.com/matthiasbeyer/imag) - **This application is in early development. There are _some_ things that work, but we do not consider anything stable or usable at this moment. Feel free to play around anyways.** @@ -19,8 +13,7 @@ early 2019. I hope I can continue develop imag during that time, but I cannot guarantee that. I hope I can continue development of imag after that and I certainly plan to do so. -But from May 2018 until early 2019, expect long response times on issues and -pull requests. +But from May 2018 until early 2019, expect long response times. ## Goal / What is imag? @@ -50,24 +43,14 @@ All subdirectories prefixed with "`libimag"` are libraries. All subdirectories prefixed with `"imag-"` are binaries and compiling them will give you a commandline application. + ### Building We use `cargo` for building all crates in this repository. Make sure to use a recent `cargo`, at least one with workspace support. Building all crates works with `cargo build --all`, building individual crates -by `cd`ing to their directory and calling `cargo build`. +by specifying the `--manifest-path` flag to cargo. -For building all commandline applications: - -```bash -find bin -maxdepth 3 -name Cargo.toml -exec cargo build --manifest-path {} \; -``` - -For building only the core functionality - -```bash -find bin/core -maxdepth 3 -name Cargo.toml -exec cargo build --manifest-path {} \; -``` ### Running @@ -75,8 +58,10 @@ After you build the module you want to play with, you can simply call the binary itself with the `--help` flag, to get some help what the module is capable of. If you installed the module, you can either call `imag-` (if the -install-directory is in your `$PATH`), or install the `imag` binary to call `imag -` (also if everything is in your `$PATH`). +install-directory is in your `$PATH`), or install the `imag` binary to call +`imag ` (also if everything is in your `$PATH`). +Call `imag --help` to see which modules are found and can be used. +Call `imag --versions` to print the versions of all modules. ## Example usage @@ -97,7 +82,7 @@ imag contact create --file /home/user/contacts/private # Add a diary entry imag diary -p private create -# Uh, I forgot something in a diary entry, select one and edit it +# Uh, I forgot something in a diary entry, select one (or multiple) and edit it # use the `fzf` tool here (not a part of imag) to select from the IDs imag diary -p private list | fzf -m | imag edit -I @@ -111,7 +96,7 @@ imag annotate add contact/bc222298-casf-40a4-bda1-50aa980a68c9 contact-notes imag notes create "pineapple" # Where was that contact again? -imag grep Eva +imag grep Eva # also possible with `imag contact find Eva` # Okay, we need to add some imag-internal notes to that contact imag grep Eva -l | imag edit -I @@ -124,7 +109,7 @@ imag git commit -m 'Commit message' ## Staying up-to-date We have a [official website for imag](https://imag-pim.org), where I post -[release notes](http://imag-pim.org/releases/) and monthly(ish) updates what's +[release notes](https://imag-pim.org/releases/) and monthly(ish) updates what's happening in the source tree ([RSS here](https://imag-pim.org/index.xml)). We also have a [mailinglist](https://imag-pim.org/mailinglist/) where I post @@ -134,7 +119,7 @@ updates and where discussion and questions are encouraged. ## Documentation We have some documentation in [the ./doc subtree](./doc/) -which can be compiled to PDF or a website. +which can be compiled to PDF or a website using pandoc. It might not be up to date, though. Developer documentation for the last release is available [on docs.rs](https://docs.rs/releases/search?query=imag). @@ -143,8 +128,9 @@ Developer documentation for the last release is available ## Please contribute! We are looking for contributors! -Feel free to open issues for asking questions, suggesting features or other -things! +Feel free to open issues (by writing to +[the mailinglist](https://imag-pim.org/mailinglist/)) +for asking questions, suggesting features or other things! Also have a look at [the CONTRIBUTING.md file](./CONTRIBUTING.md)! diff --git a/bin/core/imag-ids/src/main.rs b/bin/core/imag-ids/src/main.rs index 308a56aa..f69fd891 100644 --- a/bin/core/imag-ids/src/main.rs +++ b/bin/core/imag-ids/src/main.rs @@ -68,7 +68,7 @@ fn main() { let version = make_imag_version!(); let rt = generate_runtime_setup("imag-ids", &version, - "print all ids", + "Print all ids, optionally filtered with a user-defined filter", build_ui); let print_storepath = rt.cli().is_present("print-storepath"); diff --git a/bin/core/imag-link/src/main.rs b/bin/core/imag-link/src/main.rs index cb40de5c..5a177308 100644 --- a/bin/core/imag-link/src/main.rs +++ b/bin/core/imag-link/src/main.rs @@ -80,7 +80,7 @@ fn main() { let version = make_imag_version!(); let rt = generate_runtime_setup("imag-link", &version, - "Link entries", + "Add/Remove links between entries", build_ui); if rt.cli().is_present("check-consistency") { let exit_code = match rt.store().check_link_consistency() { diff --git a/bin/core/imag-tag/src/main.rs b/bin/core/imag-tag/src/main.rs index f07b8b25..01387336 100644 --- a/bin/core/imag-tag/src/main.rs +++ b/bin/core/imag-tag/src/main.rs @@ -80,7 +80,7 @@ fn main() { let version = make_imag_version!(); let rt = generate_runtime_setup("imag-tag", &version, - "Direct interface to the store. Use with great care!", + "Add and remove tags for entries", build_ui); let ids : Vec = rt diff --git a/bin/core/imag/src/main.rs b/bin/core/imag/src/main.rs index fbaa974e..9b8267ca 100644 --- a/bin/core/imag/src/main.rs +++ b/bin/core/imag/src/main.rs @@ -91,7 +91,7 @@ fn help_text(cmds: Vec) -> String { Call a command with 'imag ' Each command can be called with "--help" to get the respective helptext. - Please visit https://github.com/matthiasbeyer/imag to view the source code, + Please visit https://git.imag-pim.org/imag to view the source code, follow the development of imag or maybe even contribute to imag. imag is free software. It is released under the terms of LGPLv2.1 diff --git a/bin/domain/imag-wiki/src/main.rs b/bin/domain/imag-wiki/src/main.rs index 6e586009..5d5969b3 100644 --- a/bin/domain/imag-wiki/src/main.rs +++ b/bin/domain/imag-wiki/src/main.rs @@ -48,7 +48,7 @@ fn main() { let version = make_imag_version!(); let rt = generate_runtime_setup("imag-wiki", &version, - "Personal wiki", + "Manage a personal Wiki", build_ui); let wiki_name = rt.cli().value_of("wikiname").unwrap_or("default"); diff --git a/lib/core/libimagrt/src/logger.rs b/lib/core/libimagrt/src/logger.rs index f7d09697..d8b6c781 100644 --- a/lib/core/libimagrt/src/logger.rs +++ b/lib/core/libimagrt/src/logger.rs @@ -174,28 +174,35 @@ impl Log for ImagLogger { self.module_settings .get(record_target) .map(|module_setting| { + // We have a module setting some + // * Check whether logging is enabled for this module and + // * check whether the module logging level is >= or, if there is no module logging + // level, + // * check whether the global logging level is >= the record level. let set = module_setting.enabled && module_setting.level.unwrap_or(self.global_loglevel) >= record.level(); - if set { + if set { // if we want to log from a setting standpoint + // get the destinations for the module and log to all of them module_setting.destinations.as_ref().map(|destinations| for d in destinations { - // If there's an error, we cannot do anything, can we? - let _ = log_to_destination(&d); + let _ = log_to_destination(&d); // ignore errors, because what else? }); + // after that, log to the global destinations as well for d in self.global_destinations.iter() { - // If there's an error, we cannot do anything, can we? - let _ = log_to_destination(&d); + let _ = log_to_destination(&d); // ignore errors, because what else? } } }) + + // if we do not have a setting for the record target .unwrap_or_else(|| { - if self.global_loglevel >= record.level() { - // Yes, we log - for d in self.global_destinations.iter() { - // If there's an error, we cannot do anything, can we? - let _ = log_to_destination(&d); - } + if self.global_loglevel >= record.level() { // if logging is enabled for that level + self.global_destinations + .iter() + .for_each(|d| { // log to all global destinations + let _ = log_to_destination(&d); // ignore errors, because what else? + }); } }); } @@ -287,14 +294,14 @@ fn translate_destinations(raw: &Vec) -> Result> { fn aggregate_global_destinations(matches: &ArgMatches, config: Option<&Value>) -> Result> { - + let config_log_dest_path = "imag.logging.destinations"; match config { Some(cfg) => cfg - .read("imag.logging.destinations")? + .read(&config_log_dest_path)? .ok_or_else(|| RE::from_kind(EK::GlobalDestinationConfigMissing))? .as_array() .ok_or_else(|| { - let path = "imag.logging.destinations".to_owned(); + let path = config_log_dest_path.to_owned(); let ty = "Array"; RE::from_kind(EK::ConfigTypeError(path, ty)) }) diff --git a/lib/core/libimagstore/src/storeid.rs b/lib/core/libimagstore/src/storeid.rs index 2f2bf723..0908a3b7 100644 --- a/lib/core/libimagstore/src/storeid.rs +++ b/lib/core/libimagstore/src/storeid.rs @@ -128,6 +128,18 @@ impl StoreId { .ok_or_else(|| SE::from_kind(SEK::StoreIdHandlingError)) } + /// Helper function for creating a displayable String from StoreId + /// + /// This is safe because the + /// + /// impl ToString for T + /// + /// does only fail if Display::display() failed. The implementation of ::std::path::Display and + /// the implementation ::std::fmt::Display for ::std::path::Display do not return errors though. + pub fn local_display_string(&self) -> String { + self.local().display().to_string() + } + /// Returns the components of the `id` part of the StoreId object. /// /// Can be used to check whether a StoreId points to an entry in a specific collection of diff --git a/scripts/which-commands-changed b/scripts/which-commands-changed index 62a48593..4a179633 100755 --- a/scripts/which-commands-changed +++ b/scripts/which-commands-changed @@ -2,11 +2,22 @@ # Find all imag commands which changed since last install -imag versions |\ -grep "imag-" |\ -sed 's,v.*-g,,' |\ +imag versions 2>&1 | \ +grep "imag-" | \ +sed 's,\ *->.*\ , ,' | \ while read binary hash; do - git diff "$hash..master" --name-only | \ - grep "$binary" >/dev/null 2>/dev/null && \ - echo "$binary changed since last install (was $hash)" + if [[ "$hash" =~ v.*\..*\..*- ]]; then + hash="$(echo "$hash" | sed 's,.*-g,,')" + fi + + log="$(git diff --name-only ${hash}..master 2>/dev/null)" + if [[ $? -eq 0 ]]; then + echo "$log" | \ + grep "$binary" >/dev/null 2>/dev/null && \ + echo -e "changed since last install ($hash): $binary" + else + echo "WARN: Could not check $binary because git hash '$hash' is not present" + fi + done +