-
Notifications
You must be signed in to change notification settings - Fork 4
Prioritize defaultText over value in docs #9
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,8 @@ func expectFileContent(t *testing.T, file, got string) { | |
r := require.New(t) | ||
r.NoError(err) | ||
r.Equal( | ||
string(normalizeNewlines([]byte(got))), | ||
string(normalizeNewlines(data)), | ||
string(normalizeNewlines([]byte(got))), | ||
) | ||
} | ||
|
||
|
@@ -45,11 +45,12 @@ func buildExtendedTestCommand() *cli.Command { | |
Name: "greet", | ||
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "socket", | ||
Aliases: []string{"s"}, | ||
Usage: "some 'usage' text", | ||
Value: "value", | ||
TakesFile: true, | ||
Name: "socket", | ||
Aliases: []string{"s"}, | ||
Usage: "some 'usage' text", | ||
Value: "value", | ||
DefaultText: "value", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
TakesFile: true, | ||
}, | ||
&cli.StringFlag{Name: "flag", Aliases: []string{"fl", "f"}}, | ||
&cli.BoolFlag{ | ||
|
@@ -62,6 +63,11 @@ func buildExtendedTestCommand() *cli.Command { | |
Name: "hidden-flag", | ||
Hidden: true, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "dir", | ||
Value: pwd(), | ||
DefaultText: ".", | ||
}, | ||
Comment on lines
+66
to
+70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to be able to overwrite the default value with default text. In my example here the |
||
}, | ||
Commands: []*cli.Command{{ | ||
Aliases: []string{"c"}, | ||
|
@@ -182,6 +188,11 @@ func TestToTabularMarkdown(t *testing.T) { | |
}) | ||
} | ||
|
||
func pwd() string { | ||
pwd, _ := os.Getwd() | ||
return pwd | ||
} | ||
|
||
func TestToTabularMarkdownFailed(t *testing.T) { | ||
tpl := MarkdownTabularDocTemplate | ||
t.Cleanup(func() { MarkdownTabularDocTemplate = tpl }) | ||
|
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.
@joshuaswickirl i'm having a hard time wrapping my head around this. You say that DocGenerationFlag has removed GetValue ?? It's still there. So I'm confused why we need all this in the first place. Moreover there is no need to use reflection here. You should be able to use be existing functions to achieve the desired result
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.
urfave/cli#1988 (comment)
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.
Hi, thanks for your response.
I went to use the
DocGenerationFlag.GetDefaultText
but the response is different betweenValue
andDefaultText
. The string response for value is unquoted and for default text is unquoted. I'd assume that you would want the behavior to be the same betweenValue
andDefaultText
, if the value is the exact same string.It seems like the interface implementation is inconsistent but I haven't confirmed.
I'll push up the current state. I appreciate your time.