Skip to content

Commit 4fb1a5c

Browse files
ErisDSacburdine
authored andcommitted
fix(help): 🎨 improve options output (#246)
- Use yargs option groups - Update some descriptions - Add more defaults
1 parent 941c3bc commit 4fb1a5c

File tree

4 files changed

+61
-37
lines changed

4 files changed

+61
-37
lines changed

‎lib/bootstrap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ module.exports = {
106106
type: 'boolean'
107107
})
108108
.options('prompt', {
109-
describe: 'Allow UI prompting (`--no-prompt` is useful for bash scripting)',
109+
describe: '[--no-prompt] Allow/Disallow UI prompting',
110110
type: 'boolean',
111111
default: true
112112
})

‎lib/commands/config/advanced.js

+51-28
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,20 @@ const knownMailServices = [
2020
options will have been handled prior to it being run.
2121
*/
2222
module.exports = {
23-
ip: {
24-
description: 'IP ghost should listen on',
25-
configPath: 'server.host',
26-
type: 'string'
27-
},
2823
url: {
29-
description: 'Blog url protocol required ex http://loveghost.com ',
24+
description: 'Blog URL with protocol E.g. http://loveghost.com',
3025
validate: value => validator.isURL(value, {require_protocol: true}) ||
3126
'Invalid URL. Your URL should include a protocol, E.g. http://my-ghost-blog.com',
32-
type: 'string'
27+
type: 'string',
28+
group: 'Ghost Options:'
3329
},
3430
adminUrl: {
35-
description: 'Url for the admin client, if different than the normal url',
31+
description: 'URL for the admin client, if different than the normal URL',
3632
configPath: 'admin.url',
3733
validate: value => validator.isURL(value, {require_protocol: true}) ||
3834
'Invalid URL. Your URL should include a protocol, E.g. http://my-ghost-blog.com',
39-
type: 'string'
35+
type: 'string',
36+
group: 'Ghost Options:'
4037
},
4138
port: {
4239
description: 'Port ghost should listen on',
@@ -56,45 +53,55 @@ module.exports = {
5653
let port = url.parse(config.get('url')).port || BASE_PORT;
5754
return portfinder.getPortPromise({port: parseInt(port)});
5855
},
59-
type: 'number'
56+
default: 2368,
57+
type: 'number',
58+
group: 'Ghost Options:'
6059
},
61-
process: {
62-
description: 'Type of process manager to run Ghost with',
63-
defaultValue: (c, env) => env === 'production' ? 'systemd' : 'local',
64-
type: 'string'
60+
ip: {
61+
description: 'IP ghost should listen on',
62+
configPath: 'server.host',
63+
default: '127.0.0.1',
64+
type: 'string',
65+
group: 'Ghost Options:'
6566
},
6667

6768
// Database options
6869
db: {
69-
description: 'Type of database Ghost should use',
70+
description: 'Type of database Ghost should use E.g. mysql or sqlite3',
7071
validate: value => includes(['sqlite3', 'mysql'], value),
7172
configPath: 'database.client',
72-
type: 'string'
73+
type: 'string',
74+
group: 'Database Options:'
7375
},
7476
dbpath: {
7577
description: 'Path to the database file (sqlite3 only)',
7678
configPath: 'database.connection.filename',
77-
type: 'string'
79+
type: 'string',
80+
group: 'Database Options:'
7881
},
7982
dbhost: {
8083
description: 'Database host',
8184
configPath: 'database.connection.host',
82-
type: 'string'
85+
type: 'string',
86+
group: 'Database Options:'
8387
},
8488
dbuser: {
8589
description: 'Database username',
8690
configPath: 'database.connection.user',
87-
type: 'string'
91+
type: 'string',
92+
group: 'Database Options:'
8893
},
8994
dbpass: {
9095
description: 'Database password',
9196
configPath: 'database.connection.password',
92-
type: 'string'
97+
type: 'string',
98+
group: 'Database Options:'
9399
},
94100
dbname: {
95101
description: 'Database name',
96102
configPath: 'database.connection.database',
97-
type: 'string'
103+
type: 'string',
104+
group: 'Database Options:'
98105
},
99106

100107
// Mail options:
@@ -104,37 +111,44 @@ module.exports = {
104111
validate: value => includes(['SMTP', 'Sendmail', 'Direct'], value),
105112
configPath: 'mail.transport',
106113
type: 'string',
107-
default: 'Direct'
114+
default: 'Direct',
115+
group: 'Mail Options:'
108116
},
109117
mailservice: {
110118
description: 'Mail service (used with SMTP transport), E.g. Mailgun, Sendgrid, Gmail, SES...',
111119
configPath: 'mail.options.service',
112120
validate: value => includes(knownMailServices, value),
113-
type: 'string'
121+
type: 'string',
122+
group: 'Mail Options:'
114123
},
115124
mailuser: {
116125
description: 'Mail auth user (used with SMTP transport)',
117126
configPath: 'mail.options.auth.user',
118127
type: 'string',
119-
implies: 'mailpass'
128+
implies: 'mailpass',
129+
group: 'Mail Options:'
120130
},
121131
mailpass: {
122132
description: 'Mail auth pass (used with SMTP transport)',
123133
configPath: 'mail.options.auth.pass',
124134
type: 'string',
125-
implies: 'mailuser'
135+
implies: 'mailuser',
136+
group: 'Mail Options:'
126137
},
127138
mailhost: {
128139
description: 'Mail host (used with SMTP transport)',
129140
configPath: 'mail.options.host',
130-
type: 'string'
141+
type: 'string',
142+
group: 'Mail Options:'
131143
},
132144
mailport: {
133145
description: 'Mail port (used with SMTP transport)',
134146
configPath: 'mail.options.port',
135-
type: 'number'
147+
type: 'number',
148+
group: 'Mail Options:'
136149
},
137150

151+
// Log options
138152
log: {
139153
description: 'Transport to send Ghost log output to',
140154
configPath: 'logging.transports',
@@ -143,6 +157,15 @@ module.exports = {
143157
return transports;
144158
},
145159
default: ['file', 'stdout'], // used for config command handling
146-
type: 'array'
160+
type: 'array',
161+
group: 'Ghost Options:'
162+
},
163+
164+
// Customise how Ghost-CLI runs
165+
process: {
166+
description: 'Type of process manager to run Ghost with',
167+
defaultValue: (c, env) => env === 'production' ? 'systemd' : 'local',
168+
type: 'string',
169+
group: 'Service Options:'
147170
}
148171
};

‎lib/commands/install.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ InstallCommand.options = {
121121
type: 'string'
122122
},
123123
setup: {
124-
description: 'Automatically run the setup command',
124+
description: '[--no-setup] Enable/Disable auto-running the setup command',
125125
type: 'boolean',
126126
default: true
127127
}

‎lib/commands/setup.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,19 @@ SetupCommand.description = 'Setup an installation of Ghost (after it is installe
132132
SetupCommand.params = '[stage]';
133133
SetupCommand.options = {
134134
stack: {
135-
description: 'Check the system stack on setup',
135+
description: '[--no-stack] Enable/Disable system stack checks on setup',
136136
type: 'boolean',
137-
default: true
138-
},
139-
local: {
140-
alias: 'l',
141-
description: 'Quick setup for a local install of Ghost',
142-
type: 'boolean'
137+
default: false
143138
},
144139
start: {
145140
name: 'start',
146141
description: 'Automatically start Ghost without prompting',
142+
type: 'boolean',
143+
default: false
144+
},
145+
local: {
146+
alias: 'l',
147+
description: 'Quick setup for a local install of Ghost',
147148
type: 'boolean'
148149
},
149150
pname: {

0 commit comments

Comments
 (0)