2020-11-18 01:12:37 +00:00
|
|
|
package main
|
|
|
|
|
|
2021-03-13 00:42:38 +00:00
|
|
|
import "github.com/urfave/cli/v2"
|
2020-11-18 01:12:37 +00:00
|
|
|
|
|
|
|
|
const (
|
2021-08-24 12:50:03 +00:00
|
|
|
outfileFlagName = "outfile"
|
|
|
|
|
debugFlagName = "debug"
|
|
|
|
|
fleetCertificateFlagName = "fleet-certificate"
|
2022-05-10 13:44:06 +00:00
|
|
|
stdoutFlagName = "stdout"
|
2020-11-18 01:12:37 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func outfileFlag() cli.Flag {
|
2021-03-13 00:42:38 +00:00
|
|
|
return &cli.StringFlag{
|
|
|
|
|
Name: outfileFlagName,
|
|
|
|
|
Value: "",
|
|
|
|
|
EnvVars: []string{"OUTFILE"},
|
|
|
|
|
Usage: "Path to output file",
|
2020-11-18 01:12:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getOutfile(c *cli.Context) string {
|
|
|
|
|
return c.String(outfileFlagName)
|
|
|
|
|
}
|
2021-02-03 02:55:16 +00:00
|
|
|
|
|
|
|
|
func debugFlag() cli.Flag {
|
2021-03-13 00:42:38 +00:00
|
|
|
return &cli.BoolFlag{
|
|
|
|
|
Name: debugFlagName,
|
|
|
|
|
EnvVars: []string{"DEBUG"},
|
|
|
|
|
Usage: "Enable debug http request logging",
|
2021-02-03 02:55:16 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getDebug(c *cli.Context) bool {
|
|
|
|
|
return c.Bool(debugFlagName)
|
|
|
|
|
}
|
2021-08-24 12:50:03 +00:00
|
|
|
|
|
|
|
|
func fleetCertificateFlag() cli.Flag {
|
|
|
|
|
return &cli.StringFlag{
|
|
|
|
|
Name: fleetCertificateFlagName,
|
|
|
|
|
EnvVars: []string{"FLEET_CERTIFICATE"},
|
|
|
|
|
Usage: "Path of the TLS fleet certificate, can be used to provide additional connection debugging information",
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getFleetCertificate(c *cli.Context) string {
|
|
|
|
|
return c.String(fleetCertificateFlagName)
|
|
|
|
|
}
|
2022-05-10 13:44:06 +00:00
|
|
|
|
|
|
|
|
func stdoutFlag() cli.Flag {
|
|
|
|
|
return &cli.BoolFlag{
|
|
|
|
|
Name: stdoutFlagName,
|
|
|
|
|
EnvVars: []string{"STDOUT"},
|
|
|
|
|
Usage: "Print contents to stdout",
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getStdout(c *cli.Context) bool {
|
|
|
|
|
return c.Bool(stdoutFlagName)
|
|
|
|
|
}
|