Skip to content

Commit cc019ca

Browse files
committed
better english
1 parent a6d3cd6 commit cc019ca

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,18 @@ export default function parse(argv, i, req, res, err) {
8888
else if (key = rst_[opt]) rst();
8989
else if (key = exit_[opt]) { exit = key; break; }
9090
else if (key = _key) if (_exit) { exit = key; break; } else set(s);
91-
else if (ask('invalid option', s)) break;
91+
else if (ask('invalid option')) break;
9292
} else if (s[1] !== '-') { // -abc
9393
const J = s.length - 1;
9494
for (let j = 1; j < J; ++j) {
9595
// -ab ~ no extension, no universe, no exit
9696
opt = '-' + s[j];
9797
if (key = set_[opt]) { if (noB()) { set(s.slice(j + 1)); continue I; } }
9898
else if (key = rst_[opt]) rst();
99-
else if (key = exit_[opt]) { if (ask('cannot exit inside an argument')) break I; }
99+
else if (key = exit_[opt]) { if (ask('cannot exit within an argument')) break I; }
100100
else if (ask('invalid option')) break I;
101101
}
102-
// -c ~ no universe, can exit
102+
// -c ~ no universe
103103
opt = '-' + s[J];
104104
if (key = set_[opt]) { if (noB()) ext = opt; }
105105
else if (key = rst_[opt]) rst();
@@ -125,18 +125,19 @@ export default function parse(argv, i, req, res, err) {
125125
else if (key = rst_[opt]) t = 'reset';
126126
else if (key = exit_[opt]) t = 'exit';
127127
else if (ask('invalid option', v)) break; else continue;
128-
if (ask(`Cannot assign a value to a ${t} option`, v)) break;
129-
} else { opt = '--';
128+
if (ask(`cannot assign value to ${t} option`, v)) break;
129+
} else {
130+
opt = '--';
130131
if (key = _key) {
131132
if (_exit) { exit = key; break; }
132133
const a = res[key], l = argv.length; ++i;
133134
if (isA(a)) while (i < l) a.push(argv[i++]);
134135
else if (i < l) res[key] = argv[(i = l) - 1];
135136
break;
136137
}
137-
if (ask('unexpected argument')) break;
138+
if (ask('anonymous argument are not allowed')) break;
138139
}
139140
}
140-
if (ext) ask('This option requires an argument');
141+
if (ext) ask('this option requires an argument');
141142
return { i, exit };
142143
};

0 commit comments

Comments
 (0)