From 6dd96f0581e9f2521d6f92f3712bad8adfac0b18 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 4 May 2018 15:07:05 +0200 Subject: Add post: imag 0.8.0 --- content/blog/2018-05-09-imag-0-8-0.md | 116 ++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 content/blog/2018-05-09-imag-0-8-0.md diff --git a/content/blog/2018-05-09-imag-0-8-0.md b/content/blog/2018-05-09-imag-0-8-0.md new file mode 100644 index 0000000..5403f5c --- /dev/null +++ b/content/blog/2018-05-09-imag-0-8-0.md @@ -0,0 +1,116 @@ +--- +title: "imag 0.8.0" +slug: "imag-0-8-0" +date: "2018-05-09T11:42:06" +tags: [ "linux", " open source", " programming", " rust", " software", " tools", " imag" ] +--- + + + +That release was a bit fast after the 0.7.0 release, but I wanted to get out +another release before my departure. + +I already anounced it in the last +["What's coming up in imag" (36) blog post](/blog/2018/05/06/whats-coming-up-in-imag-36/) + - I will be on a sabatical from May 2018 until early 2019. I won't be able to +develop imag during that time, unfortunately. + +This does not mean that the imag project is "dead". I will continue developing +it and will most certainly continue developing it when I'm back. + +But what it does mean is that developing will slow down significantly. I don't +know how much I will be able to hack on it or whether I will have access to the +internet (or whether I will have time, as I will hopefully go hiking a lot). And +there won't be any releases until early 2019, as I simply do not have the +computing power to do a full release (my ThinkPad takes simply too long to +compile the complete codebase). I will be mostly "off the grid" and may respond +slowly to issues and pull requests. + + +# What's in there + +* 197 commits +* 45 merge-commits / 152 non-merge commits +* 202 files changed +* 4294 insertions(+), 2850 deletions(-) + +Some more statistics about the codebase (thank you, +[tokei](https://github.com/Aaronepower/tokei)), because why not: + +``` +------------------------------------------------------------------------------- + Language Files Lines Code Comments Blanks +------------------------------------------------------------------------------- + BASH 7 126 78 16 32 + CSS 1 27 24 0 3 + Makefile 1 161 97 29 35 + Markdown 99 4038 4038 0 0 + Nix 2 98 77 0 21 + Rust 283 34155 22239 6656 5260 + Shell 14 604 349 150 105 + TOML 60 3085 2064 417 604 +------------------------------------------------------------------------------- + Total 467 42294 28966 7268 6060 +------------------------------------------------------------------------------- +``` + + +# What changed + +In the following sections I will explain what changed for _users_. +For a complete list of changes (also library-wise), have a look at the +[CHANGELOG file in the repository](http://git.imag-pim.org/imag/tree/doc/src/09020-changelog.md). + +The changelog format has changed a bit, as we switched to use git-notes for +changelog recording after the 0.7.0 release. So the changelog is more verbose +now. + + +## New tools + +* `imag-git`, a lightweight wrapper for calling `git` in the ~/.imag directory + or in the ~/.imag/store directory. +* `imag-category` was added, for adding a category to entries (and linking to + the category-representing entry automatically). + + +## New features + +* `imag-diary` is now able to list existing diaries +* `imag-view` can now wrap lines +* `imag-view` can format markdown nicely for the terminal now +* `libimagcontact` is not based on `libimagentryref` anymore, which gives us + way more flexibility for contact handling. This does mean that the format + how contacts are stored has now changed and `imag-contact` is not backwards + compatible to the 0.7.0 version! +* `imag-view` is now able to seperate multiple entries via a custom seperator + line +* `libimagcontact` and `imag-contact` handle email properties now, which is + useful for passing contact data to external tools such as mutt. +* `libimagentrygps` and `imag-gps` work with 64bit values now. +* `imag-diary` git the `edit` command removed - use `imag-edit` instead. +* `imag-ids` got a filter functionality with a custom filter language. This + language may change in the future, it's a proof of concept right now and may + be the step-stone for a more general and elaborate filter + functionality/language. + + +# What's coming + +The +[0.9.0 milestone](https://github.com/matthiasbeyer/imag/milestone/9) +already exists and there are a lot of things already added to it. + +As expressed before, I will be on a sabatical from May 2018 until early 2019 +and thus the development speed of imag will decrease significantly during that +time. + +I hope you stay tuned until 2019. I hope I can maintain the repository from +wherever I may be during that time. As there are only a few contributions by +now - and I don't expect that number to increase that dramatically - I hope +for the best. + +Have a nice summer, you all! Maybe we see eachother on Portland Rust Conf in +August (if I can make it)! + + -- cgit v1.2.3 From c306324dff92f9c7bf4fef9a2323a3f941f28240 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 8 May 2018 21:22:29 +0200 Subject: Add documentation files --- content/doc.md | 5 +- content/doc/pdf/0.8.0.pdf | Bin 0 -> 220907 bytes content/doc/web/0.8.0/index.html | 1172 ++++++++++++++++++++++++++++++++++++++ content/releases.md | 13 + 4 files changed, 1189 insertions(+), 1 deletion(-) create mode 100644 content/doc/pdf/0.8.0.pdf create mode 100644 content/doc/web/0.8.0/index.html diff --git a/content/doc.md b/content/doc.md index 612da2a..0101a08 100644 --- a/content/doc.md +++ b/content/doc.md @@ -3,12 +3,15 @@ title: imag - User and developer documentation --- The imag documentation is only published for releases, whereas the -v0.7.0 +v0.8.0 is the latest release for which documentation is published. The source-documentation is hosted with [docs.rs](https://docs.rs/releases/search?query=imag). +* v0.8.0 + * [pdf](/doc/pdf/0.8.0.pdf) + * [html](/doc/web/0.8.0/) * v0.7.0 * [pdf](/doc/pdf/0.7.0.pdf) * [html](/doc/web/0.7.0/) diff --git a/content/doc/pdf/0.8.0.pdf b/content/doc/pdf/0.8.0.pdf new file mode 100644 index 0000000..2114a35 Binary files /dev/null and b/content/doc/pdf/0.8.0.pdf differ diff --git a/content/doc/web/0.8.0/index.html b/content/doc/web/0.8.0/index.html new file mode 100644 index 0000000..f95e0c9 --- /dev/null +++ b/content/doc/web/0.8.0/index.html @@ -0,0 +1,1172 @@ + + + + + + + + + + imag User Documentation + + + + + + + + + +
+

