Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create interactive command for curses interface (for discussion purposes) #66

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions todoman/cli.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import functools
import glob
import logging
from datetime import timedelta
from os.path import expanduser, isdir

import click

from . import model
from .configuration import ConfigurationException, load_config
from .interactive import TodomanInteractive
from .model import Database, FileTodo
from .ui import EditState, PorcelainFormatter, TodoEditor, TodoFormatter


logging.basicConfig()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basicConfig should be called in the cli function, not at module level. In the case of showing a UI you won't want to output anything I think.

logger = logging.getLogger()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use logging.getLogger(__name__) to namespace your logging.


TODO_ID_MIN = 1
with_id_arg = click.argument('id', type=click.IntRange(min=TODO_ID_MIN))

Expand Down Expand Up @@ -188,6 +194,15 @@ def edit(ctx, id, todo_properties, interactive):
ctx.exit(1)


@cli.command()
@click.pass_context
def interactive(ctx):
'''
Provide an interactive, curses-based interface to Todoman.
'''
TodomanInteractive(ctx.obj['db'], ctx.obj['formatter'])


@cli.command()
@click.pass_context
@with_id_arg
Expand Down