Namdak Tonpa 6 years ago
parent
commit
4688037c19
3 changed files with 53 additions and 5 deletions
  1. 19 0
      include/api.hrl
  2. 33 4
      man/mad.htm
  3. 1 1
      man/mad_local.htm

+ 19 - 0
include/api.hrl

@@ -1,3 +1,22 @@
 -define(MAD,[compile/1,app/1,get/1,release/1,resolve/1,clean/1,
 -define(MAD,[compile/1,app/1,get/1,release/1,resolve/1,clean/1,
              start/1,attach/1,stop/1,sh/1,deps/1,up/1,fetch/1,
              start/1,attach/1,stop/1,sh/1,deps/1,up/1,fetch/1,
             static/1,eunit/1,strip/1]).
             static/1,eunit/1,strip/1]).
+
+-type return() :: [] | true | false | {ok,any()} | {error,any()}.
+
+-spec compile(list(string())) -> return().
+-spec app(list(string())) -> return().
+-spec get(list(string())) -> return().
+-spec release(list(string())) -> return().
+-spec resolve(list(string())) -> return().
+-spec clean(list(string())) -> return().
+-spec start(list(string())) -> return().
+-spec attach(list(string())) -> return().
+-spec stop(list(string())) -> return().
+-spec sh(list(string())) -> return().
+-spec deps(list(string())) -> return().
+-spec up(list(string())) -> return().
+-spec fetch(list(string())) -> return().
+-spec static(list(string())) -> return().
+-spec eunit(list(string())) -> return().
+-spec strip(list(string())) -> return().

+ 33 - 4
man/mad.htm

@@ -50,16 +50,45 @@
               static/1,eunit/1,strip/1]).
               static/1,eunit/1,strip/1]).
     </code></figure>
     </code></figure>
 
 
+    <figure><code>
+ -type return() :: [] | {ok,any()} | {error,any()}.
+    </code></figure>
+
+    <p>Each function from exposed API has same signature from list of string
+       to sum of nil and error protocols.</p>
+
+<h4>compile(list(string())) -> return().</h4>
+<h4>app(list(string())) -> return().</h4>
+<h4>get(list(string())) -> return().</h4>
+<h4>release(list(string())) -> return().</h4>
+<h4>clean(list(string())) -> return().</h4>
+<h4>start(list(string())) -> return().</h4>
+<h4>stop(list(string())) -> return().</h4>
+<h4>sh(list(string())) -> return().</h4>
+<h4>deps(list(string())) -> return().</h4>
+<h4>up(list(string())) -> return().</h4>
+<h4>sh(list(string())) -> return().</h4>
+<h4>fetch(list(string())) -> return().</h4>
+<h4>static(list(string())) -> return().</h4>
+<h4>eunit(list(string())) -> return().</h4>
+<h4>strip(list(string())) -> return().</h4>
+
     </section>
     </section>
     <section>
     <section>
         <h3>LOOP</h3>
         <h3>LOOP</h3>
+        <h4>main(list(string())) -> integer().</h4>
+        <p>Simple yet understandable command processing and error loop.
+           Function <b>atomize/1</b> helps to accumulate
+           known agruments as atoms. Function <b>profile/0</b>
+           retrives module with MAD API implementation.
+           <b>main/1</b> function returns error status to OS with halt.</p>
         <figure><code>
         <figure><code>
  main(Params) ->
  main(Params) ->
 
 
-   { Invalid, Valid } = lists:foldr(
-        fun (X,{C,R}) when is_atom(X) -> {[],[{X,C}|R]};
-                            (X,{C,R}) -> {[X|C],R} end,
-             {[],[]}, lists:map(fun atomize/1, Params)),
+   { _Invalid, Valid } = lists:foldr(
+     fun (X,{C,R}) when is_atom(X) -> {[],[{X,C}|R]};
+                         (X,{C,R}) -> {[X|C],R}
+     end, {[],[]}, lists:map(fun atomize/1, Params)),
 
 
    halt(return(
    halt(return(
      lists:any(fun({error,X}) -> mad:info("~s~n",[X]), true;
      lists:any(fun({error,X}) -> mad:info("~s~n",[X]), true;

+ 1 - 1
man/mad_local.htm

@@ -70,7 +70,7 @@
     <section>
     <section>
 
 
 <p>This module may refer to:
 <p>This module may refer to:
-<a href="mad_git.htm"><b>mad_git</b></a>.
+<a href="mad.htm"><b>mad</b></a>.
 </p>
 </p>
 
 
     </section>
     </section>