mirror of
https://github.com/hauler-dev/hauler.git
synced 2026-08-19 04:16:27 +00:00
20 lines
727 B
Go
20 lines
727 B
Go
package flags
|
|
|
|
import "github.com/spf13/cobra"
|
|
|
|
type CliRootOpts struct {
|
|
LogLevel string
|
|
HaulerDir string
|
|
IgnoreErrors bool
|
|
AuditLevel string
|
|
}
|
|
|
|
func AddRootFlags(cmd *cobra.Command, ro *CliRootOpts) {
|
|
pf := cmd.PersistentFlags()
|
|
|
|
pf.StringVarP(&ro.LogLevel, "log-level", "l", "", "Set the logging level (i.e. info, debug, warn) (defaults info)")
|
|
pf.StringVarP(&ro.HaulerDir, "haulerdir", "d", "", "Set the location of the hauler directory (default $HOME/.hauler)")
|
|
pf.BoolVar(&ro.IgnoreErrors, "ignore-errors", false, "Ignore/Bypass errors (i.e. warn on error) (defaults false)")
|
|
pf.StringVar(&ro.AuditLevel, "audit-level", "", "Set the audit logging level (none, standard, verbose) (defaults standard)")
|
|
}
|