savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.42k stars 130 forks source link

Parsing the command line arguments #3409

Open vitoyucepi opened 1 year ago

vitoyucepi commented 1 year ago

Is your feature request related to a problem? Please describe. I'd like to get argv as a list instead of a function. It will make it possible to determine the number of arguments.

Describe the solution you'd like I believe only the first argument, which is not an option, should be treated as a script.

  1. liquidsoap 1.liq 2.liq will run liquidsoap with the script 1.liq. argv should be equal to ["1.liq", "2.liq"].
  2. ./1.liq 2.liq will run liquidsoap with the script 1.liq. argv should be equal to ["./1.liq", "2.liq"].
  3. If you want to add libraries, you can use the -L, --lib option which allows for multiple arguments. liquidsoap -L 2.liq --lib 3.liq 1.liq 1 2 will run liquidsoap with the script 1.liq. Additionally, 2.liq and 3.liq will be included. argv should be equal to ["1.liq", "1", "2"].

Describe alternatives you've considered N/A

Additional context N/A

Moonbase59 commented 9 months ago

Makes sense. Especially considering one might want to use LS to do some local stuff, like compute things on files, or create tests, mixes, etc.