@@ -21,10 +21,10 @@ module.exports = function(api, argv, opts, BASE_ROOT) {
21
21
return prompt . input ( 'Enter Title:' ) . then ( answer => {
22
22
const title = answer . trim ( ) ;
23
23
if ( ! title ) {
24
- throw `"${ title } ", title illegal!` ;
24
+ throw `title "${ title } " illegal!` ;
25
25
}
26
26
if ( fs . existsSync ( path . join ( BASE_ROOT , title ) ) ) {
27
- throw `"${ title } ", title illegal, already exists!` ;
27
+ throw `title "${ title } " illegal, already exists!` ;
28
28
}
29
29
info . title = title ;
30
30
} ) ;
@@ -60,20 +60,25 @@ module.exports = function(api, argv, opts, BASE_ROOT) {
60
60
chain = chain . then ( ( ) => {
61
61
// 提供可选项,没有则自定义。
62
62
const tagsOpts = [ ] . concat ( createCommand . tags || [ ] ) ;
63
- let _chain = Promise . resolve ( CUSTOM_KEY ) ;
63
+ let _chain = Promise . resolve ( [ ] ) ;
64
64
if ( tagsOpts . length ) {
65
- _chain = _chain . then ( ( ) => prompt . select ( 'Select Tags:' , {
65
+ _chain = _chain . then ( ( ) => prompt . check ( 'Select Tags:' , {
66
66
choices : [
67
67
...tagsOpts . map ( item => ( { name : item , value : item } ) ) ,
68
- { name : '>>> Custom >>>' , value : CUSTOM_KEY } ,
69
68
] ,
70
69
} ) ) ;
71
70
}
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 ( ',' ) ;
75
79
info . tags = `[${ tags } ]` ;
76
80
} ) ;
81
+ return _chain ;
77
82
} ) ;
78
83
79
84
// author
0 commit comments