Skip to content

Commit 51d6509

Browse files
committed
docs
1 parent 4da0da8 commit 51d6509

File tree

1 file changed

+232
-1
lines changed

1 file changed

+232
-1
lines changed

README.md

Lines changed: 232 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,238 @@ box install coldbox-cli
4848

4949
## Usage
5050

51-
You can use the CLI for many things like scaffolding applications, creating tests, modules, models, and so much more. Please remember that you can always get help on any command by using the `--help` flag.
51+
The ColdBox CLI provides powerful scaffolding and development tools for both **CFML** and **BoxLang** applications. All commands support the `--help` flag for detailed information.
52+
53+
### 📱 Application Creation
54+
55+
Create new ColdBox applications from various templates:
56+
57+
```bash
58+
# Create a basic ColdBox app
59+
coldbox create app myApp
60+
61+
# Create with specific templates
62+
coldbox create app myApp skeleton=modern
63+
coldbox create app myApp skeleton=boxlang
64+
coldbox create app myApp skeleton=rest
65+
coldbox create app myApp skeleton=elixir
66+
67+
# Create with migrations support
68+
coldbox create app myApp --migrations
69+
70+
# Interactive app wizard
71+
coldbox create app-wizard
72+
```
73+
74+
**Available Templates:** `default`, `boxlang`, `modern`, `rest`, `elixir`
75+
76+
### 🎯 Handlers (Controllers)
77+
78+
Generate MVC handlers with actions and optional views:
79+
80+
```bash
81+
# Basic handler
82+
coldbox create handler myHandler
83+
84+
# Handler with specific actions
85+
coldbox create handler users index,show,edit,delete
86+
87+
# REST handler
88+
coldbox create handler api/users --rest
89+
90+
# Resourceful handler (full CRUD)
91+
coldbox create handler photos --resource
92+
93+
# Generate with views and tests
94+
coldbox create handler users --views --integrationTests
95+
```
96+
97+
### 📊 Models & Services
98+
99+
Create domain models and business services:
100+
101+
```bash
102+
# Basic model
103+
coldbox create model User
104+
105+
# Model with properties and accessors
106+
coldbox create model User properties=fname,lname,email --accessors
107+
108+
# Model with migration
109+
coldbox create model User --migration
110+
111+
# Model with service
112+
coldbox create model User --service
113+
114+
# Model with everything (service, handler, migration, seeder)
115+
coldbox create model User --all
116+
117+
# Standalone service
118+
coldbox create service UserService
119+
```
120+
121+
### 🎨 Views & Layouts
122+
123+
Generate view templates and layouts:
124+
125+
```bash
126+
# Create a view
127+
coldbox create view users/index
128+
129+
# View with helper file
130+
coldbox create view users/show --helper
131+
132+
# View with content
133+
coldbox create view welcome content="<h1>Welcome!</h1>"
134+
135+
# Create layout
136+
coldbox create layout main
137+
138+
# Layout with content
139+
coldbox create layout admin content="<cfoutput>#view()#</cfoutput>"
140+
```
141+
142+
### 🔧 Resources & CRUD
143+
144+
Generate complete resourceful components:
145+
146+
```bash
147+
# Single resource (handler, model, views, routes)
148+
coldbox create resource photos
149+
150+
# Multiple resources
151+
coldbox create resource photos,users,categories
152+
153+
# Custom handler name
154+
coldbox create resource photos PhotoGallery
155+
156+
# With specific features
157+
coldbox create resource users --tests --migration
158+
```
159+
160+
### 📦 Modules
161+
162+
Create reusable ColdBox modules:
163+
164+
```bash
165+
# Create module
166+
coldbox create module myModule
167+
168+
# Module with specific features
169+
coldbox create module myModule --models --handlers --views
170+
```
171+
172+
### 🧪 Testing
173+
174+
Generate various types of tests:
175+
176+
```bash
177+
# Unit tests
178+
coldbox create unit models.UserTest
179+
180+
# BDD specs
181+
coldbox create bdd UserServiceTest
182+
183+
# Integration tests
184+
coldbox create integration-test handlers.UsersTest
185+
186+
# Model tests
187+
coldbox create model-test User
188+
189+
# Interceptor tests
190+
coldbox create interceptor-test Security --actions=preProcess,postProcess
191+
```
192+
193+
### 🗄️ ORM & Database
194+
195+
Work with ORM entities and database operations:
196+
197+
```bash
198+
# ORM Entity
199+
coldbox create orm-entity User table=users
200+
201+
# ORM Service
202+
coldbox create orm-service UserService entity=User
203+
204+
# Virtual Entity Service
205+
coldbox create orm-virtual-service UserService
206+
207+
# ORM Event Handler
208+
coldbox create orm-event-handler
209+
210+
# CRUD operations
211+
coldbox create orm-crud User
212+
```
213+
214+
### 🔗 Interceptors
215+
216+
Create AOP interceptors:
217+
218+
```bash
219+
# Basic interceptor
220+
coldbox create interceptor Security
221+
222+
# Interceptor with specific interception points
223+
coldbox create interceptor Logger points=preProcess,postProcess
224+
225+
# With tests
226+
coldbox create interceptor Security --tests
227+
```
228+
229+
### 🔄 Development Workflow
230+
231+
Manage your development environment:
232+
233+
```bash
234+
# Reinitialize ColdBox framework
235+
coldbox reinit
236+
237+
# Auto-reinit on file changes
238+
coldbox watch-reinit
239+
240+
# Open documentation
241+
coldbox docs
242+
coldbox docs search="event handlers"
243+
244+
# Open API documentation
245+
coldbox apidocs
246+
```
247+
248+
### 🎛️ Global Options
249+
250+
Most commands support these common options:
251+
252+
- `--force` - Overwrite existing files
253+
- `--open` - Open generated files in your default editor
254+
- `--boxlang` - Generate BoxLang code instead of CFML
255+
- `--help` - Show detailed help for any command
256+
257+
### 💡 BoxLang Support
258+
259+
The CLI automatically detects BoxLang projects and generates appropriate code. You can also force BoxLang mode:
260+
261+
```bash
262+
# Force BoxLang generation
263+
coldbox create handler users --boxlang
264+
265+
# BoxLang project detection based on:
266+
# - Server engine (BoxLang)
267+
# - package.json testbox.runner setting
268+
# - package.json language property
269+
```
270+
271+
### 📖 Getting Help
272+
273+
Every command provides detailed help:
274+
275+
```bash
276+
# General help
277+
coldbox help
278+
279+
# Specific command help
280+
coldbox create handler --help
281+
coldbox create model --help
282+
```
52283

53284
----
54285

0 commit comments

Comments
 (0)