BoxLang 🚀 A New JVM Dynamic Language Learn More...
If you are anything like me you will happily spend hours coding to save yourself a few minutes of work 🤣. Here is the result of saving myself a few minutes of work. The UN-Official CBWIRE CLI! It is currently only used for scaffolding wires and has many of the most used options included. I'm not sure if there is much else that a CLI could do to expedite and streamline the use of CBWIRE but let me know if you have any ideas! I tried to include lots of comments and links to the CBWIRE docs in the generated wires to help get you started. I hope you find it as helpful as I do. Enjoy!
Install via CommandBox like so:
box install cbwire-cli
💡 Be sure to change into the root of your ColdBox application or
include the appMapping
argument before running commands
name
: String : Name of the wire to create without
extensions. @module can be used to place in a module wires directory.dataProps
: String : A comma-delimited list of data
property keys to add.lockedDataProps
: String : A comma-delimited list of
data property keys to lock.actions
: String : A comma-delimited list of actions to generateouterElement
: String : The outer element type to use
for the wire. Defaults to "div"jsWireRef
: Boolean : If true, the livewire:init &
component.init hooks will be included and a reference to $wire will
be created as window.wirename = $wirelifeCycleEvents
: String : A comma-delimited list of
life cycle events names to generate. If none provided, only
onMount() will be generated but commented out.onHydrateProps
: String : A comma-delimited list of
properties to create onHydrate() Property methods for in the wire.onUpdateProps
: String : A comma-delimited list of
properties to create onUpdate() Property methods for in the wire.wiresDirectory
: String : The directory where your
wires are stored. Defaults to standard wires
directory.appMapping
: String : The root location of the
application in the web root: ex: MyApp/ or leave blank if in the rootdescription
: String : The wire component hint descriptionopen
: Boolean : If true open the wire component &
template once generatedforce
: Boolean : If true force overwrite of existing wiressingleFileWire
: Boolean : If true creates a single
file wireincludePlaceholder
: Boolean : If true inserts a
placeholder action in the wire component for lazy loading wiresPlease note that CBWIRE CLI registers two command alias's:
create wire
and wire create
. The means
that in all the examples below you can leave out the
cbwire
part altogether if you prefer. So cbwire
create wire myWireName
could be create wire
myWireName
. Its your choice!
cbwire create wire myWireName
cbwire create wire name="myWireName"
dataProps="counter1,counter2,counter3"
actions="saveSomething,doSomething,GetSomething"
--jsWireRef --open
cbwire create wire name="myWireName@MyModuleName"
dataProps="counter1,counter2,counter3"
actions="saveSomething,doSomething,GetSomething"
--jsWireRef --open
cbwire create wire name="myWireName"
dataProps="counter1,counter2,counter3"
lockedDataProps="counter2,counter3"
actions="saveSomething,doSomething,GetSomething"
outerElement="p"
lifeCycleEvents="onRender,onHydrate,onMount,onUpdate"
onHydrateProps="counter2,counter3"
onUpdateProps="counter1,counter2" description="This
is my wire description" --jsWireRef --open --force
cbwire create wire name="myWireName"
dataProps="counter1,counter2,counter3"
lockedDataProps="counter2,counter3"
actions="saveSomething,doSomething,GetSomething"
outerElement="p"
lifeCycleEvents="onRender,onHydrate,onMount,onUpdate"
onHydrateProps="counter2,counter3"
onUpdateProps="counter1,counter2" description="This
is my wire description" --jsWireRef --open --force --singleFileWire
$
box install cbwire-cli