function parseOptions() {
    var option;
    var opts = {};
    var parser = new getopt.BasicParser('hvd:p:u:z:', process.argv);

    while ((option = parser.getopt()) !== undefined) {
        switch (option.option) {
            case 'd':
                opts.directory = path.normalize(option.optarg);
                break;

            case 'h':
                usage();
                break;

            case 'p':
                opts.port = parseInt(option.optarg, 10);
                break;

            case 'u':
                opts.user = option.optarg;
                break;

            case 'v':
                // Allows us to set -vvv -> this little hackery
                // just ensures that we're never < TRACE
                LOG.level(Math.max(pino.levels.values.trace, LOG.level - 10));

                if (LOG.level <= pino.levels.values.debug) {
                    LOG = LOG.child({ src: true });
                }
                break;

            case 'z':
                opts.password = option.optarg;
                break;

            default:
                usage('invalid option: ' + option.option);
                break;
        }
    }

    return opts;
}
Standard POSIX getopt-style options parser.

Some options, like directory/user/port are pretty cut and dry, but note
the 'verbose' or '-v' option afflicts the log level, repeatedly. So you
can run something like:

node main.js -p 80 -vv 2>&1 | npx pino-pretty

And the log level will be set to TRACE.