summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-08-05 19:35:13 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-06 20:41:13 +0200
commitcf81d9765c79148c162f1d65f9c7460688e6631f (patch)
treeeb0082e6daaf845ce96338c876fa6c8d361221f0
parent3cc9e8ba41f428d486a7c8768d96b1376771e765 (diff)
downloadserenity-cf81d9765c79148c162f1d65f9c7460688e6631f.zip
Userland: Use Core::ArgsParser for 'yes'
-rw-r--r--Userland/yes.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Userland/yes.cpp b/Userland/yes.cpp
index 58ac1f2c27..31b715ef8f 100644
--- a/Userland/yes.cpp
+++ b/Userland/yes.cpp
@@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <LibCore/ArgsParser.h>
#include <stdio.h>
#include <unistd.h>
@@ -34,14 +35,13 @@ int main(int argc, char** argv)
return 1;
}
- if (argc > 1) {
- for (;;) {
- puts(argv[1]);
- }
- } else {
- for (;;) {
- puts("yes");
- }
- }
+ const char* string = "yes";
+
+ Core::ArgsParser args_parser;
+ args_parser.add_positional_argument(string, "String to output (defaults to 'yes')", "string", Core::ArgsParser::Required::No);
+ args_parser.parse(argc, argv);
+
+ for (;;)
+ puts(string);
return 0;
}