package ppx_system
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
md5=008cac3324cdb0dde18a8e34ab61dd9d
sha512=ecca2ff8505051cf53b45acb1dca5d65cd1dc9e685436a4533f4eb62aeedfc704e5c91fbe9b50cc22e625e0a0f4f7fe5581284b5ac1186f106245ed4f1973f80
Description
Added to opam-repository:
README
ppx_system
ppx_system is a syntax extension to known host operating system at compile time.
Installation
$ git clone https://github.com/Psi-Prod/ppx_system
$ opam install .Usage
Add the following stanza to your dune file:
(library
...
(preprocess
(pps ppx_system))Syntax
[%get_system]
Use [%get_system] to get the host system as a constructor:
# #require "ppx_system";;
# match [%get_system] with
| Darwin -> "Darwin"
| FreeBSD -> "FreeBSD"
| NetBSD -> "NetBSD"
| OpenBSD -> "OpenBSD"
| Unix -> "Unix"
| Win32 -> "Win32"
| Unknown sysname -> Printf.sprintf "Unknown system: %S" sysname
- : string = "Unix"[%system]
Five system are supported: Darwin, UNIX, Win32, FreeBSD, NetBSD, OpenBSD.
Assuming you are on UNIX:
# #require "ppx_system";;
# Printf.sprintf "You are on %s!"
[%system
{
darwin = "Darwin";
free_bsd = "FreeBSD";
net_bsd = "NetBSD";
open_bsd = "OpenBSD";
unix = "UNIX";
win32 = "Win32"
}]
- : string = "You are on UNIX!"# [%system { darwin = "open"; unix = "xdg-open" }];;
- : string = "xdg-open"Use the default field to set a default value if your system is not precised:
# [%system { free_bsd = "On FreeBSD"; default = "Not on FreeBSD" }];;
- : string = "Not on FreeBSD"An empty string is generated in case none of the provided field match the host system:
# [%system { darwin = "Darwin" }];;
- : string = ""Contributing
Pull requests, bug reports, and feature requests are welcome.
License
- GPL 3.0 or later. See license for more information.
Dev Dependencies (1)
-
odoc
with-doc
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building ppx_system with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 1.0 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure