dominikbraun / timetrace

A simple CLI for tracking your working time.
Apache License 2.0
668 stars 75 forks source link

Make help for `timetrace create record` sensitive for `use12hours` #190

Closed dominikbraun closed 2 years ago

dominikbraun commented 2 years ago

By default, timetrace uses a 24-hour-format: It uses 15:00, not 3:00PM. This can be changed by adding use12hours: true to the timetrace configuration.

If you want to know the syntax for timetrace create record, you can print the help. It has the following syntax:

timetrace create record <PROJECT KEY> {<YYYY-MM-DD>|today|yesterday} <HH:MM> <HH:MM> [flags]

The problem:

That usage help doesn't consider the use12hours setting. If the 12-hour-format is used, the <HH:MM>s should become <HH:MMPM> to make clear that AM and PM have to be used.

The solution:

The core.Timetrace type and its configuration is available in all command functions in the cli package:

https://github.com/dominikbraun/timetrace/blob/683e27d6caa067acce2b516106d85fab8ba3c2a6/cli/create.go#L51

The configuration can be obtained using t.Config(), and that config has the Use12Hours field. If this field is true, the help text should be changed accordingly.

sudiptog81 commented 2 years ago

Can work on this 👍