Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
all: relocate beterraba types into, uh, a type file
| 0
diff --git a/beterraba/beterraba.ha b/beterraba/beterraba.ha deleted file mode 100644 index df870627ea60f958fa8afd30611fa6ce615ddf53..0000000000000000000000000000000000000000 --- a/beterraba/beterraba.ha +++ /dev/null @@ -1,45 +0,0 @@ -use os::exec; - -// TODO: Include things like enabled/disabled? -export type status = enum { - STOPPED, - STARTED, - CRASHED -}; - -// A service definition is just the parsed out contents of the service, like -// which commands to execute, what args, the working directory and it's reload, -// etc -export type servdef = struct { - name: str, - desc: str, - cmd: str, - args: str, - wd: str, - reloadcmd: str -}; - -// A service is the actual service to be executed. It contains a [[servdef]] -// which it sources its info to be processed. A service contains a state and -// more info regarding the process itself (like PID, exit status, etc) -export type service = struct { - name: str, - desc: str, - status: status, - definition: servdef, - process: exec::process -}; - -// Maps a [[service]] status into a friendly message -export fn strstatus(s: status) const str = { - switch (s) { - case status::STARTED => - return "Started"; - case status::CRASHED => - return "Crashed"; - case status::STOPPED => - return "Stopped"; - case => - return "Unknown value"; - }; -}; diff --git a/beterraba/types.ha b/beterraba/types.ha new file mode 100644 index 0000000000000000000000000000000000000000..df870627ea60f958fa8afd30611fa6ce615ddf53 --- /dev/null +++ b/beterraba/types.ha @@ -0,0 +1,45 @@ +use os::exec; + +// TODO: Include things like enabled/disabled? +export type status = enum { + STOPPED, + STARTED, + CRASHED +}; + +// A service definition is just the parsed out contents of the service, like +// which commands to execute, what args, the working directory and it's reload, +// etc +export type servdef = struct { + name: str, + desc: str, + cmd: str, + args: str, + wd: str, + reloadcmd: str +}; + +// A service is the actual service to be executed. It contains a [[servdef]] +// which it sources its info to be processed. A service contains a state and +// more info regarding the process itself (like PID, exit status, etc) +export type service = struct { + name: str, + desc: str, + status: status, + definition: servdef, + process: exec::process +}; + +// Maps a [[service]] status into a friendly message +export fn strstatus(s: status) const str = { + switch (s) { + case status::STARTED => + return "Started"; + case status::CRASHED => + return "Crashed"; + case status::STOPPED => + return "Stopped"; + case => + return "Unknown value"; + }; +};