Merge branch 'minor'
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
commit
e1aeb558dc
10 changed files with 79 additions and 53 deletions
10
.travis.yml
10
.travis.yml
|
@ -45,6 +45,16 @@ matrix:
|
||||||
script:
|
script:
|
||||||
- cargo build --all --all-features -j 1 || exit 1
|
- cargo build --all --all-features -j 1 || exit 1
|
||||||
- cargo test --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:
|
addons:
|
||||||
|
|
42
README.md
42
README.md
|
@ -2,12 +2,6 @@
|
||||||
|
|
||||||
`imag` is a commandline personal information management suite.
|
`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,
|
**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
|
but we do not consider anything stable or usable at this moment. Feel free to
|
||||||
play around anyways.**
|
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
|
guarantee that. I hope I can continue development of imag after that and I
|
||||||
certainly plan to do so.
|
certainly plan to do so.
|
||||||
|
|
||||||
But from May 2018 until early 2019, expect long response times on issues and
|
But from May 2018 until early 2019, expect long response times.
|
||||||
pull requests.
|
|
||||||
|
|
||||||
|
|
||||||
## Goal / What is imag?
|
## 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
|
All subdirectories prefixed with `"imag-"` are binaries and compiling them will
|
||||||
give you a commandline application.
|
give you a commandline application.
|
||||||
|
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|
||||||
We use `cargo` for building all crates in this repository.
|
We use `cargo` for building all crates in this repository.
|
||||||
Make sure to use a recent `cargo`, at least one with workspace support.
|
Make sure to use a recent `cargo`, at least one with workspace support.
|
||||||
Building all crates works with `cargo build --all`, building individual crates
|
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
|
### 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.
|
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-<modulename>` (if the
|
If you installed the module, you can either call `imag-<modulename>` (if the
|
||||||
install-directory is in your `$PATH`), or install the `imag` binary to call `imag
|
install-directory is in your `$PATH`), or install the `imag` binary to call
|
||||||
<modulename>` (also if everything is in your `$PATH`).
|
`imag <modulename>` (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
|
## Example usage
|
||||||
|
@ -97,7 +82,7 @@ imag contact create --file /home/user/contacts/private
|
||||||
# Add a diary entry
|
# Add a diary entry
|
||||||
imag diary -p private create
|
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
|
# 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
|
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"
|
imag notes create "pineapple"
|
||||||
|
|
||||||
# Where was that contact again?
|
# 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
|
# Okay, we need to add some imag-internal notes to that contact
|
||||||
imag grep Eva -l | imag edit -I
|
imag grep Eva -l | imag edit -I
|
||||||
|
|
||||||
|
@ -124,7 +109,7 @@ imag git commit -m 'Commit message'
|
||||||
## Staying up-to-date
|
## Staying up-to-date
|
||||||
|
|
||||||
We have a [official website for imag](https://imag-pim.org), where I post
|
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)).
|
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
|
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
|
## Documentation
|
||||||
|
|
||||||
We have some documentation in [the ./doc subtree](./doc/)
|
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.
|
It might not be up to date, though.
|
||||||
Developer documentation for the last release is available
|
Developer documentation for the last release is available
|
||||||
[on docs.rs](https://docs.rs/releases/search?query=imag).
|
[on docs.rs](https://docs.rs/releases/search?query=imag).
|
||||||
|
@ -143,8 +128,9 @@ Developer documentation for the last release is available
|
||||||
## Please contribute!
|
## Please contribute!
|
||||||
|
|
||||||
We are looking for contributors!
|
We are looking for contributors!
|
||||||
Feel free to open issues for asking questions, suggesting features or other
|
Feel free to open issues (by writing to
|
||||||
things!
|
[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)!
|
Also have a look at [the CONTRIBUTING.md file](./CONTRIBUTING.md)!
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ fn main() {
|
||||||
let version = make_imag_version!();
|
let version = make_imag_version!();
|
||||||
let rt = generate_runtime_setup("imag-ids",
|
let rt = generate_runtime_setup("imag-ids",
|
||||||
&version,
|
&version,
|
||||||
"print all ids",
|
"Print all ids, optionally filtered with a user-defined filter",
|
||||||
build_ui);
|
build_ui);
|
||||||
|
|
||||||
let print_storepath = rt.cli().is_present("print-storepath");
|
let print_storepath = rt.cli().is_present("print-storepath");
|
||||||
|
|
|
@ -80,7 +80,7 @@ fn main() {
|
||||||
let version = make_imag_version!();
|
let version = make_imag_version!();
|
||||||
let rt = generate_runtime_setup("imag-link",
|
let rt = generate_runtime_setup("imag-link",
|
||||||
&version,
|
&version,
|
||||||
"Link entries",
|
"Add/Remove links between entries",
|
||||||
build_ui);
|
build_ui);
|
||||||
if rt.cli().is_present("check-consistency") {
|
if rt.cli().is_present("check-consistency") {
|
||||||
let exit_code = match rt.store().check_link_consistency() {
|
let exit_code = match rt.store().check_link_consistency() {
|
||||||
|
|
|
@ -80,7 +80,7 @@ fn main() {
|
||||||
let version = make_imag_version!();
|
let version = make_imag_version!();
|
||||||
let rt = generate_runtime_setup("imag-tag",
|
let rt = generate_runtime_setup("imag-tag",
|
||||||
&version,
|
&version,
|
||||||
"Direct interface to the store. Use with great care!",
|
"Add and remove tags for entries",
|
||||||
build_ui);
|
build_ui);
|
||||||
|
|
||||||
let ids : Vec<PathBuf> = rt
|
let ids : Vec<PathBuf> = rt
|
||||||
|
|
|
@ -91,7 +91,7 @@ fn help_text(cmds: Vec<String>) -> String {
|
||||||
Call a command with 'imag <command> <args>'
|
Call a command with 'imag <command> <args>'
|
||||||
Each command can be called with "--help" to get the respective helptext.
|
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.
|
follow the development of imag or maybe even contribute to imag.
|
||||||
|
|
||||||
imag is free software. It is released under the terms of LGPLv2.1
|
imag is free software. It is released under the terms of LGPLv2.1
|
||||||
|
|
|
@ -48,7 +48,7 @@ fn main() {
|
||||||
let version = make_imag_version!();
|
let version = make_imag_version!();
|
||||||
let rt = generate_runtime_setup("imag-wiki",
|
let rt = generate_runtime_setup("imag-wiki",
|
||||||
&version,
|
&version,
|
||||||
"Personal wiki",
|
"Manage a personal Wiki",
|
||||||
build_ui);
|
build_ui);
|
||||||
|
|
||||||
let wiki_name = rt.cli().value_of("wikiname").unwrap_or("default");
|
let wiki_name = rt.cli().value_of("wikiname").unwrap_or("default");
|
||||||
|
|
|
@ -174,28 +174,35 @@ impl Log for ImagLogger {
|
||||||
self.module_settings
|
self.module_settings
|
||||||
.get(record_target)
|
.get(record_target)
|
||||||
.map(|module_setting| {
|
.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 &&
|
let set = module_setting.enabled &&
|
||||||
module_setting.level.unwrap_or(self.global_loglevel) >= record.level();
|
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 {
|
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); // ignore errors, because what else?
|
||||||
let _ = log_to_destination(&d);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// after that, log to the global destinations as well
|
||||||
for d in self.global_destinations.iter() {
|
for d in self.global_destinations.iter() {
|
||||||
// If there's an error, we cannot do anything, can we?
|
let _ = log_to_destination(&d); // ignore errors, because what else?
|
||||||
let _ = log_to_destination(&d);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// if we do not have a setting for the record target
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
if self.global_loglevel >= record.level() {
|
if self.global_loglevel >= record.level() { // if logging is enabled for that level
|
||||||
// Yes, we log
|
self.global_destinations
|
||||||
for d in self.global_destinations.iter() {
|
.iter()
|
||||||
// If there's an error, we cannot do anything, can we?
|
.for_each(|d| { // log to all global destinations
|
||||||
let _ = log_to_destination(&d);
|
let _ = log_to_destination(&d); // ignore errors, because what else?
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -287,14 +294,14 @@ fn translate_destinations(raw: &Vec<Value>) -> Result<Vec<LogDestination>> {
|
||||||
fn aggregate_global_destinations(matches: &ArgMatches, config: Option<&Value>)
|
fn aggregate_global_destinations(matches: &ArgMatches, config: Option<&Value>)
|
||||||
-> Result<Vec<LogDestination>>
|
-> Result<Vec<LogDestination>>
|
||||||
{
|
{
|
||||||
|
let config_log_dest_path = "imag.logging.destinations";
|
||||||
match config {
|
match config {
|
||||||
Some(cfg) => cfg
|
Some(cfg) => cfg
|
||||||
.read("imag.logging.destinations")?
|
.read(&config_log_dest_path)?
|
||||||
.ok_or_else(|| RE::from_kind(EK::GlobalDestinationConfigMissing))?
|
.ok_or_else(|| RE::from_kind(EK::GlobalDestinationConfigMissing))?
|
||||||
.as_array()
|
.as_array()
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
let path = "imag.logging.destinations".to_owned();
|
let path = config_log_dest_path.to_owned();
|
||||||
let ty = "Array";
|
let ty = "Array";
|
||||||
RE::from_kind(EK::ConfigTypeError(path, ty))
|
RE::from_kind(EK::ConfigTypeError(path, ty))
|
||||||
})
|
})
|
||||||
|
|
|
@ -128,6 +128,18 @@ impl StoreId {
|
||||||
.ok_or_else(|| SE::from_kind(SEK::StoreIdHandlingError))
|
.ok_or_else(|| SE::from_kind(SEK::StoreIdHandlingError))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Helper function for creating a displayable String from StoreId
|
||||||
|
///
|
||||||
|
/// This is safe because the
|
||||||
|
///
|
||||||
|
/// impl<T: fmt::Display + ?Sized> 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.
|
/// 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
|
/// Can be used to check whether a StoreId points to an entry in a specific collection of
|
||||||
|
|
|
@ -2,11 +2,22 @@
|
||||||
|
|
||||||
# Find all imag commands which changed since last install
|
# Find all imag commands which changed since last install
|
||||||
|
|
||||||
imag versions |\
|
imag versions 2>&1 | \
|
||||||
grep "imag-" |\
|
grep "imag-" | \
|
||||||
sed 's,v.*-g,,' |\
|
sed 's,\ *->.*\ , ,' | \
|
||||||
while read binary hash; do
|
while read binary hash; do
|
||||||
git diff "$hash..master" --name-only | \
|
if [[ "$hash" =~ v.*\..*\..*- ]]; then
|
||||||
grep "$binary" >/dev/null 2>/dev/null && \
|
hash="$(echo "$hash" | sed 's,.*-g,,')"
|
||||||
echo "$binary changed since last install (was $hash)"
|
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
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue