{"id":28415418,"url":"https://github.com/enginehub/intake","last_synced_at":"2025-12-17T13:53:12.803Z","repository":{"id":19719120,"uuid":"22974847","full_name":"EngineHub/Intake","owner":"EngineHub","description":"IoC-oriented Java command parsing library","archived":false,"fork":false,"pushed_at":"2021-12-30T06:26:25.000Z","size":296,"stargazers_count":101,"open_issues_count":8,"forks_count":20,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-09-05T18:43:43.830Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EngineHub.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":"2014-08-15T01:50:57.000Z","updated_at":"2025-08-13T11:12:16.000Z","dependencies_parsed_at":"2022-08-24T14:09:04.434Z","dependency_job_id":null,"html_url":"https://github.com/EngineHub/Intake","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EngineHub/Intake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineHub%2FIntake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineHub%2FIntake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineHub%2FIntake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineHub%2FIntake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EngineHub","download_url":"https://codeload.github.com/EngineHub/Intake/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineHub%2FIntake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273847178,"owners_count":25178640,"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-09-05T02:00:09.113Z","response_time":402,"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":[],"created_at":"2025-06-03T15:41:57.093Z","updated_at":"2025-12-17T13:53:12.740Z","avatar_url":"https://github.com/EngineHub.png","language":"Java","readme":"# Intake\n\nIntake is a IoC-oriented command parsing library.\n\nConsider the following command:\n\n```\n/body settype pluto dwarfplanet\n```\n\nConsider a theoretical `Body` class and `CelestialType` enum in the project. The command above presumably would execute the following code:\n\n```java\npluto.setType(CelestialType.DWARF_PLANET);\n```\n\nRather than write argument parsing code in the routine for that command, it'd be simpler to simply request a `Body` and a `CelestialType` from the user, so it'd be possible to write the command like so:\n\n```java\nvoid setType(Body body, CelestialType type) {\n\tbody.setType(type);\n}\n```\n\nThe purpose of Intake is to make that possible.\n\n## Overview\n\nIntake consists of four parts:\n\n### Command Framework\n\nThe command framework consists of some basic interfaces and classes:\n\n* Commands are modeled by `CommandCallable`\n* Groups of sub-commands are modeled by `Dispatcher`\n* Descriptions of commands are modeled by `Description`\n* Individual parameters (for introspection) are modeled by `Parameter`\n* Commands that can suggest completions are modeled by `CommandCompleter`\n* Arguments (accessed as a stack) are represented by `CommandArgs`\n\nThere is also support for:\n\n* Boolean single-character flags (`/command -f`)\n* Value flags (`/command -v value`)\n* Testing whether a user has permission to execute a command\n\nThe goal of the framework is to provide a compromise between a heavily-opinionated framework and a flexible one.\n\n### Parameter Injection\n\nThe parameter injection framework provides IoC-oriented argument parsing and completion.\n\nRaw use of the injection framework can be best seen in an example:\n\n```java\nInjector injector = Intake.createInjector();\ninjector.install(new PrimitivesModule());\ninjector.install(new UniverseModule());\n\nBuilder argParserBuilder = new Builder(injector);\nargParserBuilder.addParameter(Body.class);\nargParserBuilder.addParameter(CelestialType.class);\n\nArgumentParser parser = argParserBuilder.build();\nparser.parseArguments(Arguments.of(\"pluto\", \"dwarfplanet\")));\n```\n\nArgumentParser finds \"providers\" for the Body and CelestialType Java types, which are then later utilized to create object instances from the provided arguments.\n\n`UniverseModule` might look like this:\n\n```java\npublic class UniverseModule extends AbstractModule {\n\n    private final Universe universe;\n\n    public UniverseModule(Universe universe) {\n        this.universe = universe;\n    }\n\n    @Override\n    protected void configure() {\n        bind(Universe.class).toInstance(universe);\n        bind(Body.class).toProvider(new BodyProvider(universe));\n        bind(CelestialType.class).toProvider(\n\t\t\t\tnew EnumProvider\u003cCelestialType\u003e(CelestialType.class));\n    }\n\n}\n```\n\nThe parameter injection framework has strong similarity to Google Guice's API.\n\n### Parametric Commands\n\nThe parametric command framework provides an opinionated method of defining commands using classes:\n\n```java\npublic class UniverseCommands {\n\n    @Command(aliases = \"settype\", desc = \"Set the type of an object\")\n    public void setType(Body body, CelestialType type) {\n        body.setType(type);\n    }\n\n}\n```\n\nIt makes use of the parameter injection framework.\n\n### Fluent API\n\nThere is also a fluent API that combines the command framework with the parametric command framework.\n\n\n## Examples\n\nTo see some example code, check out the [example projects](intake-example/src/main/java/com/sk89q/intake/example).\n\n## Usage\n\nThere are two major versions of Intake:\n\n* 3.x (available via Git tags)\n* 4.x (in the `master` branch)\n\nThere was a major overhaul in 4.0 to decompule the IoC portion from the parametric binding. Previously they were an inseperable couple.\n\nThe documentation in the wiki is for 3.x. The examples in this README are for 4.x.\n\n### Resolution\n\nCurrently, Intake is available in sk89q's Maven repository:\n\n```xml\n\u003crepositories\u003e\n  \u003crepository\u003e\n    \u003cid\u003emaven.enginehub.org\u003c/id\u003e\n    \u003curl\u003ehttps://maven.enginehub.org/repo/\u003c/url\u003e\n  \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\nor for Gradle users:\n\n```groovy\nrepositories {\n    maven { url \"https://maven.enginehub.org/repo/\" }\n}\n```\n\nDepending on whether you want to use 3.x (3.1.2 is recommended) or 4.x, the Maven group ID will vary:\n\n* 3.1.2:\n\t* Group ID: `com.sk89q`\n\t* Artifact ID: `intake`\n\t* Version: `3.1.2`\n* 4.0:\n\t* Group ID: `com.sk89q.intake`\n\t* Artifact ID: `intake`\n\t* Version: `4.0-SNAPSHOT`\n\n**Note:** The API is subject to change in snapshot builds.\n\n### Migration\n\nIf you are coming from the command framework that was used in WorldEdit since 2010, then there have been many changes.\n\nIf you are moving from 3.x to 4.x, then the changes have not been too major (except for registering bindings). Some classes were moved around or renamed.\n\n## Documentation\n\nIf you are using 3.x, find work-in-progress documentation at https://github.com/sk89q/Intake/wiki\n\nHowever, if you are using 4.x, you are better looking at examples found in the repository.\n\n## Compiling\n\nUse Gradle to compile Intake.\n\nIf you are on Linux or Mac OS X, run the following in your terminal:\n\n    ./gradlew clean build\n\nIf you are on Windows, run the following in your command prompt:\n\n    gradlew clean build\n\n## Contributing\n\nIntake is available under the GNU Lesser General Public License.\n\nWe happily accept contributions, especially through pull requests on GitHub.\n\n## Links\n\n* [Visit our website](http://www.enginehub.org/)\n* [IRC channel](http://skq.me/irc/irc.esper.net/sk89q/) (#sk89q on irc.esper.net)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenginehub%2Fintake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenginehub%2Fintake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenginehub%2Fintake/lists"}