commit 1f36f212bc7edf34eeade0b25ab37cffcf5331f2
parent 28a6302007dddb1a92c279dbb5bf6e6b20635a00
Author: Byron Torres <b@torresjrjr.com>
Date: Sat, 13 Apr 2024 03:56:54 +0100
getopt: README: use for-each
Signed-off-by: Byron Torres <b@torresjrjr.com>
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/getopt/README b/getopt/README
@@ -26,8 +26,7 @@ flags, then all parameters, alpha-sorted within each group by the flag rune.
);
defer getopt::finish(&cmd);
- for (let i = 0z; i < len(cmd.opts); i += 1) {
- const opt = cmd.opts[i];
+ for (let opt .. cmd.opts) {
switch (opt.0) {
case 'E' =>
extended = true;
@@ -45,8 +44,7 @@ flags, then all parameters, alpha-sorted within each group by the flag rune.
};
};
- for (let i = 0z; i < len(cmd.args); i += 1) {
- const arg = cmd.args[i];
+ for (let arg .. cmd.args) {
// ...
};