11# ` mash `
22
3- mash up millions of open source packages into monstrously powerful scripts.
3+ Mash up millions of open source packages into monstrously powerful scripts.
44
55> [ !CAUTION]
66>
@@ -67,6 +67,24 @@ Many languages or interpreters nowadays provide clear methods for importing
6767language dependencies inside scripts, eg. ` deno ` , or ` bun ` . For other
6868languages, read on.
6969
70+ ### JavaScript
71+
72+ Use ` deno ` or ` bun ` . If you must use ` node ` then use [ ` scriptisto ` ] .
73+
74+ #### Rust
75+
76+ ``` rust
77+ #! / usr / bin / env - S pkgx rust - script
78+
79+ // ! ```cargo
80+ // ! [dependencies]
81+ // ! time = "0.1.25"
82+ // ! ```
83+ ```
84+
85+ > [ !TIP]
86+ > Probably you should specify a more precise Rust version as a plus-pkg arg.
87+
7088#### Ruby
7189
7290Use [ Bundler] ( https://bundler.io ) :
@@ -82,25 +100,52 @@ gemfile do
82100end
83101```
84102
85- #### Python, Go, Rust, Node, etc.
103+ #### Python
86104
87- Typically for everything else, use [ ` scriptisto ` ] , eg for Python :
105+ Use ` uvx ` :
88106
89107``` python
90- # !/usr/bin/env -S pkgx [email protected] +virtualenv scriptisto108+ # !/usr/bin/env -S pkgx [email protected] uv run --with requests<=3 --with rich109+
110+ import requests
111+ from rich.pretty import pprint
112+
113+ resp = requests.get(" https://peps.python.org/api/peps.json" )
114+ data = resp.json()
115+ pprint([(k, v[" title" ]) for k, v in data.items()][:10 ])
91116
92- # snip… type `scriptisto new python-pip` for the rest.
117+ ```
118+
119+ #### Go, Node, C/C++ etc.
120+
121+ Typically for everything else, use [ ` scriptisto ` ] , eg for C:
122+
123+ ``` c
124+ #!/usr/bin/env pkgx +clang +pkg-config scriptisto
125+
126+ #include < stdio.h>
127+ #include < glib.h>
128+
129+ // scriptisto-begin
130+ // script_src: main.c
131+ // build_cmd: clang -O2 main.c `pkg-config --libs --cflags glib-2.0` -o ./script
132+ // scriptisto-end
133+
134+ int main (int argc, char * argv[ ] ) {
135+ gchar* user = g_getenv("USER");
136+ printf("Hello, C! Current user: %s\n", user);
137+ return 0;
138+ }
93139```
94140
95141Use `scriptisto new` for a full listing of platforms Scriptisto makes
96142available.
97143
98-
99144### Making your scripts available to `mash`
100145
1011461. Fork [pkgxdev/mash]
1021472. Add scripts to `./scripts/`
103- 3 . Optionally edit the README adding a description
148+ 3. Optionally edit the README adding a description for each script
1041494. Push to your fork
1051505. Wait an hour and then check [mash.pkgx.sh]
106151
@@ -129,11 +174,13 @@ Once indexed your script can be run with:
129174
130175> [ !IMPORTANT]
131176> ` mash ` will not be able to run your script until it is indexed.
132- > If you can visit https://mash.pkgx.sh/USERNAME/SCRIPT-NAME then you’re
177+ > If you can visit https://mash.pkgx.sh/USERNAME/SCRIPT-NAME then your
133178> script has been indexed.
134179
135180> [ !NOTE]
181+ >
136182> ### Naming Guidelines: A Call for Consideration
183+ >
137184> Think for a little about the names you are picking. We reserve the right
138185> to rename egregious abuse of names and/or namespaces. If you feel a script
139186> is misnamed open a ticket for discussion.
0 commit comments