imag User Documentation

+ May 2018 + + Version: 0.8.0 +
+
+ +

Introduction

+

This document is the user documentation for imag, the personal information management suite for the commandline. Besides being a documentation, it serves also as “roadmap” where this project should go.

+

Basically: This is Hobby stuff. Expect incompleteness, false statements and generally read with big grain of salt.

+

If you have any objections, suggestions for improvements, bugs, etc, please file them. A way to reach out to the imag project maintainer(s) is described in the CONTRIBUTING file of the repository or in this document, in the appropriate section.

+

The Problem

+

The problem this project tries to solve is to provide a modular commandline application for personal information management.

+

It targets “power users” or “commandline users”, uses plain text as a storage format and tries to be scriptable. imag offers the ability to link data from different “PIM aspects” (such as “diary” and “bookmark” for example).

+

One major goal of imag is to make the PIM data traverseable and queryable. For example: a wiki article can be linked to an appointment which is linked to a todo which is linked to a note which is linked to a contact.

+

imag wants to offer an all-in-one scriptable modular commandline personal information management suite for all PIM aspects one can think of. Because imag uses plain text (TOML headers for structured data and plain text which can be rendered using markdown, for example, for continuous text) the user is always able to access their data without the imag tools at hand.

+

The Approach

+

The approach “imag” takes on solving this problem is to store content in a “store” and persisting content in a unified way. Meta-information is attached to the content which can be used to store structured data. This can be used to implement a variety of “domain modules” using the store. While content is stored in one place, imag does not duplicate content. imag does not copy or move icalendar files, emails, vcard files, music or movies to the store, but creates references to the actual files and stores meta-information in the store.

+

Detailed explanation on this approach follows in the chapters of this work.

+

Implementation

+

The program is written in the Rust programming language.

+

The program consists of libraries which can be re-used by other projects to implement and adapt imag functionality. An external program may use a library of the imag distribution to store content in the store of imag and make it visible to imag this way.

+

This is a technical detail a user does not necessarily need to know, but as imag is intended for power-users anyways, we could say it fits here.

+

Alternative Projects

+

imag is not the only project which tries to solve that particular problem. For example there is org mode for the emacs text editor. There is also zim, a desktop wiki editor which is intended to be used for a personal wiki.

+

The difference between imag and the mentioned projects is that imag is not there yet. Some parts can be used, though it is far away from being feature-complete.

+

Architecture of the imag code

+

The imag codebase has a rather simple overall architecture. In this chapter the types of crates, architecture of an imag module and the type structure are described.

+

Crate types

+

There are different types of crates in the imag world. A crate is a rust project.

+

