This repository was archived by the owner on Sep 9, 2020. It is now read-only.
fix -h, verison, and add global --dir flag with refactor#847
Merged
underrun merged 1 commit intoksonnet:masterfrom Sep 7, 2018
Merged
fix -h, verison, and add global --dir flag with refactor#847underrun merged 1 commit intoksonnet:masterfrom
underrun merged 1 commit intoksonnet:masterfrom
Conversation
Pull Request Test Coverage Report for Build 1318
💛 - Coveralls |
shomron
reviewed
Sep 4, 2018
| func genKsRoot(appName, ksDir, wd string) (string, error) { | ||
| if ksDir == "" { | ||
| return "", errors.New("invalid working directory") | ||
| func genKsRoot(appName, ksExecDir, newAppDir string) (string, error) { |
Collaborator
There was a problem hiding this comment.
A comment with examples of the different ways of calling would be helpful to me.
Collaborator
Author
There was a problem hiding this comment.
i will give an example or two, but i think the tests do a good job of showing all the cases?
| func removePersistentFlags(flags *pflag.FlagSet, args []string) []string { | ||
| flags.Visit(func(flag *pflag.Flag) { | ||
| for i, arg := range args { | ||
| if len(arg) == 0 || arg[0] != '-' || len(arg) == 1 { |
Collaborator
Author
There was a problem hiding this comment.
heh - yeah - just borrowed some of this code from cobra itself because i wanted to make sure i'm parsing flags the same way they do. i'll tweak it.
Collaborator
Author
There was a problem hiding this comment.
actually it needs to be this way but i'll add a comment
pkg/clicmd/prototype_use.go
Outdated
|
|
||
| // long flag that might be known by ks | ||
| splitFlag := strings.SplitN(arg[2:], "=", 2) | ||
| if splitFlag[0] == flag.Name { |
Collaborator
There was a problem hiding this comment.
We may run into trouble if we ever use FlagSet.SetNormalizeFunc.
571699b to
077e092
Compare
shomron
approved these changes
Sep 7, 2018
077e092 to
f499ad5
Compare
f499ad5 to
6817498
Compare
includes refactor moving app creation to later in the initialization process and only when needed. also fixes regression preventing commands that don't need an app from running outside an app directory. Signed-off-by: Derek Wilson <derek@heptio.com>
6817498 to
3ff6fb1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this addresses both #756 and #836 but requires moving app loading to action handling rather than during cli command processing.
there are still some messy bits and it could use tests before merge - but i'd like feedback on the refactor first. specifically is there a cleaner/better way to do this, and/or is there anything else along side app initialization that I could move to make command parsing and code execution more cleanly separated?