From 7f8eb04a2ea0ec15c205212e72043076ac91350e Mon Sep 17 00:00:00 2001 From: saucylegs <37064488+saucylegs@users.noreply.github.com> Date: Tue, 21 Sep 2021 20:05:27 -0700 Subject: [PATCH] =?UTF-8?q?Make=20the=20em=20dash=20(=E2=80=94)=20also=20w?= =?UTF-8?q?ork=20when=20using=20options=20(#160)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- utils/parseCommand.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/parseCommand.js b/utils/parseCommand.js index f9b5291..5ec1d64 100644 --- a/utils/parseCommand.js +++ b/utils/parseCommand.js @@ -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("\"")) { @@ -109,4 +109,4 @@ export default (input) => { // } // }) // return results; -// } \ No newline at end of file +// }