igor-petruk / scriptisto

A language-agnostic "shebang interpreter" that enables you to write scripts in compiled languages.
Apache License 2.0
909 stars 25 forks source link

Added to `pkgx` #43

Open mxcl opened 5 months ago

mxcl commented 5 months ago

I don’t usually reach out about packages I add to https://pkgx.sh but scriptisto is really neat and pkgx works well with it.

For example you can use pkgx to run scriptisto scripts and add other packages to the environment, eg. your demo script can have clang, pkg-config and glib added to the environment for users automatically using our shebang syntax.

#!/usr/bin/env -S pkgx +gnome.org/glib +pkg-config +clang scriptisto

#include <stdio.h>
#include <glib.h>

// scriptisto-begin
// script_src: main.c
// build_cmd: clang -O2 main.c `pkg-config --libs --cflags glib-2.0` -o ./script
// scriptisto-end

int main(int argc, char *argv[]) {
    gchar* user = g_getenv("USER");
    printf("Hello, C! Current user: %s\n", user);
    return 0;
}

I added this demo to mash which is our script package manager which could be a neat place for the community to make scriptisto scripts more broadly available:

$ mash demo scriptisto

Mash has a neat feature where you can run scripts without installing anything to the system via our cURL one liner:

sh <(curl https://mash.pkgx.sh) demo scriptisto

Anyway, just thought I'd post here in case you like it. If not feel free to close, otherwise I add a section to the wiki with your approval.

https://pkgx.dev/pkgs/github.com/igor-petruk/scriptisto/

igor-petruk commented 1 month ago

Yeah, looks really cool 👍

igor-petruk commented 1 month ago

Feel free to update the Wiki