Skip to main content

A simple and light-weight notepad for the command line

Project description

sjournal

GitHub release (latest SemVer including pre-releases) PyPI - Python Version PyPI - License

A simple and light-weight notepad for the command line:

Demo

Installation

Latest release via pip

> pip install sjournal

Usage

Sjournal commands can be invoked using either sjournal or sj

Creating and Loading Journals

If using Sjournal for the first time, a blank journal called "notes" will be automatically created:

> sjournal

No config file found. Creating new one at <HOME_DIR>/sjournal/sjournal_config.json

                 notes
┌────┬───────────┬──────────┬─────────┐
│ ID  Timestamp  Category  Content │
├────┼───────────┼──────────┼─────────┤
└────┴───────────┴──────────┴─────────┘

To create a new Journal or load an Existing one, use sjournal load:

> sjournal load MyJournal
Set journal to <HOME_DIR>/sjournal/journals/MyJournal.db

> sjournal

               MyJournal
┌────┬───────────┬──────────┬─────────┐
│ ID  Timestamp  Category  Content │
├────┼───────────┼──────────┼─────────┤
└────┴───────────┴──────────┴─────────┘

Adding Notes

Add notes with sjournal add:

  • Set the category with -c/--category. Default category is "General"
  • Set the Style (Rich Markup) with -s/--style
> sjournal add -c TODO -s "bold red" "Update the README ASAP"
~ OR ~
> sjournal add --category="TODO" --style="bold red" "Update the README ASAP"

> sjournal

Demo_Add

Listing and Searching Notes

Show notes with sjournal or sjournal list:

Show most recent 5 notes by default:
> sjournal list
                     MyJournal
┌────┬───────────────────┬──────────┬──────────────┐
│ ID  Timestamp          Category  Content      │
├────┼───────────────────┼──────────┼──────────────┤
│ 5   03-20-22 15:55:40  General   Misc. Note 5 │
│ 4   03-20-22 15:55:39  General   Misc. Note 4 │
│ 3   03-20-22 15:55:38  General   Misc. Note 3 │
│ 2   03-20-22 15:55:37  General   Misc. Note 2 │
│ 1   03-20-22 15:55:35  General   Misc. Note 1 │
└────┴───────────────────┴──────────┴──────────────┘

Show all notes:
> sjournal list -a 
                          MyJournal
┌────┬───────────────────┬──────────┬────────────────────────┐
│ ID  Timestamp          Category  Content                │
├────┼───────────────────┼──────────┼────────────────────────┤
│ 5   03-20-22 15:55:40  General   Misc. Note 5           │
│ 4   03-20-22 15:55:39  General   Misc. Note 4           │
│ 3   03-20-22 15:55:38  General   Misc. Note 3           │
│ 2   03-20-22 15:55:37  General   Misc. Note 2           │
│ 1   03-20-22 15:55:35  General   Misc. Note 1           │
│ 0   03-20-22 15:30:55  TODO      Update the readme ASAP │
└────┴───────────────────┴──────────┴────────────────────────┘

Show the last N notes:
> sjournal list 2
                     MyJournal
┌────┬───────────────────┬──────────┬──────────────┐
│ ID  Timestamp          Category  Content      │
├────┼───────────────────┼──────────┼──────────────┤
│ 5   03-20-22 15:55:40  General   Misc. Note 5 │
│ 4   03-20-22 15:55:39  General   Misc. Note 4 │
└────┴───────────────────┴──────────┴──────────────┘

Show notes with a given category:
> sjournal list -c TODO
                          MyJournal
┌────┬───────────────────┬──────────┬────────────────────────┐
│ ID  Timestamp          Category  Content                │
├────┼───────────────────┼──────────┼────────────────────────┤
│ 0   03-20-22 15:30:55  TODO      Update the readme ASAP │
└────┴───────────────────┴──────────┴────────────────────────┘

Search note content with a specific word or phrase (regex allowed)
> sjournal search readme
                          MyJournal
┌────┬───────────────────┬──────────┬────────────────────────┐
│ ID  Timestamp          Category  Content                │
├────┼───────────────────┼──────────┼────────────────────────┤
│ 0   03-20-22 15:30:55  TODO      Update the readme ASAP │
└────┴───────────────────┴──────────┴────────────────────────┘

Editing and Deleting Notes

Edit the most recent note, or edit by ID:

