mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-02 12:30:31 +00:00
Userland: Use Core::ArgsParser for 'rmdir'
This commit is contained in:
parent
3298b0318c
commit
7b82334e2f
Notes:
sideshowbarker
2024-07-19 04:12:11 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/7b82334e2f9 Pull-request: https://github.com/SerenityOS/serenity/pull/3019
1 changed files with 8 additions and 5 deletions
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
@ -35,11 +36,13 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: rmdir <path>\n");
|
||||
return 1;
|
||||
}
|
||||
int rc = rmdir(argv[1]);
|
||||
const char* path;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(path, "Directory to remove", "path");
|
||||
args_parser.parse(argc, argv);
|
||||
|
||||
int rc = rmdir(path);
|
||||
if (rc < 0) {
|
||||
perror("rmdir");
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue