aboutsummaryrefslogtreecommitdiff
path: root/internal/options
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@rgdd.se>2023-03-26 18:31:10 +0200
committerRasmus Dahlberg <rasmus@rgdd.se>2023-03-26 18:31:10 +0200
commitf14b185dfe1fed4fdc951b91f3338359538c4832 (patch)
tree07af788813c2a18ea07a477583fd23e9a8a63ffc /internal/options
parentba6dd77c216149d663ea095ba4e5d77fcf78501e (diff)
Add option to specify [START,END) lines
Diffstat (limited to 'internal/options')
-rw-r--r--internal/options/options.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/internal/options/options.go b/internal/options/options.go
index b00d3f9..d01ba83 100644
--- a/internal/options/options.go
+++ b/internal/options/options.go
@@ -7,9 +7,10 @@ import (
type Options struct {
// Input file
- InputFile string
- MaxFileBuffer int
- NextLine int64
+ InputFile string
+ MaxFileBuffer int
+ StartLineInclusive int64
+ EndLineExclusive int64
// Website visits
NumWorkers int
@@ -25,7 +26,8 @@ type Options struct {
func Parse() (opts Options) {
flag.StringVar(&opts.InputFile, "i", "", "input file, one domain name per line")
flag.IntVar(&opts.MaxFileBuffer, "b", 512, "max bytes to read from input file at once in MiB")
- flag.Int64Var(&opts.NextLine, "n", 0, "next line to start reading the input file from")
+ flag.Int64Var(&opts.StartLineInclusive, "s", 0, "first line to read in input file, inclusive and zero-based index")
+ flag.Int64Var(&opts.EndLineExclusive, "e", 0, "last line to read in input file, exclusive and zero-based; 0 to disable")
flag.IntVar(&opts.NumWorkers, "w", 2, "number of parallel workers")
flag.DurationVar(&opts.Timeout, "t", 10*time.Second, "timeout for each website visit")