4 ms·
For nim, you could use something like nimcr (https://nimble.directory/pkg/nimcr https://nimble.directory/pkg/nimcr). You put a shebang in your script `#!/usr/bi
by firesloth 4y ago
For nim, you could use something like nimcr (https://nimble.directory/pkg/nimcr https://nimble.directory/pkg/nimcr). You put a shebang in your script `#!/usr/bin/env nimcr` and then call it like a normal script.
eg:
$ code script.nim
#!/usr/bin/env nimcr
echo "hello world"
$ ./script.nim
hello world
edit:
There's also the possibility of using nimscript, using nim e. It works similarly but you'd change the shebang line to something like
#!/usr/bin/env nim e --hints:off
- firesloth 4y agoActually another way to do nimscript is to make a config.nims file with tasks in it. eg: In config.nims: switch("hints", "off") task hello, "say hello world": echo "hello world" In bash: $ nim hello hello world