-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello.phz
44 lines (31 loc) · 1.19 KB
/
hello.phz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!-- phz -->{{/*
hello.phz - A simple showcase of the current state of the phz language
*/}}# Global Variables
* HomeDir: {{.Env.HOME}}
* PWD: {{.Env.PWD}}
* WhoAmI: {{.Env.USER}}
# Execution Variables
* Now: {{.Now}}
* Form: {{.Form}} <!-- web -->
* Req: {{.Req}} <!-- web -->
* Header: {{.Header}} <!-- web -->
* IP: {{.IP}} <!-- web -->
* Args: {{.Args}} (first: {{ index .Args 0 }}) <!-- nonweb -->
* Host: {{.Host}} <!-- web -->
<!-- TODO: Cache, TmpFile, Cookie, DB, -->
# Template Functions
* add, minus, mul, div, mod, pow, sha256, argon2id
* safeURL, safeHTML
* basename, join (rename to pathjoin ?)
<!-- comments are not printed, but any new-lines afterwards are! -->
OS Exec (whoami): {{ exec "whoami" }}
OS Exec (uname -a): {{ exec "uname -a" }}
Built-In Aquachain wrapper:
Latest block: {{ aqua "aqua.getBlock('latest').number" }}
Number of peers: {{ aqua "net.peerCount" }}
[Math Test] (x = 100, y = 400, z = 500) {{ $x := 100 }}{{ $y := 400 }}{{ $z := 500 }}
Adding: (add x y z) {{ add (add $x $y) $z }}
Redefine: (x = y-z, print x) {{ $x = minus $y $z }}{{ $x }}
[Hashes]
sha256={{ sha256 "sha256" | printf "%x" }}
argon2id={{ argon2id "argon2id" | printf "%x" }}