mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:22:43 +00:00 
			
		
		
		
	Userland: Use Core::ArgsParser for 'yes'
This commit is contained in:
		
							parent
							
								
									3cc9e8ba41
								
							
						
					
					
						commit
						cf81d9765c
					
				
					 1 changed files with 9 additions and 9 deletions
				
			
		|  | @ -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; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Linus Groh
						Linus Groh