Userland: Use Core::ArgsParser for 'yes'

This commit is contained in:
Linus Groh 2020-08-05 19:35:13 +02:00 committed by Andreas Kling
parent 3cc9e8ba41
commit cf81d9765c
Notes: sideshowbarker 2024-07-19 04:12:35 +09:00

View File

@ -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;
}