From 5f852f11aed124df274d0c5257ec12f4e6373e7d Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sun, 19 May 2024 13:11:31 +0200 Subject: Add force flag Currently only overrides the number of workers. --- cmd/silentct-mon/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/silentct-mon/main.go b/cmd/silentct-mon/main.go index b11600f..cc0ef77 100644 --- a/cmd/silentct-mon/main.go +++ b/cmd/silentct-mon/main.go @@ -40,6 +40,7 @@ Options: -C, --contact A string that helps log operators know who you are, consider seting this to an email address (Default: "") -d, --directory Path to a directory where all state will be stored + -f, --force Override santity checks that may not be fatal (Default: false) -w, --num-workers Number of parallel workers to fetch each log with (Default: 1) -o, --output-file File that all output will be written to (Default: stdout) -e, --please-exit Toggle to only run until up-to-date (Default: false) @@ -54,6 +55,7 @@ type config struct { configFile string contact string directory string + force bool pleaseExit bool outputFile string pullInterval time.Duration @@ -71,6 +73,7 @@ func configure(cmd string, args []string) (cfg config, err error) { flagopt.StringOpt(fs, &cfg.configFile, "configuration", "c", "") flagopt.StringOpt(fs, &cfg.contact, "contact", "C", "") flagopt.StringOpt(fs, &cfg.directory, "directory", "d", "") + flagopt.BoolOpt(fs, &cfg.force, "force", "f", false) flagopt.UintOpt(fs, &cfg.numWorkers, "num-workers", "w", 1) flagopt.StringOpt(fs, &cfg.outputFile, "output-file", "o", "") flagopt.BoolOpt(fs, &cfg.pleaseExit, "please-exit", "e", false) @@ -84,7 +87,7 @@ func configure(cmd string, args []string) (cfg config, err error) { if cfg.directory == "" { return cfg, fmt.Errorf("directory is a required option") } - if cfg.numWorkers == 0 || cfg.numWorkers >= 4 { + if (cfg.numWorkers == 0 || cfg.numWorkers >= 4) && !cfg.force { return cfg, fmt.Errorf("number of workers must be in [1, 4)") } output := os.Stdout -- cgit v1.2.3