serenity/Userland/Utilities/dirname.cpp

21 lines
480 B
C++
Raw Normal View History

/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/LexicalPath.h>
#include <LibCore/ArgsParser.h>
2021-12-07 15:28:21 -05:00
#include <LibMain/Main.h>
2021-12-07 15:28:21 -05:00
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
DeprecatedString path = {};
Core::ArgsParser args_parser;
args_parser.add_positional_argument(path, "Path", "path");
2021-12-07 15:28:21 -05:00
args_parser.parse(arguments);
outln("{}", LexicalPath::dirname(path));
return 0;
}