Skip to content

Commit

Permalink
rm: Allow specifying multiple paths to remove
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Mar 1, 2020
1 parent 95e3aec commit 0ef8391
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Userland/rm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,16 @@ int main(int argc, char** argv)
}

bool recursive = false;
const char* path = nullptr;
Vector<const char*> paths;

Core::ArgsParser args_parser;
args_parser.add_option(recursive, "Delete directories recursively", "recursive", 'r');
args_parser.add_positional_argument(path, "File to remove", "path");
args_parser.add_positional_argument(paths, "Path(s) to remove", "path");
args_parser.parse(argc, argv);

return remove(recursive, path);
int rc = 0;
for (auto& path : paths) {
rc |= remove(recursive, path);
}
return rc;
}

0 comments on commit 0ef8391

Please sign in to comment.