h3rald / min

A small but practical concatenative programming language and shell
https://min-lang.org
MIT License
309 stars 23 forks source link

Passing args to a script #10

Closed mwgkgk closed 6 years ago

mwgkgk commented 6 years ago

Min tries to parse all args as filenames.

For a file like:

#!/usr/bin/env min

args puts

We get following results:

$ min demo.min
("demo.min")
$ min demo.min hello
(x) Cannot read from file: hello

We can pass stuff to our scripts using opts, and currently there's no overlap with min's options - either it terminates before running the script, like --help, or ignores the option and passes it to the script, like min -i demo.min. I imagine when there are more switches in the future the overlap will be awkward. Script options and interpreter options should be separate, based on positioning. Scripts should be able to have their own --help.

h3rald commented 6 years ago

Mmmm nasty... yep, fair enough, I’ll fix it so that only the first argument is treated as filename.

Thanks for reporting this!

mwgkgk commented 6 years ago

Thank you!