Skip to content

Commit 838eecd

Browse files
committed
Update scripting docs
1 parent 1d0c081 commit 838eecd

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

docs/scripting.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,40 @@ Use [Deno](https://deno.land):
9090
import fs from "npm:fs";
9191
```
9292

93-
### Rust, Go, C, C++, etc
93+
### Rust
94+
95+
```rust
96+
#!/usr/bin/env -S pkgx rust-script
97+
98+
//! ```cargo
99+
//! [dependencies]
100+
//! time = "0.1.25"
101+
//! ```
102+
```
103+
104+
> [!TIP]
105+
> Probably you should specify a more precise Rust version as a plus-pkg arg.
106+
107+
### Go, C, C++, etc
94108

95109
Use [Scriptisto]:
96110

97-
```sh
98-
#!/usr/bin/env -S pkgx +cargo scriptisto
111+
```c
112+
#!/usr/bin/env pkgx +clang +pkg-config scriptisto
113+
114+
#include <stdio.h>
115+
#include <glib.h>
116+
117+
// scriptisto-begin
118+
// script_src: main.c
119+
// build_cmd: clang -O2 main.c `pkg-config --libs --cflags glib-2.0` -o ./script
120+
// scriptisto-end
99121

100-
# snip… type `pkgx scriptisto new cargo` for the rest.
122+
int main(int argc, char *argv[]) {
123+
gchar* user = g_getenv("USER");
124+
printf("Hello, C! Current user: %s\n", user);
125+
return 0;
126+
}
101127
```
102128
103129
## Mash

0 commit comments

Comments
 (0)