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

Feature: Add a --version flag to aid in debugging #201

Merged

Conversation

nicholasyager
Copy link
Collaborator

Description and motivation

As mentioned in #198, there is a distinct need to have a --version flag added to dbt-meshify to make it easier for users to identify which version of dbt-meshify they have installed. This PR adds this functionality, such that running dbt-meshify --version will print the current version number from the package information (as stored w/in the internals of python), and exit.

To accomplish this, I added the new option, and then added the invoke_without_command=True argument to click.group() to allow us to run code in the cli group when a command has not been provided. I then manually implemented a default check to print help text if a subcommand has not been provided.

Resolves: #200

Examples

$ dbt-meshify --version
0.5.2                 
$ dbt-meshify
Usage: dbt-meshify [OPTIONS] COMMAND [ARGS]...

Options:
  --dry-run
  --debug
  --version  Show version information and exit
  --help     Show this message and exit.

Commands:
  connect    Connects multiple dbt projects together by adding all...
  group      Creates a new dbt group based on the selection syntax...
  operation  Set of subcommands for performing mesh operations on dbt...
  split      Splits out a new subproject from a dbt project by adding all...
  version    Increment the models to the next version, and create in the...          

@nicholasyager nicholasyager added the enhancement New feature or request label Mar 23, 2024
@nicholasyager nicholasyager self-assigned this Mar 23, 2024
@dbeatty10 dbeatty10 mentioned this pull request Mar 24, 2024

assert result.exit_code == 0

help_result = result = runner.invoke(cli, ["--help"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this an intentional inclusion of result on this line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope! I'll fix that.

Copy link
Collaborator

@dave-connors-3 dave-connors-3 left a comment

Choose a reason for hiding this comment

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

pending comment on the test, but looks good otherwise!

Remove unexpected assignment.
@dave-connors-3 dave-connors-3 merged commit 4417c7d into dbt-labs:main Mar 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a --version flag
2 participants