CDN-line Imports

Bring in the code you need

Just like one would add a CDN link to load Bootstap and use it's CSS classes, we can import libraries from git platforms and use their functions. By default it assumes Github, or recieve a full url to the "raw file" and import it from Codebarg or whatever else supporting the raw feature.

Import remote code, the CDN way

It use four flags:

  • -u : url (Full url to a raw file on any git platform)
  • -r : repo (Github repo as user/repo)
  • -b : branch (defaults to master)
  • -f : file (the file we want)
use "std/fmt"
import -r "user/repo" -f "file.sh"
import -u "https://codeberg.org/AndiKod/someRepo/raw/branch/master/someFile.sh"

main() {
  h1 "Testing the import() function"
  p "Print $(stuff_from_importedFile "arg1")"
  p "Or $(stuff_from_Codeberg "arg1" "arg2")"
}