src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/mods/platform/platform.d.elv (about) 1 # The architecture of the platform; e.g. amd64, arm, ppc. 2 # This corresponds to Go's 3 # [`GOARCH`](https://pkg.go.dev/runtime?tab=doc#pkg-constants) constant. 4 # This is read-only. 5 var arch 6 7 # The name of the operating system; e.g. darwin (macOS), linux, etc. 8 # This corresponds to Go's 9 # [`GOOS`](https://pkg.go.dev/runtime?tab=doc#pkg-constants) constant. 10 # This is read-only. 11 var os 12 13 # Whether or not the platform is Unix-like. This includes Linux, macOS 14 # (Darwin), FreeBSD, NetBSD, and OpenBSD. This can be used to decide, for 15 # example, if the `unix` module is usable. 16 # This is read-only. 17 var is-unix 18 19 # Whether or not the platform is Microsoft Windows. 20 # This is read-only. 21 var is-windows 22 23 # Outputs the hostname of the system. If the option `&strip-domain` is `$true`, 24 # strips the part after the first dot. 25 # 26 # This function throws an exception if it cannot determine the hostname. It is 27 # implemented using Go's [`os.Hostname`](https://golang.org/pkg/os/#Hostname). 28 # 29 # Examples: 30 # 31 # ```elvish-transcript 32 # ~> platform:hostname 33 # ▶ lothlorien.elv.sh 34 # ~> platform:hostname &strip-domain=$true 35 # ▶ lothlorien 36 # ``` 37 fn hostname {|&strip-domain=$false| }