watercooler-labs / toggl-cli

πŸ• Command Line App for Toggl Track
MIT License
31 stars 7 forks source link

🌌 Resolve tracking config templates #53

Closed shantanuraj closed 1 year ago

shantanuraj commented 1 year ago

:star2: What does this PR do?

:bug: Recommendations for testing

['*']
description = "πŸ”¨ {{branch}} / {{current_dir}}"
project = "{{parent_base_dir}}"
billable = true

['alt']
description = "chore(release)"
project = "{{base_dir}}"
tags = ["release", "{{parent_dir}}"]
billable = false

# Match all branches that start with a number and a slash
# e.g. 1234/feature-branch
['^\d+/.*']
description = "πŸ”¨ {{branch}}"
project = "{{parent_dir}}/{{base_dir}}"
# Set task to android if the current directory contains "android"
# otherwise set it to iOS
task = """
  {{$if [[ "$PWD" == *"android"* ]]; then echo "Android"; else echo "iOS"; fi}}
"""
# Set tags to the current year
tags = ["code", "{{$ date +\"%Y\" }}"]
billable = true

New commands introduced

# Get active tracking configuration for current directory and branch
$ toggl config active

:memo: Links to relevant issues/docs

See #45 which defines the marcro expansion mechanism.

:speech_balloon: Summarise how you feel about this PR with a gif/image

negroni-sbagliato