Methods
catchError(err, callback) → {callback}
This is a a fucntion that dispays error messages that is caught by a
failure in a cli applaiction of functions. this takes a string or
Object and returns back the error message of that string or Object
stoping the application once a eror is caught.
Parameters:
Name | Type | Description |
---|---|---|
err |
err | this is a err message that is a string or error object |
callback |
fucntion | this returns a error message of any kind |
Returns:
- Type
- callback
createApp(app_name)
This function creates a application tamplet for the the users cli application
using my-clib
Parameters:
Name | Type | Description |
---|---|---|
app_name |
string | this is your application name |
exArgs(method, flags_arr, data)
This function returns the result of a flag dispath_action function,
excuting all flags that were passed to the cli application in the
the array 'flags arr'.
Assigning the data to output so when it passes it to method
on the first run it does not reference the same value after running
the fucntion again passing a new value. Therefore changing the data
that was given to this function.
Parameters:
Name | Type | Description |
---|---|---|
method |
function | method of a dispath_action function |
flags_arr |
array | array of flags passed to the cli application |
data |
any | any data type cretaed by the cli application |
logger(dest_file, input_data, callback) → {callback}
This is a logger function that takes a file name to write log 'input_data'
to this is also takes the data whihc can be any data type and a callback to
return the data that was passed that is formated into log string.
This fucntion can optionaly take a callback fucntion to return the output
log string and a err if it has occured or return the log sting without the callback
Parameters:
Name | Type | Description |
---|---|---|
dest_file |
string | A string of the file path |
input_data |
any | the data passed to the logger which can be any type of data excet a function |
callback |
function | the call back that returns a err or log string |
Returns:
- Type
- callback
manual(action)
This function displays commands and description of the
of the cli application/tool from the clihelp.json file
passing the name of the command will show the command,
it's uses cases, and a description about the command.
If the fucntion recvies no action it displays all the
commnds in the cli tool.
Parameters:
Name | Type | Description |
---|---|---|
action |
string | the command from the cli tool |
onload(file_name, callback) → {callback}
Loads the JSON cli config 'cli.json' for the cli tool to use
Parameters:
Name | Type | Description |
---|---|---|
file_name |
string | give file name path that is a string |
callback |
function | a callback function that returns a {err} or that cli.json application config. |
Returns:
- Type
- callback
pipeline(arr_funcs, data) → {last_result}
This function takes a array functions called arr_func and some data of any
type weather it be a object, array, string ot interger, and passes it into
the function in the array to be mutated/changed then returns back that changed
data.
Parameters:
Name | Type | Description |
---|---|---|
arr_funcs |
array | array of functions |
data |
any | data of any data type |
Returns:
- Type
- last_result
prompt(placeholder, callback) → {callback}
This fucntion creates a prompt of stdin taking in a placeholder
to display a prompt symbol or message which is a sting and returns
a callback of that returns the recived data.
Parameters:
Name | Type | Description |
---|---|---|
placeholder |
string | this is a strnng that is a message or symbol |
callback |
function | a callback thta retruns a err or a stdout data from recived stdin data |
Returns:
- Type
- callback
save(path, data, callback) → {callback}
Saves a data of any type of input and writes to a given file name path of
that data then it must return a callback.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | file name |
data |
string | Object | number | array | any data type passed to the svae function |
callback |
function | callback returns a err or the saved data. |
Returns:
- Type
- callback
zip(arr1, arr2, callback) → {callbackResults}
This function goes through two arrays simultaneously
and executes the callback that is returned appending
the result of the callback to a array. Then returning
the array of the return data from the callback.
Parameters:
Name | Type | Description |
---|---|---|
arr1 |
array | array data type given |
arr2 |
array | array data type given |
callback |
function | the callback thet excutes whatever it is |
Returns:
- Type
- callbackResults
Type Definitions
dispatch_action()
This is a function that holds a swicth statement that triggers which comamnds
to excute in the sli application.
- Source:
err
This can be either a string or a Object holds a property alled errpr_message
or err_msg that is being passed throught the cli tool functions/application.
Type:
- string | Object
pasred_arguments
This is a Object that holds the parsed arguments that were passed from the
command line to the comand line application.
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
action |
string | The cli tool commmand |
payload |
array | The arguments that are not flags or actions, sucha as files, stings, or what ever that is consumed by the cli application |
flags |
array | This is flags that are used int he cli application |
- Source: