alex

/

v Public
0 Issues 1 Contributor 0 Releases 4 Branches
Additions: 46 Deletions: 0 View patch
1new file mode 100644
2+module main
3+
4+import net.http
5+import os
6+import clipboard
7+
8+fn main() {
9+ mut cb := clipboard.new()
10+
11+ if os.args.len < 3 {
12+ eprintln('Please provide a file')
13+ exit(1)
14+ }
15+
16+ if os.file_ext(os.args[2]) != '.v' {
17+ eprintln('Must be a V source file.')
18+ exit(1)
19+ }
20+
21+ if !os.is_file(os.args[2]) {
22+ eprintln('File not found.')
23+ exit(1)
24+ }
25+
26+ to_send := os.args[2]
27+
28+ content := os.read_file(to_send) or {
29+ eprintln(err)
30+ exit(1)
31+ }
32+
33+ share := http.post_form('https://play.vlang.io/share', {
34+ 'code': content
35+ })!
36+ url := 'https://play.vlang.io/p/${share.body}'
37+
38+ cb.copy(url)
39+ println(url)
40+}
41
1 'self',
2 'setup-freetype',
3 'shader',
4+ 'share',
5 'should-compile-all',
6 'symlink',
7 'scan',
8
1
2 setup-freetype Setup thirdparty freetype on Windows.
3
4+ share Send your code to the V Playground
5+
6 translate Translate C code to V.
7
8 tracev Produce a tracing version of the v compiler.
9
1new file mode 100644
2+Send your code to the V Playground
3+
4+Usage:
5+ v share FILE
6\ No newline at end of file
7