> sjournal edit
Editing Note #0 (copied to clipboard): "Update the README ASAP"
Enter new note text ([bold red]Update the README ASAP[/]): Update the readme eventually

> sjournal edit 0
Editing Note #0 (copied to clipboard): "Update the readme eventually"
Enter new note text (Update the readme eventually): Update the readme [bold red]RIGHT NOW[/]

Delete notes by a single ID, mutiple IDs, or a range of IDs:

> sjournal
                     MyJournal
┌────┬───────────────────┬──────────┬──────────────┐
│ ID  Timestamp          Category  Content      │
├────┼───────────────────┼──────────┼──────────────┤
│ 5   03-20-22 15:48:38  General   Misc. Note 5 │
│ 4   03-20-22 15:48:37  General   Misc. Note 4 │
│ 3   03-20-22 15:48:34  General   Misc. Note 3 │
│ 2   03-20-22 15:48:33  General   Misc. Note 2 │
│ 1   03-20-22 15:48:30  General   Misc. Note 1 │
└────┴───────────────────┴──────────┴──────────────┘

> sjournal delete 4
DELETED NOTE #4

> sjournal delete 1 2 3
DELETED NOTE #1
DELETED NOTE #2
DELETED NOTE #3

> sjournal delete 2-5
DELETED NOTE #2
DELETED NOTE #3
DELETED NOTE #4
DELETED NOTE #5

Backup and Restore Journals

Journals can be backed up and restored with sjournal backup and sjournal restore

Specific filenames can be given with -f <filename>. Othewise, the current time at backup will be used.

> sjournal backup
BACKING UP C:/Users/samue/sjournal/journals/MyJournal.db 
TO FILE C:/Users/samue/sjournal/journals/backups/MyJournal/backup_MyJournal_22_03_20_16_00_45.db

> sjournal restore
RESTORING BACKUP FROM C:\Users\samue\sjournal\journals\backups\MyJournal\backup_MyJournal_22_03_20_16_00_45.db
REPLACING C:\Users\samue\sjournal\journals\MyJournal.db

Custom Aliases (Windows)

If you want to run Sjournal with a different shorthand within Cmder or Windows Cmd (such as myalias):

Setting up an alias in Cmder

> alias myalias=sjournal $*

Setting up an alias in Windows Cmd

> cd c:/
> mkdir alias
> cd alias
> echo @echo off >> myalias.bat
> echo echo. >> myalias.bat
> echo sjournal %* >> myalias.bat

Finally, add c:/alias to PATH in your system environment variables.

After restarting the terminal, sjournal can be used by calling the new alias in the command line:

> myalias --version

Full List of Commands

To see help for a specific command, use sjournal [COMMAND] --help

usage: sjournal [-h] [-d] [-v] {add,backup,categories,delete,edit,erase,help,list,load,restore,search} ...

options:
  -h, --help            show this help message and exit
  -d, --debug           Output to reports/debug.log instead of stdout
  -v, --version         Show sjournal information

Commands:
  {add,backup,categories,delete,edit,erase,help,list,load,restore,search}
                        Commands
    add                 Add a note to the database
    backup              Backup the current journal
    categories          List all categories in the current journal
    delete              Delete one or multiple notes from the database
    edit                Edit a note to the database
    erase               Delete all notes from the current journal
    help                Display help text
    list                List notes in the database
    load                Load a journal or create a new one if it doesn't exist
    restore             Restore the database from a file. If --filename is not given, restore the latest backup
    search              List notes matching search term

To see help for specific commands, use sjournal [COMMAND] --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sjournal-0.2.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

sjournal-0.2.2-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file sjournal-0.2.2.tar.gz.

File metadata

  • Download URL: sjournal-0.2.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.3

File hashes

Hashes for sjournal-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b55468062182cbe86b2a237cd84a53dc844b52568e39da69519089ba34a2a32c
MD5 ae5a8fb2db44191bd688abc263c4b4bb
BLAKE2b-256 31552d2e65f9f341eb3c6246d35ca418c3315b1da9c4dea2cdbc99d7d9d3eb6e

See more details on using hashes here.

File details

Details for the file sjournal-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: sjournal-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.3

File hashes

Hashes for sjournal-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 51a19fdb662fa426f4e8757c399b5c3c9dac5909aa2f519f402f86c983219696
MD5 cf45bae94c43beacafbc992efdb3c577
BLAKE2b-256 c82c0c01af566ba2aa98a123f54c4f5febc2f73a7fa84e43cc73bbf9db901abb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page