2.4 KiB
Report cli
Automate generating invoices.
Usage
Install/Getting started
Get .phar
file, run configuration wizzard.
Specs
A simple Console Command that prints out monthly report from youtrack.
Simple configuration:
- authentication token value
- project categories
- hourly wage
- folder for reports
Components
-
report service - provides a csv of a report
- local csv file read (provided via argument)
-
youtrack api request (with Guzzle and Youtrack API php client )
-
parse report
- compute hours per configured project categories from report
- output a table
-
Create an invoice
- send the invoice (to Wolfgang)
Motivation
- practice php
-
automatization of repetitive task
- is it worth it? according to xkcd table - you should spend 1 day for automating a monthly task that takes 30 minutes. That would be if only I'd be using this app. If it get's picked up, by 5 others - it is worth 5 days of development.
- remove errors from reports
Plan
-
Basic structure of the cli-app
-
App preparation
- nice specifications
- composer project
- autoloading & dependency injection
-
Report service
- read a local csv file
-
Parse report
- read configuration (project categories, hourly wage)
- simple table output
-
-
First round of enhancements
- Tests
- youtrack request
- create composer package, create executable
-
Second round of enhancements
- Invoice output
- configuration wizard
Learning
-
https://www.youtube.com/watch?v=aCqM9YnjTe0
- Choices (
new ChoiceQuestion
) addOption('config')
- Choices (
API calls
Get csv file
curl 'https://drunomics.myjetbrains.com/youtrack/api/reports/83-554/export/csv?&$top=-1' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H "Authorization: Bearer $TKN" > ~/Documents/Drunomics/workhours/2021/21-09.csv