{"id":19881315,"url":"https://github.com/nike-inc/gimme-a-cli","last_synced_at":"2025-08-02T00:42:58.794Z","repository":{"id":71532782,"uuid":"188504964","full_name":"Nike-Inc/gimme-a-cli","owner":"Nike-Inc","description":"Gimme a CLI is a Java library for creating quick and easy command line interfaces (CLIs) using JCommander and Spring dependency injection.","archived":false,"fork":false,"pushed_at":"2020-11-18T23:16:11.000Z","size":100,"stargazers_count":2,"open_issues_count":0,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-02T13:47:18.428Z","etag":null,"topics":["gimme-a-cli","java","jcommander","spring-ioc"],"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/Nike-Inc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-05-25T01:03:21.000Z","updated_at":"2023-06-14T09:39:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"451b9987-fe2e-4674-8ab9-01853edb7812","html_url":"https://github.com/Nike-Inc/gimme-a-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Nike-Inc/gimme-a-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nike-Inc%2Fgimme-a-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nike-Inc%2Fgimme-a-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nike-Inc%2Fgimme-a-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nike-Inc%2Fgimme-a-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nike-Inc","download_url":"https://codeload.github.com/Nike-Inc/gimme-a-cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nike-Inc%2Fgimme-a-cli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268320316,"owners_count":24231800,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["gimme-a-cli","java","jcommander","spring-ioc"],"created_at":"2024-11-12T17:13:52.508Z","updated_at":"2025-08-02T00:42:58.765Z","avatar_url":"https://github.com/Nike-Inc.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Java CI with Gradle](https://github.com/Nike-Inc/gimme-a-cli/workflows/Java%20CI%20with%20Gradle/badge.svg)\n![CodeQL](https://github.com/Nike-Inc/gimme-a-cli/workflows/CodeQL/badge.svg)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[ ![Download](https://api.bintray.com/packages/nike/maven/gimme-a-cli/images/download.svg) ](https://bintray.com/nike/maven/gimme-a-cli/_latestVersion)\n\n# Gimme a CLI\n\nGimme a CLI is a Java library for creating quick and easy command line interfaces (CLIs) using [JCommander](http://jcommander.org/) and \n[Spring's IoC Container](https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#spring-core).\n\n- JCommander is great for creating command-style CLI argument parsers. Examples of command-style CLIs include git and the AWS CLI.\n- Spring's IoC Container provides dependency injection which helps reduce boiler plate and makes it easier to write testable code.\n- Gimme a Cli eliminates the tedious setup you would otherwise have to do.\n\n## Getting Started\n\n[Example starter project](https://github.com/Nike-Inc/gimme-a-cli-starter-project) can simply be cloned and modified.\n\n## Usage\n\n1. Define one or more commands for your CLI by implementing the Command interface.\n    ```java\n    import com.nike.gimme.a.cli.Command;\n    \n    public class HelloWorld implements Command {\n    \n        @Override\n        public void execute() {\n            System.out.println(\"Hello World!\");\n        }\n    }\n    ```\n    Commands are automatically instantiated as Spring beans (e.g. dependencies can be supplied via constructor injection, etc).\n2. Optionally use JCommander annotations to define command arguments and options.\n    ```java\n    import com.beust.jcommander.Parameter;\n    import com.beust.jcommander.Parameters;\n    import com.nike.gimme.a.cli.Command;\n    \n    @Parameters(commandNames = \"hello-world\",\n                commandDescription = \"Prints \\\"Hello \u003cname\u003e\\\" to the terminal\")\n    public class HelloWorld implements Command {\n    \n        @Parameter(names = {\"--name\"}, required = true)\n        private String name;\n        \n        @Override\n        public void execute() {\n            System.out.println(\"Hello \" + name);\n        }\n    }\n    ```\n\n3. Define a main class and run the GimmeACli program.\n    ```java\n    import com.nike.gimme.a.cli.Config;\n    import com.nike.gimme.a.cli.GimmeACli;\n    \n    public class Main {\n    \n        public static void main(String[] args) {\n            new GimmeACli(\n                    Config.builder()\n                            .withCliName(\"my-cli-name\")\n                            .withPackagesToScan(\"com.nike\")\n                            .build()\n            ).run(args);\n        }\n    }\n    ```\n    Spring setup is done for you using classpath scanning.\n4. Configure SLF4J logging, e.g.,\n     1. Include logback as a dependency.\n        ``` groovy\n        dependencies {\n            implementation \"ch.qos.logback:logback-classic:1.1.11\"\n        }\n        ```\n     2. Provide a [logback.xml](https://github.com/Nike-Inc/gimme-a-cli-starter-project/blob/master/src/main/resources/logback.xml).\n\nAll of these steps have been done for you in the \n[example starter project](https://github.com/Nike-Inc/gimme-a-cli-starter-project) which can simply be cloned and\nmodified to fit your needs..\n\n## Additional Features\n\n- Global `--help` option gives nicely formatted output.\n\n## References\n\n- [JCommander](http://jcommander.org/) - a library for CLI argument parsing.\n- [Spring's IoC](https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#spring-core) - a library for easy dependency injection.\n- [gimme-a-cli-starter-project](https://github.com/Nike-Inc/gimme-a-cli-starter-project) - An example starter project that can simply be cloned and modified.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnike-inc%2Fgimme-a-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnike-inc%2Fgimme-a-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnike-inc%2Fgimme-a-cli/lists"}