未验证 提交 6fb53c64 编写于 作者: M Medya Ghazizadeh 提交者: GitHub

Merge pull request #10909 from afbjorklund/master-docs-fix

Fix the docs generation to be more deterministic
......@@ -56,6 +56,9 @@ func DocForCommand(command *cobra.Command) (string, error) {
if err := generateTitle(command, buf); err != nil {
return "", errors.Wrap(err, "generating title")
}
if err := rewriteLogFile(); err != nil {
return "", errors.Wrap(err, "rewriting log_file")
}
if err := rewriteFlags(command); err != nil {
return "", errors.Wrap(err, "rewriting flags")
}
......
......@@ -20,8 +20,24 @@ import (
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
// rewriteLogFile resets the magic "log_file" flag
// otherwise it starts out under $TMP somewhere
// and shows up as Changed, to default value ""
func rewriteLogFile() error {
flag := pflag.Lookup("log_file")
if flag != nil {
// don't show the default value
err := pflag.Set("log_file", "")
if err != nil {
return err
}
}
return nil
}
type rewrite struct {
flag string
usage string
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册