{"id":23129361,"url":"https://github.com/gab-studios/gab-cmdline","last_synced_at":"2025-10-03T22:54:38.418Z","repository":{"id":46773548,"uuid":"48931568","full_name":"gab-studios/gab-cmdline","owner":"gab-studios","description":" A GABStudios Java library to help with command line parsing.","archived":false,"fork":false,"pushed_at":"2021-09-26T21:41:16.000Z","size":462,"stargazers_count":12,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-04-29T08:25:59.024Z","etag":null,"topics":["command","gab-cmdline","java","line","parser","parser-library"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gab-studios.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-03T02:44:09.000Z","updated_at":"2021-09-26T21:41:18.000Z","dependencies_parsed_at":"2022-08-28T17:52:46.831Z","dependency_job_id":null,"html_url":"https://github.com/gab-studios/gab-cmdline","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gab-studios%2Fgab-cmdline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gab-studios%2Fgab-cmdline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gab-studios%2Fgab-cmdline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gab-studios%2Fgab-cmdline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gab-studios","download_url":"https://codeload.github.com/gab-studios/gab-cmdline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230098743,"owners_count":18172740,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command","gab-cmdline","java","line","parser","parser-library"],"created_at":"2024-12-17T10:09:09.088Z","updated_at":"2025-10-03T22:54:33.381Z","avatar_url":"https://github.com/gab-studios.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\nGAB-CmdLine\n=======\n\nThe GAB Social Command Line Parser for Java.  The purpose of this project is to analyze and examine how I would create a command line parser for Java.  Comments are welcome.  Thank you.\n\n\nRequired\n---------\nThis project requires the following: \n\n    * Java 8 or 11\n    * Maven\n\n\nMaven Dependency\n---------\n```java\n\u003cdependency\u003e\n   \u003cgroupId\u003ecom.gabstudios\u003c/groupId\u003e\n   \u003cartifactId\u003egab-cmdline\u003c/artifactId\u003e\n   \u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003cdependency\u003e\n   \u003cgroupId\u003ecom.gabstudios\u003c/groupId\u003e\n   \u003cartifactId\u003egab-collection\u003c/artifactId\u003e\n   \u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n   \u003cgroupId\u003ecom.gabstudios\u003c/groupId\u003e\n   \u003cartifactId\u003egab-logging\u003c/artifactId\u003e\n   \u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n   \u003cgroupId\u003ecom.gabstudios\u003c/groupId\u003e\n   \u003cartifactId\u003egab-validate\u003c/artifactId\u003e\n   \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\n\nBuild\n---------\nUse Maven to build - `mvn package`.\n\nUsage\n---------\n\nIn order to parse the command line, you need to define what the commands are by calling `Cmdline.defineCommand(\"xxx\");`\n\n```java\nCmdLine.defineCommand(\"-help, #print this message\")\n```\n\nThe string used in the defineCommand() method, contains tokens that must use one of these symbols in order for it to be recognized as that type:\n\n\\# = The description of the command. There may be zero to one defined.\n\n! = A required value for the command name. There can be zero to many defined.\n\n? = An optional value for the command name. There can be zero to many defined.\n\n: = The regex value to match on for any values that are defined. There can be zero to one defined.\n\n... = A value ends with ... and is a list for the command name. There can be zero to one defined. This can be used with the ! and ? symbols\n\nIf a token does not start with one of these tokens, then it is considered a command name.  There can be one to many  names that represent a single command, such as: 'f', 'file', 'filename' or '-f', '--file', '--filename'.\n\nExample\n---------\n\n```text\nmyApp [commands] [option1 [option2 [option3] ...]]\n  Commands: \n  -help                  print this message\n  -version               print the version information and exit\n  -quiet                 be extra quiet\n  -verbose               be extra verbose\n  -debug                 print debugging information\n  -logfile \u003cfile\u003e        use given file for log\n  -logger \u003cclassname\u003e    the class which is to perform logging\n  -listener \u003cclassname\u003e  add an instance of class as a project listener\n  -D\u003cproperty\u003e=\u003cvalue\u003e   use value for given property\n  -find \u003cfile\u003e           search for file towards the root of the\n                         filesystem and use it\n```\n\n```java\n// define a listener implementation of the CommandListener interface.\nprivate class CmdLineListener implements CommandListener\n{\n    @Override\n    public void handle(final Command command)\n    {\n        System.out.println( command );\n    }\n}\n// create an instance of the listener.\nfinal CmdLineListener listener = new CmdLineListener();\n\n// define/declare the commands the parser should parse.\n// command names can start with any character that is not reserved.  reserved are !?#:\n// the commands listed below use the - (dash) to denote a command, but this is not required.\nCmdLine.defineCommand(\"-help, #print this message\")\n       .defineCommand(\"-version, #print the version information and exit\")\n       .defineCommand(\"-quiet, #be extra quiet\")\n       .defineCommand(\"-verbose, #be extra verbose\")\n       .defineCommand(\"-debug, #print debugging information\")\n       .defineCommand(\"-logfile, !logFile, #use given file for log\")\n       .defineCommand(\"-logger, !logClass, #the class which is to perform logging\")\n       .defineCommand(\"-listener, !listenerClass, #add an instance of class as a project listener\")\n       .defineCommand(\"-find, !buildFile, #search for file towards the root of the file system and use it\");\n\nNote:  The format of \"-D\u003cproperty\u003e=\u003cvalue\u003e\" is automatically supported and doesnt need to be defined.  \nIf a -D\u003cproperty\u003e=\u003cvalue\u003e is seen on the command line, it is parsed and set \nin the System properties.  In addition, a command is created and sent to the listener.\n\n// parse the command line args and pass matching commands to the listener for processing.\nfinal List\u003ccommand\u003e = CmdLine.parse( args, listener );\n```\nClick for more [examples].\n\n\nMore Documentation\n------------------\nCheck the project [wiki].\n\n\nCopyright\n-------\n[Copyright 2016 Gregory Brown]\n\n\nLicense\n-------\nThis codebase is licensed under the [Apache v2.0 License].\n\n\nFeedback\n---------\nComments and feedback are greatly appreciated!!!\n\n\n[Copyright 2016 2021 Gregory Brown]: https://github.com/gab-studios/gab-cmdline/tree/master/COPYRIGHT.txt\n[Apache v2.0 License]: https://github.com/gab-studios/gab-cmdline/tree/master/LICENSE.txt\n[wiki]: https://github.com/gab-studios/gab-cmdline/wiki\n[examples]: https://github.com/gab-studios/gab-cmdline/wiki/Examples\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgab-studios%2Fgab-cmdline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgab-studios%2Fgab-cmdline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgab-studios%2Fgab-cmdline/lists"}