mag

a binary package manager in one C file: apk and pacman repos, CRUX, Void and Exherbo ports
git clone https://github.com/tortr-rs/mag
Log | Files | Refs | README | LICENSE

commit 0e29b11bc6991fe40fa683b1c849c82be83b77f5
parent 07a7b561ae6bf500d9414a2a75331b5af4e3e1ec
Author: torter <koubbamohamedrayan@gmail.com>
Date:   Mon, 23 Nov 2026 16:29:39 +0000

options after the command too, mag install -y foo

Diffstat:
Mmag.c | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/mag.c b/mag.c @@ -4880,6 +4880,17 @@ int main(int argc, char **argv) else { say("unknown option -%c", *o); return 1; } } } + { + /* -y and the rest after the command too: mag install -y foo */ + int j, k = i; + for (j = i; j < argc; j++) { + if (argv[j][0] == '-' && argv[j][1] && strspn(argv[j] + 1, "nfy") == strlen(argv[j] + 1) && j > i) { + const char *o; + for (o = argv[j] + 1; *o; o++) { if (*o == 'n') dry = 1; else if (*o == 'f') force = 1; else yes = 1; } + } else argv[k++] = argv[j]; + } + argc = k; + } if (i >= argc || !strcmp(argv[i], "help")) { usage(); return i >= argc ? 1 : 0; } arch = machine(); {