Cleaned up usage.md for clarity, formatting, and grammar.

While working on it, I hard-wrapped the lines to 80 characters. Hope that doesn't complicate things.

Note: I changed the Steve Buscemi quote to maintain compliance with the Code of Conduct.
This commit is contained in:
Guy B. deBros 2020-05-17 11:08:43 -04:00
parent 732831695f
commit 6179ea43e1

View file

@ -1,46 +1,45 @@
# Basic Usage # Basic Usage
`jrnl` has two modes: **composing** and **viewing**. Basically, whenever `jrnl` has two modes: **composing** and **viewing**. Whenever you don't enter
you _don't_ supply any arguments that start any arguments that start with a dash (`-`) or double-dash (`--`), you're in
with a dash or double-dash, you're in composing mode, meaning you can composing mode, meaning that you can write your entry on the command line.
write your entry on the command line or an editor of your choice.
We intentionally break a convention on command line arguments: all We intentionally break a convention on command line arguments: all arguments
arguments starting with a _single dash_ starting with a _single dash_ (`-`) will _filter_ your journal before viewing
will _filter_ your journal before viewing it. Filter arguments can be combined arbitrarily. Arguments with a _double dash_
it, and can be combined arbitrarily. Arguments with a (`--`) will _control_ how your journal is displayed or exported. Control
_double dash_ will control how your journal arguments are mutually exclusive (i.e., you can only specify one way to display
is displayed or exported and are mutually exclusive (ie. you can only or export your journal at a time).
specify one way to display or export your journal at a time).
## Listing Journals ## Listing Journals
You can list the journals accessible by jrnl You can list the journals accessible by `jrnl`:
```sh ```sh
jrnl -ls jrnl -ls
``` ```
The journals displayed correspond to those specified in the jrnl The journals displayed correspond to those specified in the `jrnl` configuration
configuration file. file.
## Composing Entries ## Composing Entries
Composing mode is entered by either starting `jrnl` without any Composing mode is entered by either starting `jrnl` without any arguments --
arguments -- which will prompt you to write an entry or launch your which will prompt you to write an entry or launch your editor -- or by just
editor -- or by just writing an entry on the prompt, such as writing an entry on the prompt, such as
```sh ```sh
jrnl today at 3am: I just met Steve Buscemi in a bar! He looked funny. jrnl today at 3am: I just met Steve Buscemi in a bar! He was on fire.
``` ```
!!! note !!! note
Most shell contains a certain number of reserved characters, such as `#` Most shells contain a certain number of reserved characters, such as `#` and
and `*`. Unbalanced quotes, parenthesis, and so on will also get into `*`. These characters, as well as unbalanced single or double quotation
the way of your editing. marks, parentheses, and others, likely will cause problems. Although
For writing longer entries, just enter `jrnl` reserved characters can be escaped using `\`, this is not ideal for
and hit `return`. Only then enter the text of your journal entry. long-form writing. The solution: first enter `jrnl` and hit `return`. You
Alternatively, `use an external editor <advanced>`). can then enter the text of your journal entry. Alternatively, you can `use
an external editor <advanced>`).
You can also import an entry directly from a file You can also import an entry directly from a file
@ -62,23 +61,23 @@ Timestamps that work:
### Starring entries ### Starring entries
To mark an entry as a favourite, simply "star" it To mark an entry as a favorite, simply "star" it
```sh ```sh
jrnl last sunday *: Best day of my life. jrnl last sunday *: Best day of my life.
``` ```
If you don't want to add a date (ie. your entry will be dated as now), If you don't want to add a date (i.e., you want the date to be entered as
The following options are equivalent: _now_), the following options are equivalent:
- `jrnl *: Best day of my life.` - `jrnl *: Best day of my life.`
- `jrnl *Best day of my life.` - `jrnl *Best day of my life.`
- `jrnl Best day of my life.*` - `jrnl Best day of my life.*`
!!! note !!! note
Just make sure that the asterisk sign is **not** surrounded by Make sure that the asterisk sign is **not** surrounded by whitespaces. `jrnl
whitespaces, e.g. `jrnl Best day of my life! *` will **not** work (the Best day of my life! *` will not work because the `*` sign has a special
reason being that the `*` sign has a special meaning on most shells). meaning in most shells).
## Viewing ## Viewing
@ -86,15 +85,15 @@ The following options are equivalent:
jrnl -n 10 jrnl -n 10
``` ```
will list you the ten latest entries (if you're lazy, `jrnl -10` will do lists the ten most recent entries (`jrnl -10` works the same way).
the same),
```sh ```sh
jrnl -from "last year" -until march jrnl -from "last year" -until march
``` ```
everything that happened from the start of last year to the start of displays everything that happened from the beginning of last year until the
last march. To only see your favourite entries, use beginning of the past March. To display only your favorite (starred) entries,
use
```sh ```sh
jrnl -starred jrnl -starred
@ -103,58 +102,68 @@ jrnl -starred
## Using Tags ## Using Tags
Keep track of people, projects or locations, by tagging them with an `@` Keep track of people, projects or locations, by tagging them with an `@`
in your entries in your entries:
```sh ```sh
jrnl Had a wonderful day on the @beach with @Tom and @Anna. jrnl Had a wonderful day at the @beach with @Tom and @Anna.
``` ```
You can filter your journal entries just like this: You can filter your journal entries by tag. For example,
```sh ```sh
jrnl @pinkie @WorldDomination jrnl @pinkie @WorldDomination
``` ```
Will print all entries in which either `@pinkie` or `@WorldDomination` displays all entries in which either `@pinkie` or `@WorldDomination`
occurred. occurred.
```sh ```sh
jrnl -n 5 -and @pinkie @WorldDomination jrnl -n 5 -and @pinkie @WorldDomination
``` ```
the last five entries containing both `@pinkie` **and** `@worldDomination`. displays the last five entries containing both `@pinkie` **and**
You can change which symbols you'd like to use for tagging in the `@worldDomination`. You can change which symbols you'd like to use for tagging
configuration. in the configuration.
!!! note !!! note
`jrnl @pinkie @WorldDomination` will switch to viewing mode because Entering `jrnl @pinkie @WorldDomination` will display entries in which both
although **no** command line arguments are given, all the input strings tags are present because, although no command line arguments are given, all
look like tags - _jrnl_ will assume you want to filter by tag. of the input strings look like tags. `jrnl` will assume you want to filter
by tag, rather than create a new entry that consists only of tags.
## Editing older entries
You can edit selected entries after you wrote them. This is particularly ## Editing Existing Entries
useful when your journal file is encrypted. To use this feature, you need
to have an editor configured in your journal configuration file (see You can edit entries after writing them. This is particularly useful when your
`advanced usage <advanced>`) journal file is encrypted. To use this feature, you need to have an external
editor configured in your configuration file (see `advanced usage <advanced>`).
You can also edit only the entries that match specific search criteria. For
example,
```sh ```sh
jrnl -until 1950 @texas -and @history --edit jrnl -until 1950 @texas -and @history --edit
``` ```
Will open your editor with all entries tagged with `@texas` and opens your external editor displaying all entries tagged with `@texas` and
`@history` before 1950. You can make any changes to them you want; after `@history` that were written before 1950. After making changes, save and close
you save the file and close the editor, your journal will be updated. the file, and only those entries will be modified (and encrypted, if
applicable).
Of course, if you are using multiple journals, you can also edit e.g. If you are using multiple journals, it's easy to edit specific entries from
the latest entry of your work journal with `jrnl work -n 1 --edit`. In specific journals. Simply prefix the filter string with the name of the journal.
any case, this will bring up your editor and save (and, if applicable, For example,
encrypt) your edited journal after you save and exit the editor.
You can also use this feature for deleting entries from your journal ```sh
jrnl work -n 1 --edit
```
opens the most recent entry in the 'work' journal in your external editor.
You can also use this feature for deleting entries from your journal. Open an external editor with the entries you want to delete...
```sh ```sh
jrnl @texas -until 'june 2012' --edit jrnl @texas -until 'june 2012' --edit
``` ```
Just select all text, press delete, and everything is gone... ...select all text, delete it, save and close, and all of those entries are
removed from the journal.