Skip to content

Commit a9716c4

Browse files
committed
fix: fix create steps
1 parent 731871a commit a9716c4

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Diff for: src/commands/create/post.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ module.exports = function(api, argv, opts, BASE_ROOT) {
2121
return prompt.input('Enter Title:').then(answer => {
2222
const title = answer.trim();
2323
if (!title) {
24-
throw `"${title}", title illegal!`;
24+
throw `title "${title}" illegal!`;
2525
}
2626
if (fs.existsSync(path.join(BASE_ROOT, title))) {
27-
throw `"${title}", title illegal, already exists!`;
27+
throw `title "${title}" illegal, already exists!`;
2828
}
2929
info.title = title;
3030
});
@@ -60,20 +60,25 @@ module.exports = function(api, argv, opts, BASE_ROOT) {
6060
chain = chain.then(() => {
6161
// 提供可选项,没有则自定义。
6262
const tagsOpts = [].concat(createCommand.tags || []);
63-
let _chain = Promise.resolve(CUSTOM_KEY);
63+
let _chain = Promise.resolve([]);
6464
if (tagsOpts.length) {
65-
_chain = _chain.then(() => prompt.select('Select Tags:', {
65+
_chain = _chain.then(() => prompt.check('Select Tags:', {
6666
choices: [
6767
...tagsOpts.map(item => ({ name: item, value: item })),
68-
{ name: '>>> Custom >>>', value: CUSTOM_KEY },
6968
],
7069
}));
7170
}
72-
// TODO 选择 tags
73-
return prompt.input('Enter Tags:').then(answer => {
74-
const tags = answer.trim();
71+
_chain = _chain.then(key => {
72+
if (key && key.length <= 0) {
73+
return prompt.input('Enter Tags:').then(answer => {
74+
const tags = answer.trim();
75+
info.tags = `[${tags}]`;
76+
});
77+
}
78+
const tags = key.join(',');
7579
info.tags = `[${tags}]`;
7680
});
81+
return _chain;
7782
});
7883

7984
// author

0 commit comments

Comments
 (0)