diff --git a/pyproject.toml b/pyproject.toml index 0aa0379..d3b7422 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,21 +1,14 @@ [project] name = "fob" -version = "0.1.0" +version = "0.2.0" description = "Focus Blocks: Simple and elegant daily time management tool." readme = "README.md" -authors = [ - { name = "tensorturtle", email = "tensorturtle@gmail.com" } -] +authors = [{ name = "tensorturtle", email = "tensorturtle@gmail.com" }] requires-python = ">=3.12" -dependencies = [ - "rich>=13.9.4", - "tinydb>=4.8.2", -] +dependencies = ["rich>=13.9.4", "tinydb>=4.8.2"] [project.scripts] fob = "fob:main" [tool.uv] -dev-dependencies = [ - "nuitka>=2.4.11", -] +dev-dependencies = ["nuitka>=2.4.11"] diff --git a/src/fob/__init__.py b/src/fob/__init__.py index 403f46e..4ef5214 100644 --- a/src/fob/__init__.py +++ b/src/fob/__init__.py @@ -61,7 +61,7 @@ def run_app(): type=str, help="ID of the block to check off (int)", ) - subparsers.add_parser("nvm", help="Revise block assignment for today and change a non-Buffer block into a Buffer block, and mark that new Buffer block as complete." + subparsers.add_parser("nvm", help="Revise block assignment for today and change a non-Buffer block into a Buffer block, and mark that new Buffer block as complete.") args = parser.parse_args() command_func = None diff --git a/src/fob/commands/__init__.py b/src/fob/commands/__init__.py index b75a7b3..7ab13fc 100644 --- a/src/fob/commands/__init__.py +++ b/src/fob/commands/__init__.py @@ -5,3 +5,4 @@ from fob.commands.new_month import new_month from fob.commands.reset import reset from fob.commands.did import did +from fob.commands.nvm import nvm diff --git a/src/fob/commands/gm.py b/src/fob/commands/gm.py index e3d3a5a..211b70e 100644 --- a/src/fob/commands/gm.py +++ b/src/fob/commands/gm.py @@ -1,19 +1,13 @@ from argparse import Namespace from datetime import date -from calendar import monthrange -from rich.pretty import pprint, Pretty +from rich.pretty import Pretty from rich import print -from rich.layout import Layout from rich.panel import Panel -from rich.progress import Progress, TextColumn, BarColumn, TaskProgressColumn, ProgressColumn -from rich.console import Console, Group -from rich.rule import Rule from rich.prompt import Prompt -from rich.text import Text from tinydb import where, Query -from fob.db import MonthBlockData, TinyDBWrapper, checklist_complete +from fob.db import TinyDBWrapper, checklist_complete from fob.commands.overviews import month_overview, display_checklist class InvalidUserInput(Exception): @@ -36,7 +30,7 @@ def gm(args: Namespace, db: TinyDBWrapper) -> None: print("In the meantime, consider running [bold][cyan]fob reset[/cyan][/bold].") return - print(f"Good morning! \N{SUNRISE}") + print("Good morning! \N{SUNRISE}") month_overview(args, db) try: new_day(args, db, data[0]) # can raise InvalidUserInput @@ -94,11 +88,11 @@ def new_day(args: Namespace, db: TinyDBWrapper, data) -> None: blocks_assigned = int(Prompt.ask(f"({blocks_per_day - blocks_remaining_to_assign + 1}/{blocks_per_day}) How many blocks for [bold]{area_name}[/bold]? (max: [bold][cyan]{max_blocks}[/bold][/cyan])", default=0)) if blocks_assigned > blocks_remaining_to_assign: - print(f"[red][bold]Error![/red] You have assigned more blocks than you have available today. Please try again.") + print("[red][bold]Error![/red] You have assigned more blocks than you have available today. Please try again.") raise InvalidUserInput if blocks_assigned > blocks['allocated'] - blocks['completed']: - print(f"[red][bold]Error![/red][/bold] You have assigned more blocks than are remaining in this area. Please try again.") + print("[red][bold]Error![/red][/bold] You have assigned more blocks than are remaining in this area. Please try again.") raise InvalidUserInput blocks_remaining_to_assign -= blocks_assigned @@ -110,7 +104,7 @@ def new_day(args: Namespace, db: TinyDBWrapper, data) -> None: today_areas[area_name] = blocks_assigned if blocks_remaining_to_assign > 0: - print(f"[red][bold]Error![/red][/bold] You have not assigned all your blocks. Please try again.") + print("[red][bold]Error![/red][/bold] You have not assigned all your blocks. Please try again.") raise InvalidUserInput if args.debug: diff --git a/src/fob/commands/info.py b/src/fob/commands/info.py new file mode 100644 index 0000000..a9cd302 --- /dev/null +++ b/src/fob/commands/info.py @@ -0,0 +1,14 @@ +from argparse import Namespace + +from fob.db.wrapper import TinyDBWrapper + + +def info(args: Namespace, db: TinyDBWrapper): + ''' + 'info' command displays basic metadata about this program. + + + Version + + Author + + License + ''' + raise NotImplementedError("This command has not been implemented yet.") diff --git a/src/fob/commands/new_month.py b/src/fob/commands/new_month.py index 562b08a..b184aa1 100644 --- a/src/fob/commands/new_month.py +++ b/src/fob/commands/new_month.py @@ -1,7 +1,6 @@ -from datetime import date, time +from datetime import date from calendar import monthrange from argparse import Namespace -from dataclasses import dataclass from rich.prompt import Prompt from rich import print diff --git a/src/fob/commands/overviews/day_checklist.py b/src/fob/commands/overviews/day_checklist.py index 6ac30fb..5a454d1 100644 --- a/src/fob/commands/overviews/day_checklist.py +++ b/src/fob/commands/overviews/day_checklist.py @@ -9,7 +9,7 @@ def display_checklist(args: Namespace, db: TinyDBWrapper) -> None: try: checklist = db.all()[0]['checklist'] - except KeyError: + except (IndexError, KeyError): print("[red][bold]No day data found.[/red][/bold]") print("Run [cyan][bold]fob gm[/cyan][/bold] to start a new day.") return diff --git a/src/fob/commands/overviews/month_overview.py b/src/fob/commands/overviews/month_overview.py index 8808509..528b17d 100644 --- a/src/fob/commands/overviews/month_overview.py +++ b/src/fob/commands/overviews/month_overview.py @@ -3,7 +3,6 @@ from calendar import monthrange from tinydb import where -from rich.pretty import pprint from rich.console import Console, Group from rich.panel import Panel from rich.progress import Progress, BarColumn, TaskProgressColumn, TextColumn, ProgressColumn @@ -49,10 +48,10 @@ def month_overview(args: Namespace, db: TinyDBWrapper) -> None: days_in_month = monthrange(today.year, today.month)[1] with m_progress: - task = m_progress.add_task(f"Month", total=days_in_month) + task = m_progress.add_task("Month", total=days_in_month) m_progress.update(task, completed=today.day) - task = m_progress.add_task(f"Work Days", total=data['work_days_allocated']) + task = m_progress.add_task("Work Days", total=data['work_days_allocated']) m_progress.update(task, completed=data['work_days_completed']) with progress: diff --git a/src/fob/commands/reset.py b/src/fob/commands/reset.py index 8dccc64..ae9b650 100644 --- a/src/fob/commands/reset.py +++ b/src/fob/commands/reset.py @@ -10,7 +10,7 @@ def reset(args: Namespace, db: TinyDBWrapper) -> None: - print(f"[red bold]Warning![/red bold] This will delete the database at the default path.") + print("[red bold]Warning![/red bold] This will delete the database at the default path.") if Prompt.ask("Are you sure?", choices=["yes", "no"], default="no") == "no": print("Reset cancelled.") return diff --git a/uv.lock b/uv.lock index 656f8bd..9154273 100644 --- a/uv.lock +++ b/uv.lock @@ -36,7 +36,7 @@ wheels = [ [[package]] name = "fob" -version = "0.1.0" +version = "0.2.0" source = { virtual = "." } dependencies = [ { name = "rich" },