1[
2 {"type":"CommentHashbang","value":"#!/usr/bin/env -S v run\n"},
3 {"type":"CommentSingle","value":"// The shebang above associates the file to V on Unix-like systems,\n// so it can be run just by specifying the path to the file\n// once it's made executable using `chmod +x`.\n"},
4 {"type":"Text","value":"\n"},
5 {"type":"CommentSingle","value":"// print command then execute it\n"},
6 {"type":"KeywordDeclaration","value":"fn"},
7 {"type":"Text","value":" "},
8 {"type":"NameFunction","value":"sh"},
9 {"type":"Punctuation","value":"("},
10 {"type":"NameVariable","value":"cmd"},
11 {"type":"Text","value":" "},
12 {"type":"NameBuiltin","value":"string"},
13 {"type":"Punctuation","value":"){"},
14 {"type":"Text","value":"\n "},
15 {"type":"NameBuiltin","value":"println"},
16 {"type":"Punctuation","value":"("},
17 {"type":"LiteralStringDouble","value":"\"❯ "},
18 {"type":"Operator","value":"$"},
19 {"type":"NameVariable","value":"cmd"},
20 {"type":"LiteralStringDouble","value":"\""},
21 {"type":"Punctuation","value":")"},
22 {"type":"Text","value":"\n "},
23 {"type":"NameBuiltin","value":"print"},
24 {"type":"Punctuation","value":"("},
25 {"type":"NameBuiltin","value":"execute_or_exit"},
26 {"type":"Punctuation","value":"("},
27 {"type":"NameVariable","value":"cmd"},
28 {"type":"Punctuation","value":")."},
29 {"type":"NameVariable","value":"output"},
30 {"type":"Punctuation","value":")"},
31 {"type":"Text","value":"\n"},
32 {"type":"Punctuation","value":"}"},
33 {"type":"Text","value":"\n\n"},
34 {"type":"CommentSingle","value":"// Remove if build/ exits, ignore any errors if it doesn't\n"},
35 {"type":"NameBuiltin","value":"rmdir_all"},
36 {"type":"Punctuation","value":"("},
37 {"type":"LiteralStringSingle","value":"'build'"},
38 {"type":"Punctuation","value":")"},
39 {"type":"Text","value":" "},
40 {"type":"Keyword","value":"or"},
41 {"type":"Text","value":" "},
42 {"type":"Punctuation","value":"{"},
43 {"type":"Text","value":" "},
44 {"type":"Punctuation","value":"}"},
45 {"type":"Text","value":"\n\n"},
46 {"type":"CommentSingle","value":"// Create build/, never fails as build/ does not exist\n"},
47 {"type":"NameBuiltin","value":"mkdir"},
48 {"type":"Punctuation","value":"("},
49 {"type":"LiteralStringSingle","value":"'build'"},
50 {"type":"Punctuation","value":")"},
51 {"type":"KeywordDeclaration","value":"?"},
52 {"type":"Text","value":"\n\n"},
53 {"type":"CommentSingle","value":"// Move *.v files to build/\n"},
54 {"type":"NameVariable","value":"result"},
55 {"type":"Text","value":" "},
56 {"type":"Operator","value":":="},
57 {"type":"Text","value":" "},
58 {"type":"NameBuiltin","value":"execute"},
59 {"type":"Punctuation","value":"("},
60 {"type":"LiteralStringSingle","value":"'mv *.v build/'"},
61 {"type":"Punctuation","value":")"},
62 {"type":"Text","value":"\n"},
63 {"type":"Keyword","value":"if"},
64 {"type":"Text","value":" "},
65 {"type":"NameVariable","value":"result"},
66 {"type":"Punctuation","value":"."},
67 {"type":"NameVariable","value":"exit_code"},
68 {"type":"Text","value":" "},
69 {"type":"Operator","value":"!="},
70 {"type":"Text","value":" "},
71 {"type":"LiteralNumberInteger","value":"0"},
72 {"type":"Text","value":" "},
73 {"type":"Punctuation","value":"{"},
74 {"type":"Text","value":"\n\t"},
75 {"type":"NameBuiltin","value":"println"},
76 {"type":"Punctuation","value":"("},
77 {"type":"NameVariable","value":"result"},
78 {"type":"Punctuation","value":"."},
79 {"type":"NameVariable","value":"output"},
80 {"type":"Punctuation","value":")"},
81 {"type":"Text","value":"\n"},
82 {"type":"Punctuation","value":"}"},
83 {"type":"Text","value":"\n\n"},
84 {"type":"NameFunction","value":"sh"},
85 {"type":"Punctuation","value":"("},
86 {"type":"LiteralStringSingle","value":"'ls'"},
87 {"type":"Punctuation","value":")"}
88]
View as plain text