First of all, there are core crates. These crates provide the very core of imag and almost all other crates use them:

+ +

The next type of imag crates are entry extension libraries. Those provide extensional functionality for the types from libimagstore. For example, there is “libimagentrylink” which provides functionality to link two entries in the store.

+

The third kind of crate is the one that offers end-user functionality for a imag domain, for example “libimagtodo” provides functionality to track todos.

+

And last, but not least, the commandline frontend crates provide the user interface. These are the kind of crates that are not library crates, but binaries.

+

Besides these, there are some other utility crates.

+

Architecture of an imag module

+

With the things from above, a module could have the following architecture:

+
+---------------------------------------------+
+        |  imag-foo                                   |
+        +-----------------------------------+---------+
+        |  libimagfoo                       |         |
+        +-----------------+-----------------+         |
+        |                 |                 |         |
+        | libimagentrybar | libimagentrybaz |         |
+        |                 |                 |   lib   |
+        +-----------------+-----------------+         |
+        |                                   |         |
+        |  ...                              |         |
+        |                                   |   imag  |
+        +-----------------------------------+         |
+        |                                   |         |
+        | libimagrt                         |         |
+        |                                   |  error  |
+        +-----------------------------------+         |
+        |                                   |         |
+        | libimagstore                      |         |
+        |                                   |         |
+        +-----------------------------------+---------+
+

The foundation of all imag modules is the store, as one can see in the visualization from above. Above the store library there is the libimagrt, which provides the basic runtime and access to the Store object. Cross-cutting, there is the error library (and possibly the util library, but we do not care about this one here), which is used through all levels. The highest level of all imag modules is the commandline interface on top of the domain library. In between can be any number of entry extension libraries, or none if not needed.

+

Theoretically, the commandline interface crate could be replaced to build a terminal user interface, graphical user interface or web interface.

+

Types

+

The imag core, hence the libimagstore, libimagrt and libimagerror, provide a set of types that a user (as in a library writer) should be aware of.

+

First of all, there is the Runtime type which is provided by the libimagrt. It provides basic access to whether debugging or verbosity is enabled as well as the most important core object: The Store.

+

The Store type is provided by the libimagstore library, the heart of everything.

+

When interacting with the store, two types are visible: FileLockEntry and Entry whereas the former derefs to the latter, which basically means that the former wraps the latter. The FileLockEntry is a necessary wrapper for ensuring that when working concurrently with the store, an entry is only borrowed once from the store. It also ensures that the object is alive as long as the store is.

+

The Entry type provides functionality like reading the actual content, its header and so on. Extensions for its functionality are implemented on this type, not on the FileLockEntry.

+

The Entry provides access to its header, which is a toml::Value, where toml is the toml-rs crate (external project). Convenience functionality is provided via the toml-query crate, which is an external project which was initiated and extracted from the imag project.

+

Error types are also important. All errors in imag projects should be created with error-chain. libimagerror provides functionality to enhance the experience with Result types and general tracing of errors.

+

The Store

+

The store is where all the good things happen. The store is basically just a directory on the filesystem imag manages and keeps its state in.

+

One could say that the store is simply a database, and it really is. We opted to go for plain text, though, as we believe that plain text is the only sane way to do such a thing, especially because the amount of data which is to be expected in this domain is in the lower Megabytes range and even if it is really much won’t exceed the Gigabytes ever.

+

Having a storage format which is plain-text based is the superior approach, as text editors will always be there.

+

A user should always be able to read her data without great effort and putting everything in a real database like sqlite or even postgresql would need a user to install additional software just to read his own data. We don’t want that. Text is readable until the worlds end and we think it is therefore better to store the data in plain text.

+

The following sections describe the store and the file format we use to store data. One may skip the following sections, they are included for users who want to dig into the store with their editors.

+

File Format

+

The contents of the store are encoded in UTF-8. A normal text editor (like vim or the other one) will always be sufficient to dig into the store and modify files. For simple viewing even a pager (like less) is sufficient.

+

Each entry in the store consists of two parts:

+
    +
  1. Header
  2. +
  3. Content
  4. +
+

The following section describe their purpose.

+

Header Format

+

The header format is where imag stores its data. The header is an area at the top of every file which is seperated from the content part by three dashes (---). Between these three dashes there is structured data. imag uses TOML as data format for this structured data, because it fits best and the available TOML parser for the rust programming language is really good.

+

The header can contain any amount of data, but modules (see Section 6) are restricted in their way of altering the data.

+

So normally there are several sections in the header. One section ([imag]) is always present. It contains a version field, which tells imag which version this file was created with.

