5 ms·
"If you define a MAIN function, any parameters you give it will be automatically turned into CLI flags." This is actually cool
by llanowarelves 3y ago
"If you define a MAIN function, any parameters you give it will be automatically turned into CLI flags."
This is actually cool
- lagniappe 3y agoWhat other languages do this? I love it
- orthoxerox 3y agoPractically any language that supports reflection has a library for that.
- xmcqdpt2 3y agoScala 3 does it too https://docs.scala-lang.org/scala3/book/methods-main-methods.html https://docs.scala-lang.org/scala3/book/methods-main-methods...
- dwb 3y agonushell https://www.nushell.sh/book/modules.html#main https://www.nushell.sh/book/modules.html#main https://www.nushell.sh/book/custom_commands.html#flags https://www.nushell.sh/book/custom_commands.html#flags
- maleldil 3y agonushell[0] has this built-in. It's one of my favourite things about it. Python has typer[1] to do this with type hints. It's limited and gets ugly quickly, but I love it for simple scripts. [0] nushell.sh [1] typer.tiangolo.com