logo

deblob

remove binary executables from a directory git clone https://hacktivis.me/git/deblob.git
commit: 66ffd07e0c4872eac6bbc3b57020c5ff8fb77b55
parent 89ef0d14a8d3784e3a1027fbd215f75bf4abadb5
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri, 18 Feb 2022 10:36:15 +0100

Call os::chdir immediately while parsing options

Diffstat:

Mmain.ha17+++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/main.ha b/main.ha @@ -176,8 +176,6 @@ fn fn_noop() void = { }; export fn main() void = { - let workdir = "."; - const cmd = getopt::parse(os::args, "Remove binary executable files", ('e', "NAME", "Exclude filename from removal (defaults to none)"), @@ -192,19 +190,18 @@ export fn main() void = { case 'e' => append(excludes, opt.1); case 'd' => - workdir = opt.1; + match (os::chdir(opt.1)) { + case let e: fs::error => + fmt::fatal("os::chdir({}): {}", + opt.1, fs::strerror(e)); + case void => + void; + }; case 'n' => noop = true; }; }; - match (os::chdir(workdir)) { - case void => - fn_noop; // TODO - case let e: fs::error => - fmt::fatal("os::chdir({}): {}", workdir, fs::strerror(e)); - }; - fmt::println(":: Checking for blobs")!; const ret = check_dir(".", false);