Quotidien Shaarli

Tous les liens d'un jour sur une page.

July 9, 2015

jrnl- The Command Line Journal

( via http://korben.info/prendre-des-notes-ou-ecrire-son-journal-directement-depuis-la-ligne-de-commande.html )

Installation sur une Debian 8 :

Installer les setuptools de Python ( pour avoir easy_install )

| ========
$ sudo aptitude install python-setuptools
| ========

Installer pip :

| ========
$ sudo easy_install pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
Best match: pip 7.1.0
Downloading https://pypi.python.org/packages/source/p/pip/pip-7.1.0.tar.gz#md5=d935ee9146074b1d3f26c5f0acfd120e
Processing pip-7.1.0.tar.gz
Writing /tmp/easy_install-NyGRPr/pip-7.1.0/setup.cfg
Running pip-7.1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-NyGRPr/pip-7.1.0/egg-dist-tmp-Hnm6hi
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching 'pip/_vendor/Makefile'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching 'dev-requirements.txt'
no previously-included directories found matching '.travis'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'contrib'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'
Adding pip 7.1.0 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/pip-7.1.0-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
| ========

Chercher avec pip :

| ========
$ pip search jrnl
klink - Klink is a simple and clean theme for creating Sphinx docs, inspired by jrnl
jrnl - A command line journal application that stores your journal in a plain text file
| ========

Installer jrnl avec pip :

| ========
$ sudo pip install jrnl
Collecting jrnl
Downloading jrnl-1.9.8.tar.gz
Collecting parsedatetime>=1.2 (from jrnl)
Downloading parsedatetime-1.5-py2-none-any.whl (50kB)
100% |████████████████████████████████| 53kB 1.1MB/s
Collecting pytz>=2013b (from jrnl)
Downloading pytz-2015.4-py2.py3-none-any.whl (475kB)
100% |████████████████████████████████| 475kB 771kB/s
Requirement already satisfied (use --upgrade to upgrade): six>=1.6.1 in /usr/lib/python2.7/dist-packages (from jrnl)
Collecting tzlocal>=1.1 (from jrnl)
Downloading tzlocal-1.2.tar.gz
Collecting keyring>=3.3 (from jrnl)
Downloading keyring-5.3.zip (87kB)
100% |████████████████████████████████| 90kB 1.0MB/s
Collecting python-dateutil==1.5 (from jrnl)
Downloading python-dateutil-1.5.tar.gz (233kB)
100% |████████████████████████████████| 237kB 1.3MB/s
Installing collected packages: parsedatetime, pytz, tzlocal, keyring, python-dateutil, jrnl
Running setup.py install for tzlocal
Running setup.py install for keyring
Running setup.py install for python-dateutil
Running setup.py install for jrnl
Successfully installed jrnl-1.9.8 keyring-5.3 parsedatetime-1.5 python-dateutil-1.5 pytz-2015.4 tzlocal-1.2
| ========

Plus qu'à apprendre les commandes par cœur ( voir "$ jrnl --help" ), trouver un moyen pour que toutes les commandes utilisant jrnl ne soit pas stockées dans l'historique et puis synchroniser ça entre les différentes machines.

[Edit 03/11/2015:
J'ai finalement commencé à utilisé "jrnl". Voici quelques commandes de base. Pour éditer les notes, il faut ajouter un éditeur dans ~/.jrnl_config :
| ========
$ cat .jrnl_config
{
"default_hour": 9,
"timeformat": "%Y-%m-%d %H:%M",
"linewrap": 79,
"encrypt": true,
"editor": "vim",
"default_minute": 0,
"highlight": true,
"journals": {
"default": "/home/simon/jrnl/journal.txt"
},
"tagsymbols": "@"
}
| ========

Initialisation du journal (chiffré) :
| ========
$ jrnl now: Titre. Contenu.
Path to your journal file (leave blank for ~/journal.txt):
~/jrnl/journal.txt
Enter password for journal (leave blank for no encryption):
Do you want to store the password in your keychain? [Y/n]

Journal will be encrypted.
[Entry added to default journal]
| ========

Écrire du contenu pour aujourd'hui (à 9am par défaut):
$ jrnl today: Titre. Contenu.

Écrire du contenu pour aujourd'hui à 8pm:
$ jrnl today at 8pm: Titre. Contenu.

Écrire du contenu pour "maintenant" :
$ jrnl now: Titre. Contenu.
OU, simplement :
$ jrnl Titre. Contenu.

Voir le(s) journal(aux):
$ jrnl -ls

Voir le dernier ajout dans le journal :
$ jrnl -n 1

Éditer le dernier ajout dans le journal :
$ jrnl -n 1 --edit

Éditer toutes les notes de 2015 :
$ jrnl -until 2015 --edit

Pour supprimer une note, il faut simplement l'éditer et tout effacer.

Pour ajouter un tag, il suffit de mettre un arobase devant :
$ jrnl Test des @tags.
[Entry added to default journal]

Afficher les notes correspondantes au tag "@tags" :
$ jrnl @tags
2015-11-04 11:19 Test des @tags.

Supprimer toutes les notes contenant le tag "@tags" :
$ jrnl @tags --edit
(et tout effacer avant d'enregistrer.)

[Edit 03/11/2015:
Pour empêcher l'historisation des commandes "jrnl", dans Zsh, on rajoute deux lignes dans le fichier "~/.zshrc" :
| ========
HIST_IGNORE_SPACE="true"
alias jrnl=' jrnl'
| ========

Dans Bash, il faut modifier "~/.bashrc" :
| ========
export HISTCONTROL=ignorespace
alias jrnl=' jrnl'
| ========

Kash on orbit

Le blog d'un hacktiviste bruxellois. :-) Il joue avec la brique internet et l'association neutrinet.