kevinpapst / kimai2-console

Console application for Kimai remote access - time-tracking via bash
https://www.kimai.org/store/console-phar.html
MIT License
11 stars 1 forks source link

Don't prompt for a timesheet when only one is active #17

Open adamgundry opened 1 year ago

adamgundry commented 1 year ago

Thanks very much for this tool! I'm finding it very useful.

A small quality-of-life improvement that would be nice to see: when using kimai stop or kimai active -d and there is only one active timesheet, it would be nice if the prompt to select a timesheet was skipped. At the moment there is a prompt with only one option, which seems redundant:

kimai stop
 ----- -------------------------- ---------------------- ------------ ------------ ---------------------------------------------------------- ------ 
  ID    Started at                 Activity               Project      Customer     Description                                                Tags  
 ----- -------------------------- ---------------------- ------------ ------------ ---------------------------------------------------------- ------ 
  217   ...
 ----- -------------------------- ---------------------- ------------ ------------ ---------------------------------------------------------- ------ 

 Please select a timesheet:
  [0] 217
 > 0

 [OK] Stopped 1 active timesheet(s) with ID: 217                                                                        
kevinpapst commented 1 year ago

If you are up for a PR, just add an if in that line to check for the amount of active timesheets before asking: https://github.com/kevinpapst/kimai2-console/blob/master/src/Command/StopCommand.php#L58

Meanwhile you could also use kimai stop --all.