Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Commit 8f2eb9f

Browse files
author
sw-yx
committed
minor fixes to logging output
1 parent 05d4051 commit 8f2eb9f

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

src/commands/functions/build.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,20 @@ class FunctionsBuildCommand extends Command {
1616
process.exit(1)
1717
}
1818

19-
if (!src) {
20-
this.log('You must specify a source folder')
21-
process.exit(1)
22-
}
23-
24-
if (!dst) {
25-
this.log('You must specify a functions folder')
19+
if (!src || !dst) {
20+
if (!src) this.log('You must specify a source folder with a --src flag or a functionsSource field in your config')
21+
if (!dst)
22+
this.log(
23+
'You must specify a destination functions folder with a --functions flag or a functions field in your config'
24+
)
2625
process.exit(1)
2726
}
2827

2928
fs.mkdirSync(dst, { recursive: true })
3029

3130
this.log('Building functions')
3231
zipFunctions(src, dst, { skipGo: true })
33-
this.log('Functions buildt to ', dst)
32+
this.log('Functions built to ', dst)
3433
}
3534
}
3635

src/commands/functions/create.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,19 @@ async function pickTemplate() {
101101
'js'
102102
// 'ts', 'go'
103103
].map(formatRegistryArrayForInquirer)
104+
const specialCommands = [
105+
new inquirer.Separator(`----[Special Commands]----`),
106+
{
107+
name: `*** Clone template from Github URL ***`,
108+
value: 'url',
109+
short: 'gh-url'
110+
},
111+
{
112+
name: `*** Report issue with, or suggest a new template ***`,
113+
value: 'report',
114+
short: 'gh-report'
115+
}
116+
]
104117
const { chosentemplate } = await inquirer.prompt({
105118
name: 'chosentemplate',
106119
message: 'Pick a template',
@@ -116,24 +129,15 @@ async function pickTemplate() {
116129
// ...tsreg,
117130
// new inquirer.Separator(`----[GO]----`),
118131
// ...goreg
119-
new inquirer.Separator(`----[Special Commands]----`),
120-
{
121-
name: `*** Clone template from Github URL ***`,
122-
value: 'url',
123-
short: 'gh-url'
124-
},
125-
{
126-
name: `*** Report issue with, or suggest a new template ***`,
127-
value: 'report',
128-
short: 'gh-report'
129-
}
132+
...specialCommands
130133
]
131134
} else {
132135
// only show filtered results sorted by score
133136
let ans = [
134-
...filterRegistry(jsreg, input)
137+
...filterRegistry(jsreg, input),
135138
// ...filterRegistry(tsreg, input),
136139
// ...filterRegistry(goreg, input)
140+
...specialCommands
137141
].sort((a, b) => b.score - a.score)
138142
return ans
139143
}

0 commit comments

Comments
 (0)