From db1128ab524bcfad10fa81760c5f6eed66a570ce Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Sat, 16 Jun 2018 23:13:14 -0400 Subject: [PATCH] Update documentation --- app/lib/exec/Readme.md | 15 +++ app/lib/mscript/Readme.md | 267 ++++++++++++++++++++++---------------- 2 files changed, 170 insertions(+), 112 deletions(-) create mode 100644 app/lib/exec/Readme.md diff --git a/app/lib/exec/Readme.md b/app/lib/exec/Readme.md new file mode 100644 index 0000000..7724e22 --- /dev/null +++ b/app/lib/exec/Readme.md @@ -0,0 +1,15 @@ + + +## exec(cmd, arg, opts) ⇒ Promise.<{stdout: string, stderr: stderr}> +Promisified child_process.exec + +**Kind**: global function + +| Param | Type | Description | +| --- | --- | --- | +| cmd | | | +| arg | | | +| opts | | See child_process.exec node docs | +| opts.stdout | stream.Writable | If defined, child process stdout will be piped to it. | +| opts.stderr | stream.Writable | If defined, child process stderr will be piped to it. | + diff --git a/app/lib/mscript/Readme.md b/app/lib/mscript/Readme.md index 93bfafb..cfb7fdb 100644 --- a/app/lib/mscript/Readme.md +++ b/app/lib/mscript/Readme.md @@ -3,134 +3,177 @@ ## lib/mscript * [lib/mscript](#module_lib/mscript) - * [~mscript](#module_lib/mscript..mscript) - * [.arg(shrt, lng)](#module_lib/mscript..mscript.arg) ⇒ boolean - * [.arg_pos(shrt, lng)](#module_lib/mscript..mscript.arg_pos) ⇒ boolean - * [.state_clear()](#module_lib/mscript..mscript.state_clear) - * [.alts_unique()](#module_lib/mscript..mscript.alts_unique) - * [.interpret()](#module_lib/mscript..mscript.interpret) - * [.last_loop()](#module_lib/mscript..mscript.last_loop) - * [.parent_loop()](#module_lib/mscript..mscript.parent_loop) - * [.state_update()](#module_lib/mscript..mscript.state_update) - * [.str_to_arr()](#module_lib/mscript..mscript.str_to_arr) - * [.light_state()](#module_lib/mscript..mscript.light_state) - * [.light_to_arr()](#module_lib/mscript..mscript.light_to_arr) - * [.loop_count()](#module_lib/mscript..mscript.loop_count) - * [.fail()](#module_lib/mscript..mscript.fail) - * [.output()](#module_lib/mscript..mscript.output) - * [.init()](#module_lib/mscript..mscript.init) - * [.tests()](#module_lib/mscript..mscript.tests) + * [~Mscript](#module_lib/mscript..Mscript) + * [.clear()](#module_lib/mscript..Mscript+clear) + * [.interpret()](#module_lib/mscript..Mscript+interpret) + * [.basic_cmd()](#module_lib/mscript..Mscript+basic_cmd) + * [.new_loop()](#module_lib/mscript..Mscript+new_loop) + * [.end_loop()](#module_lib/mscript..Mscript+end_loop) + * [.move_cam()](#module_lib/mscript..Mscript+move_cam) + * [.move_proj()](#module_lib/mscript..Mscript+move_proj) + * [.set_state()](#module_lib/mscript..Mscript+set_state) + * [.last_loop()](#module_lib/mscript..Mscript+last_loop) + * [.parent_loop()](#module_lib/mscript..Mscript+parent_loop) + * [.loop_count()](#module_lib/mscript..Mscript+loop_count) + * [.fade()](#module_lib/mscript..Mscript+fade) + * [.fade_count()](#module_lib/mscript..Mscript+fade_count) + * [.fade_start()](#module_lib/mscript..Mscript+fade_start) + * [.fade_end()](#module_lib/mscript..Mscript+fade_end) + * [.update()](#module_lib/mscript..Mscript+update) + * [.str_to_arr()](#module_lib/mscript..Mscript+str_to_arr) + * [.light_to_arr()](#module_lib/mscript..Mscript+light_to_arr) + * [.light_state()](#module_lib/mscript..Mscript+light_state) + * [.fail()](#module_lib/mscript..Mscript+fail) - + -### lib/mscript~mscript -object mscript +### lib/mscript~Mscript +class Mscript -**Kind**: inner constant of [lib/mscript](#module_lib/mscript) +**Kind**: inner class of [lib/mscript](#module_lib/mscript) -* [~mscript](#module_lib/mscript..mscript) - * [.arg(shrt, lng)](#module_lib/mscript..mscript.arg) ⇒ boolean - * [.arg_pos(shrt, lng)](#module_lib/mscript..mscript.arg_pos) ⇒ boolean - * [.state_clear()](#module_lib/mscript..mscript.state_clear) - * [.alts_unique()](#module_lib/mscript..mscript.alts_unique) - * [.interpret()](#module_lib/mscript..mscript.interpret) - * [.last_loop()](#module_lib/mscript..mscript.last_loop) - * [.parent_loop()](#module_lib/mscript..mscript.parent_loop) - * [.state_update()](#module_lib/mscript..mscript.state_update) - * [.str_to_arr()](#module_lib/mscript..mscript.str_to_arr) - * [.light_state()](#module_lib/mscript..mscript.light_state) - * [.light_to_arr()](#module_lib/mscript..mscript.light_to_arr) - * [.loop_count()](#module_lib/mscript..mscript.loop_count) - * [.fail()](#module_lib/mscript..mscript.fail) - * [.output()](#module_lib/mscript..mscript.output) - * [.init()](#module_lib/mscript..mscript.init) - * [.tests()](#module_lib/mscript..mscript.tests) +* [~Mscript](#module_lib/mscript..Mscript) + * [.clear()](#module_lib/mscript..Mscript+clear) + * [.interpret()](#module_lib/mscript..Mscript+interpret) + * [.basic_cmd()](#module_lib/mscript..Mscript+basic_cmd) + * [.new_loop()](#module_lib/mscript..Mscript+new_loop) + * [.end_loop()](#module_lib/mscript..Mscript+end_loop) + * [.move_cam()](#module_lib/mscript..Mscript+move_cam) + * [.move_proj()](#module_lib/mscript..Mscript+move_proj) + * [.set_state()](#module_lib/mscript..Mscript+set_state) + * [.last_loop()](#module_lib/mscript..Mscript+last_loop) + * [.parent_loop()](#module_lib/mscript..Mscript+parent_loop) + * [.loop_count()](#module_lib/mscript..Mscript+loop_count) + * [.fade()](#module_lib/mscript..Mscript+fade) + * [.fade_count()](#module_lib/mscript..Mscript+fade_count) + * [.fade_start()](#module_lib/mscript..Mscript+fade_start) + * [.fade_end()](#module_lib/mscript..Mscript+fade_end) + * [.update()](#module_lib/mscript..Mscript+update) + * [.str_to_arr()](#module_lib/mscript..Mscript+str_to_arr) + * [.light_to_arr()](#module_lib/mscript..Mscript+light_to_arr) + * [.light_state()](#module_lib/mscript..Mscript+light_state) + * [.fail()](#module_lib/mscript..Mscript+fail) - + -#### mscript.arg(shrt, lng) ⇒ boolean -Check for the presence of specific arguments in process -argv +#### mscript.clear() +Clear the state of the script -**Kind**: static method of [mscript](#module_lib/mscript..mscript) -**Returns**: boolean - Is flag present - -| Param | Type | Description | -| --- | --- | --- | -| shrt | string | Short version of argument or flag | -| lng | string | Long version of argument or flag | - - - -#### mscript.arg_pos(shrt, lng) ⇒ boolean -Check for the position of specific arguments in process -argv - -**Kind**: static method of [mscript](#module_lib/mscript..mscript) -**Returns**: boolean - Position of arg or flag, for locating input - -| Param | Type | Description | -| --- | --- | --- | -| shrt | string | Short version of argument or flag | -| lng | string | Long version of argument or flag | - - - -#### mscript.state_clear() -Clear the state object - -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - - -#### mscript.alts_unique() -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + #### mscript.interpret() -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - +Main function, accepts multi-line string, parses into lines +and interprets the instructions from the text. Returns an array +of steps to be fed into the mcopy. + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.basic_cmd() +Apply a basic two character command + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.new_loop() +Start a new loop + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.end_loop() +Close the most recent loop + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.move_cam() +Move camera to explicitly-defined frame + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.move_proj() +Move projector to explicitly-defined frame + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.set_state() +Set the state of either the cam or projector + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + #### mscript.last_loop() -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - +Return the last loop + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + #### mscript.parent_loop() -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - +Return the second-last loop -#### mscript.state_update() -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - - -#### mscript.str_to_arr() -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - - -#### mscript.light_state() -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - - -#### mscript.light_to_arr() -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + #### mscript.loop_count() -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - +Extract the loop count integer from a LOOP cmd + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.fade() +Execute a fade of frame length, from color to another color + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.fade_count() +Extract the fade length integer from a FADE cmd + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.fade_start() +Extract the start color from a string + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.fade_end() +Extract the end color from a string + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.update() +Increase the state of a specific object, such as the camera/projector, +by the value defined in val + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.str_to_arr() +Split string on command, extract any integers from string + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.light_to_arr() +Split a string on a command to extract data for light array + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + + +#### mscript.light_state() +Split a string to extract an rgb color value + +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript) + #### mscript.fail() -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - +Throw an error with specific message -#### mscript.output() -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - - -#### mscript.init() -**Kind**: static method of [mscript](#module_lib/mscript..mscript) - - -#### mscript.tests() -Legacy tests. To be deprecated in future releases. - -**Kind**: static method of [mscript](#module_lib/mscript..mscript) +**Kind**: instance method of [Mscript](#module_lib/mscript..Mscript)