Skip to content

Conversation

@JMavs
Copy link

@JMavs JMavs commented Mar 1, 2023

Now you can execute sqlfmt -v to know the current version.

Long: "Formats SQL statements from stdin to line length n.",
RunE: runSQLFmt,
Use: "sqlfmt",
Version: "1.5.1",
Copy link
Owner

Choose a reason for hiding this comment

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

Thank you for your contribution @JMavs !!!

Can we define the version in a const or get the value present in the Makefile somehow? Its 100% likely that I will forget to update the value in two places in the next release and thus, give incorrect data to the user.

@lopezator
Copy link
Owner

Another question, what happens if we mix the flag --version with sql input (or other flags) passed to sqlfmt?

We should act as the --help does, exiting and doing nothing but the version in that case.

@lopezator
Copy link
Owner

Another question, what happens if we mix the flag --version with sql input (or other flags) passed to sqlfmt?

We should act as the --help does, exiting and doing nothing but the version in that case.

Example:

> ~$ sqlfmt --len 100 <<< 'select * from users';
SELECT * FROM users

Works.

> ~$ sqlfmt --len 100 --help <<< 'select * from users';
SELECT * FROM users

Exits and prints just the help. --version should do the same.

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