Make the em dash (—) also work when using options (#160)

Some devices (such as iPhones) automatically change it to `—` when you type `--`. To get it to stay as `--` you have to type something like `-f-` and then delete the f, which can be annoying. Some people probably don't realize this problem and wonder why it didn't work. Allowing both should make for a better user experience.
This commit is contained in:
saucylegs 2021-09-21 20:05:27 -07:00 committed by GitHub
parent 59e63065f1
commit 7f8eb04a2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,9 +5,9 @@ export default (input) => {
let concated = "";
for (let i = 0; i < input.length; i++) {
const a = input[i];
if (a.startsWith("--") && !curr) {
if ((a.startsWith("--") || a.startsWith("—")) && !curr) {
if (a.includes("=")) {
const [arg, value] = a.slice(2).split("=");
const [arg, value] = (a.startsWith("--") ? a.slice(2).split("=") : a.slice(1).split("="));
let ended = true;
if (arg !== "_") {
if (value.startsWith("\"")) {