caddyhttp: Implement caddy respond command (#4870)

This commit is contained in:
Matt Holt 2022-08-01 13:36:22 -06:00 committed by GitHub
parent ebd6abcbd5
commit f783290f40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 318 additions and 40 deletions

View file

@ -338,6 +338,7 @@ func flagHelp(fs *flag.FlagSet) string {
buf := new(bytes.Buffer)
fs.SetOutput(buf)
buf.Write([]byte("(NOTE: use -- instead of - for flags)\n\n"))
fs.PrintDefaults()
return buf.String()
}
@ -480,3 +481,16 @@ func CaddyVersion() string {
}
return ver
}
// StringSlice is a flag.Value that enables repeated use of a string flag.
type StringSlice []string
func (ss StringSlice) String() string { return "[" + strings.Join(ss, ", ") + "]" }
func (ss *StringSlice) Set(value string) error {
*ss = append(*ss, value)
return nil
}
// Interface guard
var _ flag.Value = (*StringSlice)(nil)