majjoha / sloth

A lazy, functional programming language.
https://github.com/majjoha/sloth
GNU General Public License v3.0
2 stars 0 forks source link

Use `getopt` to parse command line arguments. #3

Closed majjoha closed 9 years ago

majjoha commented 9 years ago

As we continuously add more options to the stack machine, it becomes cumbersome to handle each one, and we increase the risk of introducing errors related to array indices. This commit changes the way we parse command line arguments by using getopt instead.

It also changes the --verbose flag to -v, and the --manualstep flag to simply -m. The latter now sets both the verbose flag, and the manual step flag.

See more about getopt here: http://www.gnu.org/software/libc/manual/html_node/Example-of-Getopt.html

engesgaard commented 9 years ago

This is a much better way to handle optional arguments.