This repository was archived by the owner on Aug 15, 2022. It is now read-only.
kd: add interactive mode for "credential create" - #9672
Merged
Conversation
rjeczalik
force-pushed
the
kd-credentials
branch
5 times, most recently
from
November 24, 2016 07:47
ffdae38 to
2e7c62a
Compare
- add "duration" type - improve title generation
rjeczalik
force-pushed
the
kd-credentials
branch
from
November 24, 2016 18:09
2e7c62a to
6409a20
Compare
cihangir
reviewed
Nov 24, 2016
| M map[string]interface{} `kloud:"someMap"` | ||
| E FooEnum `json:"enums" kloud:"someEnums"` | ||
| File []byte `kloud:",secret"` | ||
| N int `kloud:",readOnly"` |
Contributor
Author
There was a problem hiding this comment.
Nope, just one-letter names due to laziness - n is usually int, s is usually string etc.
cihangir
approved these changes
Nov 24, 2016
ppknap
approved these changes
Nov 25, 2016
|
|
||
| var titler = strings.NewReplacer("_", " ") | ||
|
|
||
| func title(s string) string { |
Contributor
There was a problem hiding this comment.
What about:
var re = regexp.MustCompile(`(\s*[[:upper:]]+|_)`)
func title(s string) string {
titleF := func(match string) string {
if rs := []rune(match); unicode.IsLower(rs[len(rs)-1]) {
// Format matches like AAAAa -> AAA Aa.
match = string(rs[:len(rs)-2]) + " " + string(rs[len(rs)-2:])
}
return " " + strings.Trim(match, "_ ")
}
return strings.Title(strings.TrimSpace(re.ReplaceAllStringFunc(s, titleF)))
}
Contributor
Author
There was a problem hiding this comment.
Ping. Merging for now.
I find it harder to reason as in your version there's more "magic" behind regexp functors.
However if you find a use-case that existing impl is not enough, feel encouraged to send PR with your version.
Contributor
There was a problem hiding this comment.
Because of this line. After some thought - my solution has quite similar level of complexity so lets left this as is.
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.
depends on #9666