nickyu42 / klogpy

Klog text format parser in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Klogpy

Python implementation of the klog plain-text format with some utilities.
Includes a parser and CLI.

Installation

Klogpy can be installed via PyPi, to install via pip:

pip install klogpy

Usage

Example:

from klogpy import parser

s = '''
2021-01-01
Work on new frontend button
    9:00-17:30
    -45m Lunch
    -30h Coffee break
'''

records = parser.parse(s)

print(records[0])
# Record(
#   date=datetime.date(2021, 1, 1), 
#   properties=[None], 
#   summary=['Work on new frontend button'], 
#   entries=[
#       Entry(time=Range(start=[False, datetime.time(9, 0)], end=(False, datetime.time(17, 30))), description=''), 
#       Entry(time=Duration(is_neg=True, hours=0, minutes='45'), description='Lunch'), 
#       Entry(time=Duration(is_neg=True, hours='30', minutes=0), description='Coffee break')
#   ], 
#   tags=[]
# )

CLI

$ klogpy --help
Usage: klogpy [OPTIONS] COMMAND [ARGS]...

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  entry   Manipulate entries for the active day
  init    Initialize a new record store if it does not exist
  record  Create or modify records

About

Klog text format parser in Python


Languages

Language:Python 97.5%Language:Makefile 2.5%