-
Notifications
You must be signed in to change notification settings - Fork 63
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
Adding Global Flag in Modern CLI #180
Conversation
@@ -17,6 +17,7 @@ type Root struct { | |||
configFilename string | |||
loggingLevel int | |||
outputType string | |||
inputType string |
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.
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.
This is a good question. Where should we put all these back-compat switches. They are needed either when the customer uses the query
subcommand, or when the use uses no subcommand (which is defined in this Root type!).
Should we add all these back-compat switches to the Query subcommand, and then have them accessable to the Root when no subcommand is provided.
DefaultString: "yaml", | ||
Name: "InputFile", | ||
Shorthand: "i", | ||
Usage: "output type (yaml, json or xml)", |
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.
this implies 3 different concepts -
- input type
- input file name
- Output type
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 think this is a copy and paste error (from outputType above)
The sqlcmd package defines the main parameter structure for the query command, here https://github.com/microsoft/go-sqlcmd/blob/main/pkg/sqlcmd/connect.go What I think you would do is update query.go here https://github.com/microsoft/go-sqlcmd/blob/main/cmd/modern/root/query.go to define the new modern command structure. That command implementation will construct a Connect object to pass to the Sqlcmd instance to do its work. |
I've added discussion #193 to work through how we do this, we can use this PR as a proof point. Part of the issue here is we need to make, in this case, the -i switch available on the root command (for back-compat), and on the query subcommand. What's the best way to wire this up. Add the -i flag to query.go, and somehow provide a mechanism to also have it made available on the root command (when no sub-command is presented). We also need to deal with when to show help. Presuming we make it so the -i command works when no sub-command is added, should we show help for -i when |
In order to migrate all the commands from Kong to Modern CLI,
I have started with one flag here : InputFile.