+

Other sections are named like the modules which created them. Every module is allowed to store arbitrary data under its own section and a module may never read other sections than its own.

+

These conventions are not enforced by imag itself, though.

+

Content Format

+

The content is the part of the file where the user is free to enter any textual content. The content may be rendered as Markdown or other markup format for the users convenience. The store does never expect and specific markup and actually the markup implementation is not inside the very core of imag.

+

Technically it would be possible that the content part of a file is used to store binary data. We don’t want this, though, as it is contrary to the goals of imag.

+

Example

+

An example for a file in the store follows.

+

+        ---
+        [imag]
+        version = "0.8.0"
+        
+        [note]
+        name = "foo"
+        
+        [link]
+        internal = ["some/other/imag/entry"]
+        ---
+        
+        This is an example text, written by the user.
+        
+

File organization

+

The “Entries” are stored as files in the “Store”, which is a directory the user has access to. The store may exist in the users Home-directory or any other directory the user has read-write-access to.

+

Each module stores its data in an own subdirectory in the store. This is because we like to keep things ordered and clean, not because it is technically necessary.

+

We name the path to a file in the store “Store id” or “Storepath” and we often refer to it by using the store location as root. So if the store exists in /home/user/store/, a file with the storepath /example.file is (on the filesystem) located at /home/user/store/example.file.

+

By convention, each libimagentry<name> and libimag<name> module stores its entries in in /<name>/.

+

So, the pattern for the storepath is

+
/<module name>/<optional sub-folders>/<file name>
+

Any number of subdirectories may be used, so creating folder hierarchies is possible and valid. A file “example” for a module “module” could be stored in sub-folders like this:

+
/module/some/sub/folder/example
+

Backends

+

The store itself also has a backend. This backend is the “filesystem abstraction” code.

+

Note: This is a very core thing. Casual users might want to skip this section.

+

Problem

+

First, we had a compiletime backend for the store. This means that the actual filesystem operations were compiled into the store either as real filesystem operations (in a normal debug or release build) but as a in-memory variant in the ‘test’ case. So tests did not hit the filesystem when running. This gave us us the possibility to run tests concurrently with multiple stores that did not interfere with each other.

+

This approach worked perfectly well until we started to test not the store itself but crates that depend on the store implementation. When running tests in a crate that depends on the store, the store itself was compiled with the filesystem-hitting-backend. This was problematic, as tests could not be implemented without hitting the filesystem and mess up other currently-running tests.

+

Hence we implemented store backends.

+

Implementation

+

The filesystem is abstracted via a trait FileAbstraction which contains the essential functions for working with the filesystem.

+

Two implementations are provided in the code:

+ +

whereas the first actually works with the filesystem and the latter works with an in-memory HashMap that is used as filesystem.

+

Further, the trait FileAbstractionInstance was introduced for functions which are executed on actual instances of content from the filesystem, which was previousely tied into the general abstraction mechanism.

+

So, the FileAbstraction trait is for working with the filesystem, the FileAbstractionInstance trait is for working with instances of content from the filesystem (speak: actual Files).

+

In case of the FSFileAbstractionInstance, which is the implementation of the FileAbstractionInstance for the actual filesystem-hitting code, the underlying resource is managed like with the old code before. The InMemoryFileAbstractionInstance implementation is corrosponding to the InMemoryFileAbstraction implementation - for the in-memory “filesystem”.

+

Conventions, best practices

+

This section explains conventions used in the imag codebase. It is mainly focused on developers, but a user may read it for getting to know how imag works.

+

Lets work our way up from the store and how to extend it to the commandline user interface.

+

Versioning

+

All imag crates are versioned with the same version number until we reach some "1.0.0" version. This means that all imag tools are only tested for compatibility with libraries and such if their version numbers match. It might not be possible to import one imag library in version 0.3.0 and another one in 0.4.0 and make them work together. It also means that if new tools are introduced into the imag codebase, they might start with their first version not at 0.1.0 but at something like 0.5.0.

+

Store and Entry functionality

+

A Entry does not offer much functionality by itself. So its the job of libraries to extend its functionality. This should never be done by wrapping the Entry type itself but by providing and implementing an extension trait on it.

+

Same goes for extending the Store type: never wrap it, always provide an extension trait for it.

+

These two rules ensure that the type does not lose any functionality from a wrapping. Deref could do that, but not over muliple levels, so extension traits it is. It also most likely results in functions inside the extension trait which all return a Result<_, _>.

+

Libraries

+

In the next few sections, conventions and best practices for writing a imag library are written down.

+

