incredincomp / the_hunting

a vuln finding robot
GNU General Public License v3.0
6 stars 1 forks source link

better run time options.. getopts drives me crazy #22

Closed incredincomp closed 4 years ago

incredincomp commented 4 years ago

use the arg parse deal from @1efty that is now inside of install.sh

incredincomp commented 4 years ago

@1efty 652b171

1efty commented 4 years ago

@incredincomp let me try it out? I can explain better with a working example. However, considering https://github.com/1efty/fedora-workstation-setup/blob/master/scripts/lib.sh#L135, I noticed there isn't any references to shifting the arguments out of $@. In theory, $1 should be the argument (e.g. --excluded) and $2 should be the value. If it's just a flag only one shift is required, if it's an option/argument with a value two or more shifts may be required.

1efty commented 4 years ago

@incredincomp I would also move the logic of the argument into a separate function.

incredincomp commented 4 years ago

Thanks @1efty! Would love to see a PR too yo! The whole shifting thing is beyond me actually. Haven’t ever found a good source of info to explain it in a relevant sense for me..