mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-01 14:47:38 +00:00
20 lines
346 B
Go
20 lines
346 B
Go
package flagutil
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"io"
|
|
"strings"
|
|
)
|
|
|
|
// WriteFlags writes all the explicitly set flags to w.
|
|
func WriteFlags(w io.Writer) {
|
|
flag.Visit(func(f *flag.Flag) {
|
|
lname := strings.ToLower(f.Name)
|
|
value := f.Value.String()
|
|
if IsSecretFlag(lname) {
|
|
value = "secret"
|
|
}
|
|
fmt.Fprintf(w, "-%s=%q\n", f.Name, value)
|
|
})
|
|
}
|