Skip to content

do not pass config and user between cmd functions - #35

Merged
individual-it merged 1 commit into
mainfrom
globalVar
Nov 17, 2026
Merged

individual-it merged 1 commit into
mainfrom
globalVar

Conversation

@individual-it

Copy link
Copy Markdown
Member

this is on top of #33, so only review the last commit

Initializing and passing around the config and tmetricUser variables around the cmd package does not really make sense as they never change. Specially because initializing tmeztricUser results in API requests.
So better to initialize them once and reuse wherever needed.

@individual-it
individual-it requested review from PrajwolAmatya, ishabaral and saw-jan and a balanced review from Copilot and removed request for Copilot November 16, 2026 08:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The initialization hook blocks local-only commands when configuration is missing or the Tmetric API is unavailable, preventing guidance and shell completion from working without credentials or network access.

1 open issue
What changed in this PR

Centralizes configuration and Tmetric user initialization in the CLI, reducing parameter passing between command helpers. This refactor builds on the Jira diff integration from #33.

Changes:

  • Adds shared command state initialized through the root pre-run hook.
  • Updates check, copy, diff, and export commands to use that shared state.
  • Removes unused Cobra boilerplate comments.
File Description
jira/​jira.go Adds Jira worklog retrieval and filtering from #33.
jira/​issue.go Adds Jira project metadata from #33.
cmd/​tmetric.go Uses shared state in validation helpers.
cmd/​root.go Centralizes configuration and user initialization.
cmd/​export.go Uses shared state in export template helpers.
cmd/​diff.go Uses shared state alongside #33’s Jira comparison support.
cmd/​copy.go Calls shared initialization and simplifies entry checks.
cmd/​copy-openproject.go Removes configuration and user parameters from transfer helpers.
cmd/​copy-jira.go Removes configuration and user parameters from transfer helpers.
cmd/​check.go Removes unused flag-example comments.

Review effort: Balanced

Comment thread cmd/root.go Resolved
@individual-it
individual-it merged commit 075ec3f into main Nov 17, 2026
2 checks passed
@individual-it
individual-it deleted the globalVar branch November 17, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants