Skip to content

Commit 0ae1836

Browse files
committed
Update cli.ts
1 parent 241096a commit 0ae1836

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/cli.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const darkMode: boolean = options.dark
3131
function main() {
3232
const converter = new Converter(layout, hardBreak, darkMode)
3333
let errorCounter = 0
34-
let outputIndex = 0
34+
let outputsIndex = 0
3535
const outputFilenameSet = new Set<string>()
3636

3737
const isURL = (s: string): URL | null => {
@@ -67,19 +67,19 @@ function main() {
6767
}
6868

6969
const generateOutputFilename = (inputFilename: fs.PathLike): string => {
70-
// if `output` is non-null, use `output` as output file name
70+
// if `outputs` is non-null, use `outputs` as output file name
7171
let ret: string
7272
if (outputs !== null) {
73-
if (outputIndex < outputs.length) {
74-
ret = outputs![outputIndex]!.toString()
75-
outputIndex++
73+
if (outputsIndex < outputs.length) {
74+
ret = outputs![outputsIndex]!.toString()
75+
outputsIndex++
7676
} else {
7777
throw ('the number of --output is smaller than the number of --input');
7878
}
7979
} else {
8080
ret = path.join(dest.toString(), path.basename(inputFilename.toString()).replace(/\.md$/, '') + '.html')
8181
}
82-
// if `o` repeat, use hash function to generate new filename
82+
// if `ret` is repeated, use a hash function to generate a new filename
8383
let hashIn: string = inputFilename.toString()
8484
const retExtname = path.extname(ret) // including leading dot '.'
8585
const tmpRet = ret.replace(new RegExp(retExtname + "$"), '')
@@ -91,7 +91,7 @@ function main() {
9191
return ret
9292
}
9393

94-
// if `output` is null, generate the output file in the directory `dest`
94+
// if `outputs` is null, generate the output file in the directory `dest`
9595
// if `dest` existed, check `dest` is directory
9696
// otherwise create the new directory `dest`
9797
if (outputs === null) {
@@ -112,7 +112,7 @@ function main() {
112112
// 1. http/https mode
113113
const url = isURL(fn.toString())
114114
if (url != null) {
115-
if (outputs !== null && outputIndex >= outputs?.length) {
115+
if (outputs !== null && outputsIndex >= outputs?.length) {
116116
return
117117
}
118118
if (url.protocol === 'https:') {
@@ -137,7 +137,6 @@ function main() {
137137
try {
138138
const stats = fs.statSync(f)
139139
if (stats.isDirectory()) {
140-
// printError(fn, "not support directory path as input since v1.1.0")
141140
return
142141
}
143142
} catch (e) {
@@ -161,4 +160,4 @@ function main() {
161160
})
162161
}
163162

164-
main()
163+
main()

0 commit comments

Comments
 (0)