From c47a88c319676a73227fa5a70f54bb5dcfb6f191 Mon Sep 17 00:00:00 2001 From: Craig Everett Date: Mon, 18 Dec 2017 13:27:22 +0900 Subject: [PATCH] Breaking up & porting --- src/zx.erl | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/zx.erl b/src/zx.erl index 43ad019..c03de85 100644 --- a/src/zx.erl +++ b/src/zx.erl @@ -13,13 +13,21 @@ %%% @end -module(zx). --export([start/2, main/1]). +-behavior(application). +-author("Craig Everett "). +-copyright("Craig Everett "). +-license("GPL-3.0"). +-export([start/1, stop/0]). +-export([start/2, stop/1]). + -export_type([serial/0, package_id/0, package/0, realm/0, name/0, version/0, option/0, host/0, key_id/0, key_name/0, user/0, username/0, lower0_9/0, label/0, package_meta/0]). +-include("zx_logger.hrl"). + -record(s, {realm = "otpr" :: realm(), @@ -34,6 +42,9 @@ mon = none :: none | reference()}). + +%%% Type Definitions + -type state() :: #s{}. -type serial() :: integer(). -type package_id() :: {realm(), name(), version()}. @@ -58,18 +69,6 @@ --spec main(Args) -> no_return() - when Args :: [string()]. -%% @private -%% The automatically exposed function initially called by escript to kick things off. -%% Args is a list of command-line provided arguments, all presented as a list of strings -%% delimited by whitespace in the shell. - -main(Args) -> - ok = ensure_zomp_home(), - start(Args). - - -spec start(Args) -> no_return() when Args :: [string()]. %% Dispatch work functions based on the nature of the input arguments.