Skip to content

Commit a36f630

Browse files
authored
Organize and clarify --help text (#336)
1 parent 91d6ef6 commit a36f630

File tree

2 files changed

+40
-35
lines changed

2 files changed

+40
-35
lines changed

README.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,36 @@ Usage:
3030
postcss <input.css>... [OPTIONS] --replace
3131
3232
Basic options:
33-
-o, --output Output file [string]
34-
-d, --dir Output directory [string]
35-
-r, --replace Replace (overwrite) the input file [boolean]
36-
--map, -m Create an external sourcemap
37-
--no-map Disable the default inline sourcemaps
38-
--verbose Be verbose [boolean]
39-
--watch, -w Watch files for changes and recompile as needed [boolean]
40-
--env A shortcut for setting NODE_ENV [string]
41-
--include-dotfiles Enables glob to match files/dirs that begin with "." [boolean]
42-
43-
Options for when not using a config file:
33+
-o, --output Output file [string]
34+
-d, --dir Output directory [string]
35+
-r, --replace Replace (overwrite) the input file [boolean]
36+
-m, --map Create an external sourcemap
37+
--no-map Disable the default inline sourcemaps
38+
-w, --watch Watch files for changes and recompile as needed [boolean]
39+
--verbose Be verbose [boolean]
40+
--env A shortcut for setting NODE_ENV [string]
41+
42+
Options for use without a config file:
4443
-u, --use List of postcss plugins to use [array]
4544
--parser Custom postcss parser [string]
4645
--stringifier Custom postcss stringifier [string]
4746
--syntax Custom postcss syntax [string]
4847
48+
Options for use with --dir:
49+
--ext Override the output file extension; for use with --dir [string]
50+
--base Mirror the directory structure relative to this path in the output
51+
directory, for use with --dir [string]
52+
4953
Advanced options:
50-
--ext Override the output file extension; for use with --dir [string]
51-
--base Mirror the directory structure relative to this path in the output
52-
directory, for use with --dir [string]
53-
--poll Use polling for file watching. Can optionally pass polling interval;
54-
default 100 ms
55-
--config Set a custom directory to look for a config file [string]
54+
--include-dotfiles Enable glob to match files/dirs that begin with "."
55+
[boolean]
56+
--poll Use polling for file watching. Can optionally pass polling
57+
interval; default 100 ms
58+
--config Set a custom directory to look for a config file [string]
5659
5760
Options:
58-
--version Show version number [boolean]
59-
-h, --help Show help [boolean]
61+
--version Show version number [boolean]
62+
-h, --help Show help [boolean]
6063
6164
Examples:
6265
postcss input.css -o output.css Basic usage
@@ -68,8 +71,9 @@ If no input files are passed, it reads from stdin. If neither -o, --dir, or
6871
6972
If there are multiple input files, the --dir or --replace option must be passed.
7073
71-
Input files may contain globs (e.g. src/**/*.css). If you pass an input directory, it will process
72-
all files in the directory and any subdirectories, respecting the glob pattern.
74+
Input files may contain globs (e.g. src/**/*.css). If you pass an input
75+
directory, it will process all files in the directory and any subdirectories,
76+
respecting the glob pattern.
7377
```
7478

7579
> ℹ️ More details on custom parsers, stringifiers and syntaxes, can be found [here](https://github.com/postcss/postcss#syntaxes).

lib/args.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Usage:
2424
$0 <input.css>... [OPTIONS] --replace`
2525
)
2626
.group(
27-
['o', 'd', 'r', 'map', 'no-map', 'verbose', 'watch', 'env'],
27+
['o', 'd', 'r', 'map', 'no-map', 'watch', 'verbose', 'env'],
2828
'Basic options:'
2929
)
3030
.option('o', {
@@ -45,30 +45,26 @@ Usage:
4545
type: 'boolean',
4646
conflicts: ['output', 'dir'],
4747
})
48-
.option('include-dotfiles', {
49-
desc: 'Enables glob to match files/dirs that begin with "."',
50-
type: 'boolean',
51-
})
52-
.alias('map', 'm')
48+
.alias('m', 'map')
5349
.describe('map', 'Create an external sourcemap')
5450
.describe('no-map', 'Disable the default inline sourcemaps')
55-
.option('verbose', {
56-
desc: 'Be verbose',
57-
type: 'boolean',
58-
})
59-
.option('watch', {
60-
alias: 'w',
51+
.option('w', {
52+
alias: 'watch',
6153
desc: 'Watch files for changes and recompile as needed',
6254
type: 'boolean',
6355
conflicts: 'replace',
6456
})
57+
.option('verbose', {
58+
desc: 'Be verbose',
59+
type: 'boolean',
60+
})
6561
.option('env', {
6662
desc: 'A shortcut for setting NODE_ENV',
6763
type: 'string',
6864
})
6965
.group(
7066
['u', 'parser', 'stringifier', 'syntax'],
71-
'Options for when not using a config file:'
67+
'Options for use without a config file:'
7268
)
7369
.option('u', {
7470
alias: 'use',
@@ -87,7 +83,7 @@ Usage:
8783
desc: 'Custom postcss syntax',
8884
type: 'string',
8985
})
90-
.group(['ext', 'base', 'poll', 'config'], 'Advanced options:')
86+
.group(['ext', 'base'], 'Options for use with --dir:')
9187
.option('ext', {
9288
desc: 'Override the output file extension; for use with --dir',
9389
type: 'string',
@@ -103,6 +99,11 @@ Usage:
10399
type: 'string',
104100
implies: 'dir',
105101
})
102+
.group(['include-dotfiles', 'poll', 'config'], 'Advanced options:')
103+
.option('include-dotfiles', {
104+
desc: 'Enable glob to match files/dirs that begin with "."',
105+
type: 'boolean',
106+
})
106107
.option('poll', {
107108
desc:
108109
'Use polling for file watching. Can optionally pass polling interval; default 100 ms',

0 commit comments

Comments
 (0)