kevinpapst / kimai2-console

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

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

Open adamgundry opened 2 years ago

adamgundry commented 2 years 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 2 years 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.