Skip to content

Commit 7a74f3f

Browse files
authored
refactor & style: let command default to be 'help' (#277)
* refactor: let command default to be 'help' * style: add missing semicolon
1 parent 0dcf293 commit 7a74f3f

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

lib/hexo.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,11 @@ function entry(cwd = process.cwd(), args) {
4848

4949
return hexo.init();
5050
}).then(() => {
51-
let cmd = '';
51+
let cmd = 'help';
5252

5353
if (!args.h && !args.help) {
54-
cmd = args._.shift();
55-
56-
if (cmd) {
57-
const c = hexo.extend.console.get(cmd);
58-
if (!c) cmd = 'help';
59-
} else {
60-
cmd = 'help';
61-
}
62-
} else {
63-
cmd = 'help';
54+
const c = args._.shift();
55+
if (c && hexo.extend.console.get(c)) cmd = c;
6456
}
6557

6658
watchSignal(hexo);

test/scripts/version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { platform, release } = require('os');
77
const { format } = require('util');
88
const cliVersion = require('../../package.json').version;
99
const rewire = require('rewire');
10-
const { spawn } = require('hexo-util')
10+
const { spawn } = require('hexo-util');
1111

1212
function getConsoleLog({ args }) {
1313
return args.map(arr => format.apply(null, arr)).join('\n');
@@ -39,7 +39,7 @@ describe('version', () => {
3939

4040
if (process.env.CI === 'true') {
4141
if (process.platform === 'darwin') {
42-
const osInfo = await spawn('sw_vers', '-productVersion')
42+
const osInfo = await spawn('sw_vers', '-productVersion');
4343
output.should.contain(`os: ${platform()} ${release()} ${osInfo}`);
4444
} else if (process.platform === 'linux') {
4545
const v = await spawn('cat', '/etc/os-release');

0 commit comments

Comments
 (0)