A developer of imag should read this carefully, a user may skip this section or cross-read it for better understanding of the imag project.

+

Library naming

+

Libraries which provide functionality for entries or the store (most likely entries or both) should be named “libimagentrything” whereas “thing” stands for what the library provides.

+

All other libraries should be prefixed with “libimag” at least. Most likely, one will not write such a library but rather a “libimagentrything” library.

+

Library scope

+

A library should never introduce utility functionality which could be useful for other libraries as well. If there is no such functionality available, the “libimagutil” or “libimagentryutil” might be a place where such a function would be put.

+

If a library has to introduce free functions in its public interface, one should think hard whether this is really necessary.

+

Library error types/kinds

+

Libraries must use “error-chain” to create error types and kinds. Most likely, a library needs some kinds for wrapping the errors from underlying libraries, such as the store itself.

+

A library must never introduce multiple error types, but is free to introduce as many error kinds as required.

+

Libraries with commandline frontends

+

Libraries with commandline frontends provide end-user functionality. Normally, they depend on one or more “libimagentrything” libraries. They should be named “libimagthing”, though. For example: “libimagdiary”, “libimagtimetrack” or “libimagwiki”, whereas the commandline frontends would be “imag-diary”, “imag-timetrack” and “imag-wiki”, respectively.

+

If such a library needs to depend on another “libimagthing”, for example if “libimagdiary” needs to depend on “libimagnote”, one should think about this and whether the functionality could be outsourced to a more general “libimagentrything”.

+

A library which implements a functionality for imag may contain helper functions for commandline stuff, but that is discouraged.

+

Library testing

+

All libraries should be tested as much as possible. Sometimes it may not be possible without a lot of effort, but still: more tests = better!

+

Commandline tools

+

The commandline tools are the CLI-frontends for their respective libraries. So libimagdiary has a CLI frontend imag-diary.

+

Those CLI frontends use functionality from libimagrt to build a consistent commandline interface.

+

Writing an imag module

+

So you want to write a module for imag. That’s nice.

+

This guide helps you getting started. It also can help you understanding how imag modules work, so even if you do not want to write a full new module, but extend or alter one, this guide may help you.

+

Data layout

+

First, you have to think about what data you want to store. What functionality do you want to provide and what data that creates.

+

In this example, we’re writing a module that stores numbers. We’re writing the appropriate library for that as well as a commandline frontend.

+

libimagnumberstorage

+

We’re writing a libimagnumberstorage which provides the core functionality of our module: Storing numbers.

+

That library can then be used by other library authors and by the commandline interface implementation.

+

Setup

+

So what do we need to do to write this library:

+
    +
  1. Create a new “lib” crate. Because we’re writing a “domain” library, we’re doing this in the lib/domain subdirectory: cd lib/domain; cargo new --lib libimagnumberstorage.
  2. +
  3. After creating the library, we have to add the new library to the /Cargo.toml field and add the missing metadata in the new /lib/domain/libimagnumberstorage/Cargo.toml file.
  4. +
+

That was the setup part. Now we can implement our functionality. For that, we need to extend two types from libimagstore, so we have our first dependency here.

+

Dependencies to other libraries

+
    +
  1. Put libimagstore as a dependency in the /lib/domain/libimagnumberstorage/Cargo.toml file. By using libimagstore = { version = "0.8.0", path = "../../../lib/core/libimagstore" } we automatically get all the goodness of Cargo, so that releases automagically work as expected, but when developing locally, the local version of libimagstore is used. Of course, the version has to be the latest released version.
  2. +
  3. For error handling, we also need to import libimagerror.
  4. +
  5. For easy header-editing, we import toml and toml-query.
  6. +
  7. For error-type creating, we import error-chain.
  8. +
+

Interface

+
    +
  1. Then, we have to extend two types: +
      +
    1. libimagstore::store::Store has to be extended so we can implement a CRUD interface for our special entries.
    2. +
    3. libimagstore::store::Entry has to be extended so we can get our stored numbers in a convenient way.
    4. +
  2. +
+

Our interface should roughly look like this:

+
store.get_stored_number("5") -> Result<FileLockEntry, _>
+        store.store_number("5")      -> Result<FileLockEntry, _>
+        store.delete_number("5")     -> Result<(), _>
+

You notice that the Store returns FileLockEntry objects rather than Entry objects. And that’s ok. A FileLockEntry is a Entry, but ensures that we are the only ones editing that entry. So, we have to implement our number-storing-interface on Entry as well:

+
entry.get_number() -> Result<usize>
+        entry.set_number(usize) -> Result<()>
+

