Skip to main content

CLI Todo app made with typer, sqlite and a REST API

Project description

todo-cli-tddschn

A simple command-line Todo app made with typer, sqlite and a REST API.

Features

  • Creating, reading, updating, and deleting todos;
  • Nicely formatting the outputs (with color);
  • todo ls lists all todos, ordered by priority and due date, the todos without a due date are put last (nullslast).
  • Not only the command line interface - you can also CRUD your todos by making HTTP requests to the REST API.

Install, Upgrade and Uninstall

pipx (recommended)

  • Install
    pipx install todo-cli-tddschn
    
  • Upgrade
    pipx upgrade todo-cli-tddschn
    
  • Uninstall
    pipx uninstall todo-cli-tddschn
    

About pipx

pip

  • Install
    pip install todo-cli-tddschn
    
  • Upgrade
    pip install --upgrade todo-cli-tddschn
    
  • Uninstall
    pip uninstall todo-cli-tddschn
    

Usage

todo

You can add, modify, or remove (all) todos with the todo command:

todo --help

Usage: todo [OPTIONS] COMMAND [ARGS]...

  tddschn's command line todo app

Options:
  -v, --version         Show the application's version and exit.
  --install-completion  Install completion for the current shell.
  --show-completion     Show completion for the current shell, to copy it or
                        customize the installation.

  --help                Show this message and exit.

Commands:
  a        Add a new to-do with a DESCRIPTION.
  clear    Remove all to-dos.
  config   Getting and managing the config
  g        Get a to-do by ID.
  info     Get infos about todos
  init     Initialize the to-do database.
  ls       list all to-dos, ordered by priority and due date.
  m        Modify a to-do by setting it as done using its TODO_ID.
  re-init  Re-initialize the to-do database.
  rm       Remove a to-do using its TODO_ID.

todo ls

List and filter the todos.

todo ls --help

Usage: todo ls [OPTIONS] COMMAND [ARGS]...

  list all to-dos, ordered by priority and due date.

Options:
  -d, --description TEXT
  -p, --priority [low|medium|high]
  -s, --status [todo|done|deleted|cancelled|wip]
  -pr, --project TEXT
  -t, --tags TEXT
  -dd, --due-date [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]
  --help                          Show this message and exit.

Commands:
  project  Filter to-dos by project.
  tag      Filter to-dos by tag.

todo serve

Serve the REST API (built with FastAPI)

todo serve --help
Usage: todo serve [OPTIONS]

  serve REST API. Go to /docs for interactive documentation on API usage.

Options:
  --host TEXT       [default: 127.0.0.1]
  --port INTEGER    [default: 5000]
  --log-level TEXT  [default: info]
  --help            Show this message and exit.

todo config

Get or edit the configurations

todo config --help

Usage: todo config [OPTIONS] COMMAND [ARGS]...

  Getting and managing the config

Options:
  --help  Show this message and exit.

Commands:
  db-path  Get the path to the to-do database.
  edit     Edit the config file. # Opens in default editor
  path     Get the path to the config file.

todo info

Get the info and stats about the todos.

todo info --help

Usage: todo info [OPTIONS] COMMAND [ARGS]...

  Get infos about todos

Options:
  --help  Show this message and exit.

Commands:
  count  Get todo counts

todo utils

Utility commands.

todo utils --help
Usage: todo utils [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  export                  Export todos to todo commands that can be used to re-construct your todo database
  fill-date-added-column  fill date_added column with the current time if it's null # used for migrate to v1.0.0

Configuration

Example config file:

[General]
home_dir = /Users/tscp # set it to your $HOME
database = %(home_dir)s/.todo-cli-tddschn.db # or anywhere you'd like

[Format]
# see https://strftime.org/ for the format specs
due_date = %%m-%%d
date_added = %%m-%%d

You can install this file with the following command:

curl -o "$(todo config path)" https://raw.githubusercontent.com/tddschn/todo-cli-tddschn/master/examples/config.ini

Migrate to v1.0.0

todo v1.0.0 added a new column date_added to the todo table of the todo database,

and you need to migrate your todo database to v1.0.0 if you were using a previous version.

Here's the how:

  • Install alembic, the database migration tool.

    pip install alembic # or method of your choice
    
  • Run the migration scripts in this repository and fill the new column with the current time:

    # clone this repository
    git clone https://github.com/tddschn/todo-cli-tddschn.git
    cd todo-cli-tddschn
    
    # edit alembic.ini, change the sqlalchemy.url to your database url
    vim alembic.ini
    
    # migrate to new db schema
    python -m alembic revision --autogenerate -m "Initial Migration"
    python -m alembic upgrade head
    python -m alembic revision --autogenerate -m "Add date_added to Todo model"
    python -m alembic upgrade head
    
    # fill the new column (make sure to upgrade to v1.0.1 first)
    todo utils fill-date-added-column
    

Why do you made this?

For practicing my python and SQL skills.

If you're looking for an awesome CLI todo app, try taskwarrior.

SQLite database schema

schema

Screenshots

screenshot

screenshot-2

todo-serve

api-docs

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

todo-cli-tddschn-1.1.2.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

todo_cli_tddschn-1.1.2-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file todo-cli-tddschn-1.1.2.tar.gz.

File metadata

  • Download URL: todo-cli-tddschn-1.1.2.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.5.0

File hashes

Hashes for todo-cli-tddschn-1.1.2.tar.gz
Algorithm Hash digest
SHA256 b49c9f6685b24a3fc501a476c97e6e1ebbe9600906b7c6f565850dd0ff4deb7a
MD5 8acd73244b586f08c4613319048501c4
BLAKE2b-256 28c6062765895e9221c3911c33cd8d04ee7111e2a1ef407a3a0a6ea9180c1531

See more details on using hashes here.

File details

Details for the file todo_cli_tddschn-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: todo_cli_tddschn-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.5.0

File hashes

Hashes for todo_cli_tddschn-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c8965159547d1791bee872b5c2e66d490004852002d0dcd5440d05677d12874b
MD5 9089c5b2dfc13c7ecfe3875fc68d511b
BLAKE2b-256 c354ecc724c07ff1ba58d9136222a994b4493e7994cc1e8fc298fe4be7509181

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