platform.d.elv 1.2 KB

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