All those “extensions” are implemented as traits which are then implemented for Store and Entry.

+

Normally, we create new files for that, as well as for the error types we need:

+ +

where store.rs contains a trait NumberStorage and entry.rs contains a trait NumberEntry. error.rs contains the invocation of the error_chain!{} macro. Error types from libimagstore and others are linked in.

+

Modules

+

A module is a functionality of the program. There is a huge list of modules available in the imag core distribution.

+

Some of the modules shipped with imag cover core functionality such as linking, tagging or references to files outside of the store or even the store interface itself. Others cover things like diary, notes, wiki or bookmarks. These are also called “domains”.

+

We try really hard to offer a consistent commandline user interface over all of these modules.

+

The following sections describe each module in detail, including its purpose and its provided functionality.

+

Bookmarks

+

The Bookmarks module is for keeping URLs as bookmarks, tagging and categorizing them and finally also open them in the browser.

+

Category

+

A tool to create categories and set/get them for entries.

+

The difference between a category and a tag is that a category must exist before it can be used and all entries of a category are linked to the “category entry” internally.

+

Diary

+

The diary module is for keeping your diary notes.

+

The diary module giv3s you the possibility to write your diary in imag. It offers daily, hourly and minutely entries (the latter beeing more like a private tumble-blog).

+

Exporting the diary is possible, so one can write it in markdown and later pass that to pandoc, if desired, to generate a website or book from it.

+

Edit

+

The imag-edit command is for simply editing store entries with the $EDITOR.

+

It is based on libimagentryedit (Section 7.7).

+

Init

+

This is the only imag-* command which does not set up a runtime and check whether the store is available. This command can be used to set up a imag store.

+

It also puts a default configuration in the right place and initializes a git repository, if there is a git command in $PATH (via calling git on the commandline, not via libgit2 or some other library).

+ +

The linking module imag-link is one of the plumbing modules. It offers the possibility to link entries in the store.

+

It also offers the functionality to link to external sources. This functionality can be used to link to external URLs, but the bookmarking module should be used to do this (see Section 6.1).

+

The linking module offers functionality to add, remove and list both internal (store entry to store entry) and external (store entry to URL) links.

+

Internal linking

+ +

External linking

+

A store entry can only have one external link. Therefor, when you create an external link, the linking module creates a new entry in the store which links to this URL. The linking module then links you entry with this new entry by using an internal link. This way one entry can have multiple external links attached to it and external links are deduplicated automatically.

+

Log

+

The “imag-log” module is a lightweight interface to the “imag-diary” command.

+

It is intended as a tumbeblog-like diary, where one does not care to fire up an editor and type in a long text, but rather type a few words and forget about it:

+

Usage

+

Logs can be created via an entry in the configuration file in the section log:

+
[log]
+        logs = ["work", "hobby", "music"]
+        default = "hobby"
+

The default key is required and the name which is used here must appear in the logs array.

+

In the above configuration snippet, the logs work, hobby and music are created. The user may now log to one of these logs with:

+
imag log --to <logname> "Some message"
+        # or
+        imag log -t <logname> "Some message"
+        # or, to the default log:
+        imag log "Some message"
+

Logs can be read by naming the log:

+
imag log show work
+

which prints one log per line (including time it was logged).

+

Mails

+

The Mails module implements a commandline email client. Emails can be written (via $EDITOR) and viewed, also in threads. Emails can be crawled for creating new contacts.

+

A Text User Interface is not planned, but might be there at some point.

+

The mail module implements a minimal Email client. It does not handle IMAP syncing or SMTP things, it is just a viewer for emails (a MUA).

+

The goal of the initial implementation is only a CLI, not a TUI like mutt offers, for example (but that might be implemented later). As this is an imag module, it also creates references to mails inside the imag store which can be used by other tools then (for example imag-link to link an entry with a mail - or the imag entry representing that mail).

+

So this module offers functionality to read (Maildir) mailboxes, search for and list mails and mail-threads and reply to mails (by spawning the $EDITOR).

+

Outgoing mails are pushed to a special directory and can later on be send via imag-mail which calls a MTA (for example msmtp) and also creates store entries for the outgoing mails.

+

CLI

+

The CLI of the imag-mail module is planned as follows:

+
imag mail track <path> [opts...]  # track a new mail, mail file passed as path
+        imag mail scan <path> [opts...]   # scan a maildir and track all untracked mails
+        imag mail box <name|path>         # work with the mailbox specified by <name|path>, name mappings from config
+        imag mail list <args...>          # list mails in a given mailbox for a given account or the default account
+        imag mail show <args...>          # open new mails in the pager
+        imag mail thread list <args...>   # list mails from a thread
+        imag mail thread show <args...>   # open new mails from a thread in the pager or call a script with them
+        imag mail new <args...>           # craft a new mail and safe it in the <outgoing> folder
+        imag mail send <args...>          # send emails from the outgoing folder, optionally also move them to archice boxes
+        imag mail mv <srcbox> <dstbox>    # move a mail (or thread) from one mailbox to another
+

Notes

+

The Notes module is intended to keep notes. These notes can be inserted as plain text, markdown or other markup languages.

+

The notes module offers:

+ +

Reference

+

The Reference module.

+

Store

+

The Store module.

+

Tagging

+

The Tagging module.

+

A valid tag matches the regex [a-zA-Z][0-9a-zA-Z]*.

+

Timetrack

+

The Timetrack module implements a timewarrior-like timetracking functionality for imag.

+

Each timetracking is a ‘tag’ which can be started and stopped. These tags are no tags as in imag-tag, but timetracking-tags.

+

Summaries can be printed, also filtered by tags if desired.

+

Todo

+

The Todo module implements taskwarrior functionality by integrating taskwarrior itself into imag.

+

Each taskwarrior task s referenced from imag and represented as imag entry, thus making it linkable by other imag entries.

+

View

+

The View module.

+

Wiki

+

The Wiki module provides a personal wiki implementation.

+

The wiki entries are markdown-formatted files in the imag store. All entries are automatically searched for links and those links are automatically added to the header (or as external link, depending on the format).

+

Wiki entries can have no or one category and a arbitrary number of tags. Entries can be listed (as a “tree” shape) and filtered by content, category and tag.

+

Libraries

+

This section of the documentation is only relevant for developers and you might skip it if you’re only a user of the imag tool.

+

The following sections contain a short documentation on what the several libraries are supposed to do. It is generated from the README.md files of each library and only gives a general overview what can be done with the library. For a more comprehensive documentation of the library, one might consult the appropriate documentation generated from the source of the library itself.

+

The documentation of the libraries is sorted alphabetically.

+

libimagbookmark

+

This library crate implements functionality for bookmarks.

+

