Skip to content

Organize --help#74

Merged
phillip-stephens merged 8 commits into
mainfrom
phillip/flagset-organize
May 5, 2026
Merged

Organize --help#74
phillip-stephens merged 8 commits into
mainfrom
phillip/flagset-organize

Conversation

@phillip-stephens
Copy link
Copy Markdown
Contributor

@phillip-stephens phillip-stephens commented May 4, 2026

It's always bothered me that the --help just didn't group annotation module flags together in separate sections.

This PR addresses that by dynamically constructing a --help(called Usage by the FlagSet library) string and grouping related flags together.

Old --help

Usage of flags:
  -censys
        censys internet intelligence
  -censys-pat string
        censys API personal access token (PAT)
  -censys-threads int
        how many enrichment threads to use. Note that free plan only allows 1 concurrent API request at a time (default 1)
  -geoasn
        annotate with Maxmind GeoLite/GeoIP ASN data
  -geoasn-database string
        path to Maxmind ASN database
  -geoasn-mode string
        how to open database: 'mmap' or 'memory' (default "mmap")
  -geoasn-threads int
        how many geoASN processing threads to use (default 5)
  -geoip2
        annotate with Maxmind GeoIP2/GeoLite data
  -geoip2-database string
        path to MaxMind GeoIP2/GeoLite database
  -geoip2-fields string
        city, continent, country, location, postal, registered_country, subdivisions, traits (default "*")
  -geoip2-language string
        what language geoip2 database is in (default "en")
  -geoip2-mode string
        how to open database: 'mmap' or 'memory' (default "mmap")
  -geoip2-threads int
        how many geoIP processing threads to use (default 5)
  ...

New --help

Usage: ./zannotate [global options] <-module [module-options]>...
At least one annotation module must be specified (e.g. -geoip2, -rdns, -routing).


Global Options:
  -input-decode-threads int
        number of golang processes to decode input data (e.g., json) (default 3)
  -input-file string
        ip addresses to read, use '-' for std in (default "-")
  -input-file-type string
        ips, csv, json (default "ips")
  -input-ip-field string
        key in JSON or column in CSV that contains IP address (default "ip")
  -log-file string
        where should JSON logs be saved
  -output-annotation-field string
        key that metadata is injected at, used for both CSV and JSON file inputs to preserve data in the input file (default "zannotate")
  -output-encode-threads int
        number of golang processes to encode output data (e.g., json) (default 3)
  -output-file string
        where should JSON output be saved, use '-' for stdout (default "-")
  -verbosity int
        log verbosity: 1 (lowest)--5 (highest) (default 3)

Censys Options:
  -censys
        censys internet intelligence
  -censys-pat string
        censys API personal access token (PAT)
  -censys-threads int
        how many enrichment threads to use. Note that free plan only allows 1 concurrent API request at a time (default 1)

GeoIP2 Options:
  -geoip2
        annotate with Maxmind GeoIP2/GeoLite data
  -geoip2-database string
        path to MaxMind GeoIP2/GeoLite database
  -geoip2-fields string
        city, continent, country, location, postal, registered_country, subdivisions, traits (default "*")
  -geoip2-language string
        what language geoip2 database is in (default "en")
  -geoip2-mode string
        how to open database: 'mmap' or 'memory' (default "mmap")
  -geoip2-threads int
        how many geoIP processing threads to use (default 5)

@phillip-stephens phillip-stephens marked this pull request as ready for review May 5, 2026 00:32
@phillip-stephens phillip-stephens requested a review from zakird May 5, 2026 00:33
@phillip-stephens phillip-stephens merged commit a1d72e0 into main May 5, 2026
3 checks passed
@phillip-stephens phillip-stephens deleted the phillip/flagset-organize branch May 5, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants