Skip to content

Commit

Permalink
Merge pull request #36 from lcfd/report-works
Browse files Browse the repository at this point in the history
Report works
  • Loading branch information
lcfd authored Jan 8, 2024
2 parents 760b7fe + 4a38c4e commit ce1c0a8
Show file tree
Hide file tree
Showing 18 changed files with 661 additions and 342 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ or with `pipx`:
```bash
pipx install trakcli
```

### Brew

TBA
Expand Down Expand Up @@ -67,15 +68,15 @@ Run `poetry build` and then
pipx install ./dist/trakcli-x.x.x-py3-none-any.whl
```

to install `trak` usign the wheel file.
to install `trak` using the wheel file.

## Usage

The package has the useful `--help` command that will explain all the commands.
The package has the useful `--help` command that explains all the commands.

`trak --help`

The CLI will guide you through what you should and must do with messages with specific messages.
The CLI guides you through what you should and must do with specific messages.

### Basic commands

Expand All @@ -90,7 +91,7 @@ trak stop
trak status

# Show the amount of hours spend on the project
trak report <project-name>
trak report project <project-name>
```

Start tracking a billable project:
Expand Down
116 changes: 78 additions & 38 deletions cli/pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,35 @@ black = ">=23.9.1"
ruff = "^0.0.292"


[tool.pdm]
[tool.pdm.dev-dependencies]
dev = ["black>=23.9.1", "ruff<1.0.0,>=0.0.292", "pytest>=7.4.4"]

[tool.pdm.build]
includes = []
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[project]
authors = [
{ name = "Luca Fedrizzi", email = "[email protected]" },
]
license = { text = "AGPL-3.0" }
requires-python = ">=3.11,<4.0"
dependencies = ["typer[all]>=0.9.0"]
name = "trakcli"
version = "0.0.4"
description = "Keep a record of the time you dedicate to your projects."
readme = "README.md"
keywords = ["cli", "timetraker", "time", "traker", "tool"]

[project.urls]
"Trak on X" = "https://twitter.com/usetrakcom"
"Luca Fedrizzi's website" = "https://lucafedrizzi.com/"
"Luca Fedrizzi on X" = "https://twitter.com/lc_fd"
homepage = "https://usetrak.com/"
repository = "https://github.com/lcfd/trak"

[project.scripts]
trak = "trakcli.main:app"
1 change: 1 addition & 0 deletions cli/trakcli/create/commands/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def create_work(
to_date=to_date.strftime("%Y-%d-%m"),
description=description,
done=False,
paid=False,
)

if works is not None:
Expand Down
14 changes: 7 additions & 7 deletions cli/trakcli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from trakcli.projects.commands import app as projects_app
from trakcli.projects.database import get_projects_from_config
from trakcli.projects.utils.print_missing_project import print_missing_project
from trakcli.report.commands.main import report
from trakcli.report import app as report_app
from trakcli.utils.print_with_padding import print_with_padding
from trakcli.works import app as works_app

Expand All @@ -49,6 +49,9 @@
app.add_typer(projects_app, name="projects", help="Interact with your projects.")
app.add_typer(create_app, name="create", help="Create something in trak.")
app.add_typer(works_app, name="works", help="Interact with your works.")
app.add_typer(report_app, name="report", help="Get useful insights from your records.")

# app.command()(report)


@app.callback()
Expand Down Expand Up @@ -97,9 +100,6 @@ def main(
return


app.command()(report)


@app.command(name="start", help="Start a trak session.")
def start_tracker(
project: str,
Expand Down Expand Up @@ -249,7 +249,7 @@ def status(
)
else:
rprint(
Panel(
Panel.fit(
title="💬 Current status",
renderable=print_with_padding(
f"""Project: [bold]{current_session['project']}[/bold]
Expand All @@ -266,11 +266,11 @@ def status(
)
else:
rprint(
Panel(
Panel.fit(
title="💬 No active session",
renderable=print_with_padding(
(
"Ther aren't active sessions.\n\n"
"There is no ongoing session at the moment.\n\n"
"Use the command: trak start <project name> to start a new session of work."
)
),
Expand Down
9 changes: 9 additions & 0 deletions cli/trakcli/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import typer

from .commands.report_project import report_project

app = typer.Typer()


app.command("project")(report_project)
app.command("projects")(report_project)
Loading

0 comments on commit ce1c0a8

Please sign in to comment.