ipfilter icon indicating copy to clipboard operation
ipfilter copied to clipboard

Allow changing config file position, improved cli args parsing

Open TanyaEleventhGoddess opened this issue 2 years ago • 1 comments

Parsing is now managed through an implementation of https://mywiki.wooledge.org/ComplexOptionParsing using getopts & it's possible setting an arbitrary config file position

TanyaEleventhGoddess avatar Dec 21 '23 17:12 TanyaEleventhGoddess

Thank you for the PR.

I've actually already extended this way beyond just being able to specify a different config file for the upcoming release 5.0:

--==[ IP Filter Updater & Generator (ipfilter) ]==--

Usage: ipfilter.sh [OPTIONS]

Options:
  -u, --update-check        Check for newer release of IP Filter on
                            GitHub, print result and exit
  -i, --ibl-lists           List available blocklists for I-BlockList
                            and exit
  -g, --gl2-countries       List valid country names for GeoLite2 and
                            exit
  -p, --ip2l-countries      List valid country names for IP2Location
                            and exit
  -n, --notify-user         Send desktop notifications informing about
                            success, failure and newer releases (over-
                            rides config item NOTIFY_USER)
  -c, --config-file FILE    Load specified configuration file instead
                            of default one ('ipfilter.conf')
  -l, --log-file FILE       Write log output to specified file instead
                            of default one ('ipfilter.log') (overrides
                            config item LOG_FILE)
  -o, --output-file FILE    Write generated output to specified file
                            (overrides config item OUTPUT_FILE)
  -s, --skip-downloads      Skip all downloads and rely on existing
                            files instead (only makes sense when used
                            with '-t'/'--temp-dir')
  -t, --temp-dir PATH       Use specified existing temporary directory
                            instead of creating one (implies '-k'/'--
                            keep-temp')
  -k, --keep-temp           Do not remove temporary directory on exit
                            (implied by '-t'/'--temp-dir')
  -v, --verbose-output      Enable verbose output for both console and
                            log file (overrides config item VERBOSE_
                            OUTPUT)
  -h, --help                Display this help message

fonic avatar Dec 21 '23 18:12 fonic