Skip to content

Commit 34b7439

Browse files
committed
Update help info and add a short global name cssd
1 parent 4a77ed6 commit 34b7439

3 files changed

Lines changed: 40 additions & 31 deletions

File tree

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @css-doodle/cli
22

3-
The css-doodle CLI for previewing and generating images.
3+
The css-doodle command line tool for previewing and generating images.
44

55
<img src="screenshot/preview.png" width="480px" alt="screenshot" />
66

@@ -16,38 +16,38 @@ npm install -g @css-doodle/cli
1616
Generate an image from the CSS Doodle source file.
1717

1818
```bash
19-
$ css-doodle render code.css
19+
cssd render code.css
2020
```
2121

2222
#### -o, --output
2323

2424
Custom output filename of the generated image.
2525

2626
```bash
27-
$ css-doodle render code.css -o result.png
27+
cssd render code.css -o result.png
2828
```
2929

3030
#### -x, --scale
3131

3232
Scale factor of the generated image, defaults to 1.
3333

3434
```bash
35-
$ css-doodle render code.css -x 4
35+
cssd render code.css -x 4
3636
```
3737

3838
### preview
3939
Open a window to preview the CSS Doodle file.
4040

4141
```bash
42-
$ css-doodle preview code.css
42+
cssd preview code.css
4343
```
4444

4545
#### --fullscreen
4646

4747
Open the preview in fullscreen mode.
4848

4949
```bash
50-
$ css-doodle preview code.css --fullscreen
50+
cssd preview code.css --fullscreen
5151
```
5252

5353

@@ -56,15 +56,15 @@ $ css-doodle preview code.css --fullscreen
5656
Display/set the configuration.
5757

5858
```bash
59-
$ css-doodle config
59+
cssd config
6060
```
6161

6262
#### browserPath
6363

6464
Use a custom browser to preview and generate images.
6565

6666
```bash
67-
$ css-doodle config browserPath /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
67+
cssd config browserPath /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
6868
```
6969

7070
### generate
@@ -76,15 +76,15 @@ Generate code using CSS Doodle generators.
7676
Generate SVG code using svg() function.
7777

7878
```bash
79-
$ css-doodle generate svg code.css
79+
cssd generate svg code.css
8080
```
8181

8282
#### polygon
8383

8484
Generate CSS polygon() using shape() function.
8585

8686
```bash
87-
$ css-doodle generate polygon code.css
87+
cssd generate polygon code.css
8888
```
8989

9090
## Usage

bin/index.js

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -142,38 +142,43 @@ function handleDisplayConfig(field) {
142142
}
143143
}
144144

145+
function getProgramName() {
146+
let name = path.basename(process.argv[1]);
147+
return pkg.bin[name] ? name : 'cssd';
148+
}
149+
145150
program
146-
.name('css-doodle')
151+
.name(getProgramName())
147152
.description(pkg.description)
148153
.version(pkg.version);
149154

150155
program
151156
.command('render')
152-
.description('generate an image from the CSS Doodle source file')
153-
.argument('[source]', 'the CSS Doodle source file used to generate the image')
157+
.description('generate an image from css-doodle file')
158+
.argument('[source]', 'css-doolde source file used to generate the image')
154159
.option('-o, --output <output>', 'custom filename of the generated image')
155160
.option('-x, --scale <scale>', 'scale factor of the generated image, defaults to 1')
156161
.action((source, options) => {
157162
handleRender(source, options);
158163
});
159164

160165
program.command('preview')
161-
.description('open a window to preview the CSS Doodle file')
162-
.argument('<source>', 'source file to preview')
166+
.description('open a window to preview the css-doodle file')
167+
.argument('<source>', 'css-doodle source file to preview')
163168
.option('--fullscreen', 'open the preview in fullscreen mode')
164169
.action((source, options) => {
165170
handlePreview(source, options);
166171
});
167172

168173
program.command('parse')
169174
.description('print the parsed tokens, helped to debug on development')
170-
.argument('[source]', 'source file to parse')
175+
.argument('[source]', 'css-doodle source file to parse')
171176
.action((source) => {
172177
handleParse(source);
173178
});
174179

175180
program.command('config')
176-
.description('display/set the configuration')
181+
.description('display/set the configurations')
177182
.action(() => {
178183
handleDisplayConfig();
179184
})
@@ -186,23 +191,26 @@ program.command('config')
186191
}
187192
});
188193

189-
const commandGenerate = program.command('generate')
190-
.description('generate code using CSS Doodle generators')
194+
const commandGenerate =
195+
program.command('generate')
196+
.description('generate code using css-doodle generators')
191197
.action((_, cmd) => {
192198
cmd.help();
193199
});
194200

195-
commandGenerate.command('svg [source]')
196-
.description('generate SVG code using svg() function')
197-
.action((source) => {
198-
handleGenerateSVG(source);
199-
})
201+
commandGenerate
202+
.command('svg [source]')
203+
.description('generate SVG code with svg() function')
204+
.action((source) => {
205+
handleGenerateSVG(source);
206+
});
200207

201-
commandGenerate.command('polygon [source]')
202-
.description('generate CSS polygon() using shape() function')
203-
.action(source => {
204-
handleGenerateShape(source);
205-
});
208+
commandGenerate
209+
.command('polygon [source]')
210+
.description('generate CSS polygon() with shape() function')
211+
.action(source => {
212+
handleGenerateShape(source);
213+
});
206214

207215
if (process.argv.length <= 2) {
208216
program.help();

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "@css-doodle/cli",
33
"version": "1.1.0",
4-
"description": "The css-doodle CLI for previewing and generating images",
4+
"description": "The css-doodle command line tool for previewing and generating images",
55
"bin": {
6-
"css-doodle": "bin/index.js"
6+
"css-doodle": "bin/index.js",
7+
"cssd": "bin/index.js"
78
},
89
"scripts": {
910
"test": "echo \"Error: no test specified\" && exit 1"

0 commit comments

Comments
 (0)