first commit

This commit is contained in:
Johann Dreo 2023-07-26 22:09:07 +02:00
commit b6a4929d93
2 changed files with 36 additions and 0 deletions

4
.klyban.csv Normal file
View file

@ -0,0 +1,4 @@
STATUS,ID,TITLE,DETAILS,TAG,DEADLINE
DOING,1,print card,pretty print fixed-width cards given a content,klyban,
TODO,2,print table,pretty print set of cards on each column,klyban,
TODO,3,nested prints,print cards within cards,klyban,
1 STATUS ID TITLE DETAILS TAG DEADLINE
2 DOING 1 print card pretty print fixed-width cards given a content klyban
3 TODO 2 print table pretty print set of cards on each column klyban
4 TODO 3 nested prints print cards within cards klyban

32
klyban.py Normal file
View file

@ -0,0 +1,32 @@
import sys
import agate
import click
# Global group holding global options.
@click.group()
@click.option('-i', '--input', default='.klyban.csv', type=click.Path(writable=True, readable=True, allow_dash=True))
@click.pass_context
def cli(context,input):
# ensure that context.obj exists and is a dict (in case `cli()` is called
# by means other than the `if` block below)
context.ensure_object(dict)
context.obj['input'] = input
@cli.command()
@click.pass_context
def show(context):
with click.open_file(context.obj['input'], mode='r') as fd:
table = agate.Table.from_csv(fd)
table.print_table(output = sys.stdout)
@cli.command()
@click.pass_context
def config(context):
click.echo('Configuration:')
click.echo(f"Data file: `{context.obj['input']}`")
if __name__ == '__main__':
cli(obj={})