feat(config): add TOML config file support
- Add config.py with load_config(), find_default_config(), get_token(), and get_map_path() - Auto-discover timesheets.toml in cwd; override with --config flag - Priority: CLI flag > config file > env var / cwd default - Add timesheets.example.toml as a committed reference template - Add timesheets.toml to .gitignore to prevent accidental secret leakage - Document config file format in AGENTS.md
This commit is contained in:
parent
267ad5b1b5
commit
29698b1241
6 changed files with 183 additions and 5 deletions
18
AGENTS.md
18
AGENTS.md
|
|
@ -17,6 +17,7 @@ timesheets/
|
|||
├── parser.py # markdown table parsing, aggregation, date filtering
|
||||
├── projects.py # project_map.json loading and key resolution
|
||||
├── output.py # CSV writing and summary printing
|
||||
├── config.py # TOML config file loading and key extraction
|
||||
├── joplin.py # Joplin API integration (notebook traversal, note fetching)
|
||||
└── utils.py # shared low-level helpers (duration parsing, formatting, etc.)
|
||||
```
|
||||
|
|
@ -28,6 +29,7 @@ tests/
|
|||
├── test_utils.py
|
||||
├── test_parser.py
|
||||
├── test_projects.py
|
||||
├── test_config.py
|
||||
├── test_output.py
|
||||
└── test_joplin.py
|
||||
```
|
||||
|
|
@ -95,6 +97,22 @@ The API token can be provided via:
|
|||
|
||||
---
|
||||
|
||||
## Config file
|
||||
|
||||
Create `timesheets.toml` in your working directory (or pass `--config /path/to/file.toml`):
|
||||
|
||||
```toml
|
||||
[joplin]
|
||||
token = "your_api_token_here"
|
||||
|
||||
[projects]
|
||||
map = "/path/to/project_map.json"
|
||||
```
|
||||
|
||||
Priority order for each value: **CLI flag > config file > environment variable / default**.
|
||||
|
||||
---
|
||||
|
||||
## Joplin notebook structure
|
||||
|
||||
The `--joplin` flag expects the following notebook hierarchy in Joplin:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue