Commit bef8d7b5 authored by Jarrod's avatar Jarrod 💬

Fluff out more stuff

parent 8294d5d7
extends layout.pug
block body
//- pre
= JSON.stringify(mp, null, 4)
include machine/usage
h2= '.' + method + '()'
p= machine.description
h2 Usage
pre
code.javascript
= 'const ' + name + ' = require(\'' + mp.name + '\');'
br
br
if machine.sync
| let output =
= ' '+ name +'.' + method + '('
= machine.args.join(', ')
| );
else
| let output = await
= ' '+ name +'.' + method + '('
= machine.args.join(', ')
| );
br
= '// '
= JSON.stringify(machine.exits.success.outputExample)
+usage(name, method, machine)
h3 Inputs
each input, name in machine.inputs
h4
strong= name
|  
i(style='font-weight: normal')= input.type
if input.description
p= input.description
.box
h4
strong= name
|  
i(style='font-weight: normal')= input.type
if input.required
|  
span.tag.is-info * Required
if input.description
p= input.description
if input.defaultsTo
p
strong Default:
= JSON.stringify(input.defaultsTo)
if input.example
p
strong Example  
= JSON.stringify(input.example)
if input.example
p
strong Example
p= JSON.stringify(input.example)
pre= JSON.stringify(input, null, 4)
//- pre= JSON.stringify(input, null, 4)
h3 Exits
each exit, name in machine.exits
p
strong= name
pre= JSON.stringify(exit, null, 4)
pre
code= JSON.stringify(exit, null, 4)
pre= JSON.stringify(machine, null, 4)
h4 Source Code
//- pre= JSON.stringify(machine, null, 4)
h3 Source
pre
code= machine.fn
mixin usage(name, method, machine)
//- Can we call this machine like foo.doThings(arg1, arg2, arg3) ?
if machine.args
pre
code.javascript
= 'const ' + name + ' = require(\'' + mp.name + '\');'
br
br
if machine.sync
| let output =
= ' '+ name +'.' + method + '('
= machine.args.join(', ')
| );
else
| let output = await
= ' '+ name +'.' + method + '('
= machine.args.join(', ')
| );
if machine.exits.success.outputExample
br
= '// '
= JSON.stringify(machine.exits.success.outputExample)
if !machine.sync
h4.has-text-grey-light.has-text-centered - OR -
pre
code.javascript
= 'var ' + name + ' = require(\'' + mp.name + '\');'
br
br
= name +'.' + method + '('
= machine.args.join(', ')
| ).exec(function(err, result) {
br
if machine.exits.success.outputExample
= ' // Example result: '
= JSON.stringify(machine.exits.success.outputExample)
= "\n});"
//- = JSON.stringify(machine,null,4)
//- Looks like we gotta call this method with a Dictionary {}
//- I think at some point the usage of mp.machine.exec() changed
So older versions take .exec({ success: ()=>{}, error: ()=>{} })
but newer versions .exec((err, res) => {})
.. Maybe pull in semver and check what version of `machine` this machine
uses, add another if/else blockydoodle to generate stuff for older packs
else
pre
code.javascript
= 'const ' + name + ' = require(\'' + mp.name + '\');'
br
br
- args = machine.inputs
= name +'.' + method + '({'
br
each def, name in machine.inputs
= ' ' + name + ': '
= JSON.stringify(def.example)
br
| }).exec({ <br> /* idk what happens in here tho */<br>});
br
= '// '
= JSON.stringify(machine.exits.success.outputExample)
//- = JSON.stringify(machine,null,4)
......@@ -10,12 +10,13 @@ block body
| npm install --save&nbsp;
= pkg.name
h2 Usage
//- h2 Usage
h3 Methods
each key in Object.keys(pack)
- args = pack[key].getDef().args ? pack[key].getDef().args.join(', ') : ''
p
a(href='./' + pack[key].getDef().identity + '.html')= '.' + key + '('+ pack[key].getDef().args.join(', ') +')'
a(href='./' + pack[key].getDef().identity + '.html')= '.' + key + '('+ args +')'
| &nbsp;
= pack[key].getDef().description
//- pre= JSON.stringify(pack[key], null, 4)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment