Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow changing config file position, improved cli args parsing #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TanyaEleventhGoddess
Copy link

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

@fonic
Copy link
Owner

fonic commented Dec 21, 2023

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

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