ko1nksm / getoptions

An elegant option/argument parser for shell scripts (full support for bash and all POSIX shells)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Confusion about on: and no: in flag and option

shinokada opened this issue · comments

I'm confused about on: and no: in the flag and option.

When I set this:

flag FLAG_D -d +d on:ON no:NO

./advanced -d returns FLAG_D: ON and ./advanced +d returns FLAG_D: NO.

In the reference, it states:

on:STRING - The positive value
no:STRING - The negative value

So I expected ./advanced -d to return the negative value. In the above case, it is NO.

When I use a plus sign in set command, it causes these options to be turned off. Is it the same way getoptions working?
If it is so, what do the positive and negative values stand?

What am I missing here?

I'm sorry for the confusion. It's a documentation quality issue.

The meaning of - and + follows the general convention of options. For example, in the case of errexit, set -e will enable errexit, and set +e will disable it.

The on is the value when the option is specified with -, and + is the same as --no-*, when the meaning of the option is reversed.

Pull requests for documentation quality improvements are welcome. 😉