It uses libimagentrylink to create external links and therefor deduplicates equivalent external links (libimagentrylink deduplicates - you cannot store two different store entries for https://imag-pim.org in the store).

+

It supports bookmark collections and all basic functionality that one might need.

+

libimagcontacts

+

The contact library basically only creates references to the actual vcard files, though it also can parse (via the vobject crate) the information and return it from an entry directly.

+

The architecture of indirections is as follows:

+ +

As the library is build upon libimagentryref, it does not create a new subcollection in the store /contacts, but uses the infrastructure of libimagentryref which automatically puts all references in /ref.

+

libimagdiary

+

This library crates implements a full diary.

+

One can have one or more diaries in the store, each diary can have unlimited entries.

+

Future plans

+

The diary should be able to provide daily, hourly and even minutely diary entries, so one can use the diary as normal “Dear diary, today…”-diary, or more fine-grained and more like a journal.

+

The internal file format as well as the store-path generation for this module is prepared for such functionality.

+

libimagentryannotation

+

This library provides annotation functionality for entries.

+

Annotations are normal Store entries, but their header at annotation.is_annotation is set to true.

+

Annotations are linked to an entry (as in libimagentrylink).

+

Library functionality

+

The library features two traits: One to extend an Entry with annotation functionality and another one for extending the Store with functionality to get annotations of an entry and all annotations in the store.

+

libimagentrycategory

+

This library provides category functionality for entries.

+

libimagentrydatetime

+

Provides date/time functionality for entries.

+

libimagentryedit

+

Provides edit (as in spawning an $EDITOR) functionality for entries.

+

libimagentryfilter

+

Helper library to filter lists of entries by certain predicated. Offers filters for filtering by header values and other predicates, plus this library offers logical operants to combine filters.

+

A commandline-to-filter DSL is planned for this, so commandline applications can use this to implement a uniform filter interface.

+ +

Linking library for linking entries with other entries. Used for “imag-link”, the commandline utility, but intended for use in other binaries and libraries as well.

+

libimagentrymarkdown

+

Helper crate to add useful functionality in a wrapper around hoedown for imag.

+

Adds functionality to extract links, parse content into HTML and other things which might be useful for markdown rendering in imag.

+

libimagentryref

+

This library crate contains functionality to generate references within the imag store.

+

A reference is a “pointer” to a file or directory on the filesystem and outside the store. It differs from libimagentrylink/external linking as it is designed exclusively for filesystem references, not for URLs.

+

A reference is created with a unique identifier, like a hash. The implementation how this hash is calculated can be defined by the user of libimagentryref.

+

So this library helps to resemble something like a symlink.

+

Usage

+

Users have to implement the UniqueRefPathGenerator trait which should implement a hashing functionality for pathes.

+

Limits

+

This is not intended to be a version control system or something like that. We also can not use real symlinks as we need imag-store-objects to be able to link stuff.

+

Usecase

+

This library offers functionality to refer to content outside of the store. It can be used to refer to nearly static stuff pretty easily - think of a Maildir - you add new mails by fetching them, but you mostly do not remove mails. If mails get moved, they can be re-found via their hash, because Maildir objects hardly change. Or because the hash implementation which is used to refer to them hashes only the Message-Id and that does not change.

+

Long-term TODO

+

Not implemented yet:

+ +

libimagentrytag

+

Library for tagging entries. Used in “imag-tag” but should be used in all other modules which contain tagging functionality, so the backend and frontend look the same for all modules.

+

libimagentryutil

+

This library contains utilities for working with libimagstore::store::Entry objects where the functionality does not necessarily belong into libimagstore.

+

libimagentryview

+

Provides viewing (as in piping to stdout, opening in $EDITOR or in $BROWSER) functionality for entries.

+

libimagerror

+

In imag, we do not panic.

+

Whatever we do, if we fail as hard as possible, the end-user should never ever see a backtrace from a panic!().

+

Anyways, the user might see a error trace generated by imag. That is because imag is software for power-users, for nerds (I use the term “nerd” because for me it is a good thing - I do not want to offend anyone by using it). This target group can read backtraces without getting confused. IO Error and Permission denied Error are things that nerds can understand and they already know what to do in the most obvious cases (such as Permission denied Error).

+

This library crate is for generating error types and handle them in a nice way. It can be seen as mini-framework inside imag which was written to work with error types in a specified way. All imag crates must use this library if they can return errors in any way, except the libimagutil - which is for the most basic utilities.

+

libimaghabit

+

The habit library implements a habit tracker.

+

A habit can be instantiated with a name and a time-period in which it should be fullfilled (eg. daily, ever 3 days, weekly…).

+

The module offers ways to generate statistics about habits.

+

libimaginteraction

+

A crate for more general interaction with the user (interactive commandline interface).

+

Offers functions for asking the user Y/N questions, for (numeric) values, etc.

+

libimaglog

+

A small extension over libimagdiary which strips down the functionality of libimagdiary to some defaults for writing a log (a tumbleblog like diary) with rather short messages.

+

Provides only basic functionality over libimagdiary, most notably the “log.is_log” header entry, so the imag-log CLI can distinguish between “logs” and “diary entries”.

+

libimagmails

+

The mail library implements everything that is needed for beeing used to implement a mail reader (MUA).

+

It therefor providea reading mailboxes, getting related content or mails, saving attachements to external locations, crafting new mails and responses,…

+

It also offers, natively, ways to search for mails (which are represented as imag entries) via tags, categories or even other metadata.

+

For more information on the domain of the imag-mail command, look at the documentation of the Section 6.8 module.

+

libimagnotes

+

libimagrt

+

This library provides utility functionality for the modules and the binary frontends, such as reading and parsing the configuration file, a builder helper for the commandline interface and such.

+

It also contains the store object and creates it from configuration.

+

the libimagrt::runtime::Runtime object is the first complex object that comes to live in a imag binary.

+

Long-term TODO

+ +

libimagstore

+

The store is the heart of everything. Here lives the data, the complexity and the performance bottleneck.

+

The store offeres read/write access to all entries.

+

The store itself does not offer functionality, but has a commandline interface “imag-store” which can do basic things with the store.

+

Long-term TODO

+ +

libimagtimetrack

+

A library for tracking time events in the imag store.

+

Store format

+

Events are stored with a store id like this:

+
/timetrack/<insert-date-year>/<insert-date-month>/<insert-date-day>/<insert-date-time>-<tag>.ext
+

Timetrackings contain

+ +

by default and might be extended with more header fields as one likes.

+

The header of a timetrack “work” entry looks like this:

+
[event]
+        tag = "work"
+        start = "2017-01-02T03:04:05"
+        end = "2017-01-02T06:07:08"
+

Normal tags (as in libimagentrytag) are explicitely not used for tagging, so the user has the possibility to use normal tags on these entries as well.

+

The tag field is of type string, as for one tag, one entry is created. This way, one can track overlapping tags, as in:

+