DanielXMoore / Civet

A TypeScript superset that favors more types and less typing
https://civet.dev
MIT License
1.33k stars 28 forks source link

`-version` with only one hyphen throws a ReferenceError #1254

Closed bbrk24 closed 1 month ago

bbrk24 commented 1 month ago
$ civet -version
/home/bbrk24/.nvm/versions/node/v20.13.1/lib/node_modules/@danielx/civet/dist/civet:124
      args.splice(i, 1 + i - i, ...results);
                                   ^

ReferenceError: results is not defined
    at parseArgs (/home/bbrk24/.nvm/versions/node/v20.13.1/lib/node_modules/@danielx/civet/dist/civet:124:36)
    at cli (/home/bbrk24/.nvm/versions/node/v20.13.1/lib/node_modules/@danielx/civet/dist/civet:421:44)
    at Object.<anonymous> (/home/bbrk24/.nvm/versions/node/v20.13.1/lib/node_modules/@danielx/civet/dist/civet:635:3)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.13.1
edemaine commented 1 month ago

Root cause is this mistranslation in cli.civet:

      args[i..i] =
        for each char of arg[1..]
          `-${char}`
↓↓↓
      args.splice(i, 1 + i - i, ...results)

(Note: results isn't declared.)