News for hackers. Stuff that matters.
Re:Astro 1.0 – a web framework for building fast, content-fo... by firesloth on Thursday August 11, 2022 @01:02PM (#32428695)
For nim, you could use something like 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
Re:Astro 1.0 – a web framework for building fast, content-fo... by firesloth on Saturday August 13, 2022 @04:34PM (#32453540)
Actually 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