Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure commands and rework output to use a package #37

Merged
merged 3 commits into from
Feb 23, 2024

Conversation

amisevsk
Copy link
Contributor

Description

  • Generally rework existing commands to avoid exporting variables/functions unnecessarily, remove global variables, etc.
  • Drop usage of viper for now, as we don't need it. Instead, pass global configuration options through the command's context.
  • Restructure commands' packages to have a consistent way of handling options, flags, etc. (cmd.go defines the command, .go defines the logic for running the command.
  • Add output package and pass all program output through it instead of using fmt.
  • Add -v|--verbose flag to print additional output; slim down output when verbose isn't used to make it a little cleaner.
  • Propagate commands context downwards rather than just using context.Background()

* Rework command subpackages to not export every function/variable
* Avoid use of global variables for state
* Remove usage of viper (for now); instead pass context directory via
  the command's context
* Make each subcommand have the same structure: cmd.go defines the
  command, <command-name>.go defines the logic for running the command.
Add pkg/output package to control logging and text output while running
commands. Package includes a debug log level, which can be enabled by
using the global flag '-v|--verbose'.

Add verbose logging to commands where appropriate and slim down
non-verbose log
Copy link
Contributor

@gorkem gorkem left a comment

Choose a reason for hiding this comment

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

lgtm

@amisevsk amisevsk merged commit 601d425 into main Feb 23, 2024
1 check passed
@amisevsk amisevsk deleted the rework-output branch February 23, 2024 21:59
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.

2 participants