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
Experiemntal CLI - initial commit #741
base: master
Are you sure you want to change the base?
Conversation
Add WithVersion option to both Main and Run
github.com/sethvargo/go-retry v0.2.4 | ||
github.com/stretchr/testify v1.9.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've given up trying to fight this, the rest of the community tends to favor this as the defacto assertion library. Instead of maintaining our own ./internal/check we should just use this.
@@ -42,6 +44,10 @@ var ( | |||
var version string | |||
|
|||
func main() { | |||
if ok, err := strconv.ParseBool(os.Getenv("GOOSE_CLI")); err == nil && ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to avoid a long-running feature branch, so this gate is to allow us to iterate and also use it in real-world projects.
This PR stubs out a new
cli
package forgoose
. There are no changes with the existinggoose
CLI code and everything is gated behind a feature flagGOOSE_CLI=1
.Some highlights
Help for every command (
--help
and-h
)Will output nicely formatted help (currently only supports the
goose status
command, but others will quickly follow)JSON support (
--json
)It supports
--json
out-of-the-box, e.g.,Returns output that can be used programmatically, recently brought up by @witsch in #420 (comment), but requested for a long time #225, #350, etc.
Driver and dialect automatically inferred from dbstring
We can infer the dialect based on the supplied DSN (called
--dbstring
).Previously goose had the caller supply a driver name AND a dbstring, but the former is not necessary and we already know ahead of time which databases we support so we can used a handy package to map that connection string to a dialect, https://github.com/xo/dburl#database-schemes-aliases-and-drivers.
goose [OPTIONS] DRIVER DBSTRING COMMAND
where the DRIVER AND DBSTRING are automatically converted to--dbstring
?Use a lightweight framework for composing CLI
...
Expose the CLI code to users
These 2 functions will be available to users so they can integrate goose into their own applications and get the same CLI experience. Should resolve a few requests like this one #646