Fork me on GitHub
#yamlscript
<
2024-05-07
>
Ingy döt Net13:05:22

Started reading the BB book this morning and saw the https://book.babashka.org/#_running_a_script and decided to port it to YS for fun:

#!/usr/bin/env ys-0

# require babashka::http-client: => http

defn main(url=nil file=nil):
  when-not (url && file):
    say: 'Usage: <url> <file>'
    System/exit: 1
  write-html file: url.get-url().body

defn get-url(url):
  say: "Downloading url: $url"
  http/get: url

defn write-html(file html):
  say: "Writing file: $file"
  spit file: html
Might spur some questions here. ys is conceptually very similar to bb but with a different syntax and less mature / full featured to date...

Ingy döt Net13:05:18

@UBRV1HXPD which leads me to wonder your interests in using ys inside bb. I certainly want it to work of course... 🙂