{"id":15289107,"url":"https://github.com/indoorvivants/decline-derive","last_synced_at":"2025-04-13T08:11:51.805Z","repository":{"id":248021680,"uuid":"826824208","full_name":"indoorvivants/decline-derive","owner":"indoorvivants","description":"Derive Decline CLIs automatically from your enums and case classes in Scala 3","archived":false,"fork":false,"pushed_at":"2025-04-02T09:09:58.000Z","size":62,"stargazers_count":12,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T08:11:40.127Z","etag":null,"topics":["cli","decline","derive","macros","scala","scala3"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indoorvivants.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-10T12:57:33.000Z","updated_at":"2025-04-02T09:07:49.000Z","dependencies_parsed_at":"2024-10-14T19:41:42.523Z","dependency_job_id":null,"html_url":"https://github.com/indoorvivants/decline-derive","commit_stats":null,"previous_names":["indoorvivants/decline-derive"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indoorvivants%2Fdecline-derive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indoorvivants%2Fdecline-derive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indoorvivants%2Fdecline-derive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indoorvivants%2Fdecline-derive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indoorvivants","download_url":"https://codeload.github.com/indoorvivants/decline-derive/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248681497,"owners_count":21144700,"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":["cli","decline","derive","macros","scala","scala3"],"created_at":"2024-09-30T15:59:18.129Z","updated_at":"2025-04-13T08:11:51.798Z","avatar_url":"https://github.com/indoorvivants.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# decline-derive\n\n\u003c!--toc:start--\u003e\n- [decline-derive](#decline-derive)\n  - [Installation](#installation)\n  - [Getting started](#getting-started)\n  - [Contributing](#contributing)\n\u003c!--toc:end--\u003e\n\nExperimental library to quickly derive [Decline](https://ben.kirw.in/decline/) CLI\ninterfaces, to quickly prototype CLI applications.\n\nIt is driven by types (with `enum`s and `case classes` representing groups of subcommands and groups of parameters respectively, see example below), and can handle anything Decline has built-in support for, and some extra handling of `Option[..]` and `List[..]` types. The library is inspired by [clap from Rust](https://docs.rs/clap/latest/clap/index.html), but mainly because it's the most recent example I came across - deriving CLI parsers with macros is a long standing tradition in Scala.\n\nThis library does not aim to cover every possible case representable with Decline - in fact\nin only covers the most basic of cases.\nFor complicated CLIs I would still recommend using the approach that Decline library recommends.\n\nAcknowledgements:\n- [August Nagro's post on how to read annotations from macros](https://august.nagro.us/read-annotations-from-macro.html)\n- [Scala 3 documentation page on macro-driven derivation](https://dotty.epfl.ch/docs/reference/contextual/derivation-macro.htm:)\n\n## Installation\n\nLatest version: [![decline-derive Scala version support](https://index.scala-lang.org/indoorvivants/decline-derive/decline-derive/latest.svg)](https://index.scala-lang.org/indoorvivants/decline-derive/decline-derive)\n\n- **SBT**: `libraryDependencies += \"com.indoorvivants\" %%% \"decline-derive\" % \"\u003clatest version\u003e\"`\n- **Scala CLI**: `//\u003e using dep com.indoorvivants::decline-derive::\u003clatest version\u003e`\n- **Mill**: `ivy\"com.indoorvivants::decline-derive::\u003clatest version\u003e\"`\n\n## Getting started\n\n```scala\nimport decline_derive.*\n\nenum CLI derives CommandApplication:\n  case Index(location: String, @Name(\"lit\") isLit: Boolean)\n  case Run(@Positional(\"files\") files: List[String])\n\n@main def helloDecline(args: String*) =\n    println(CommandApplication.parse[CLI](args))\n```\n\nNotice how we're using `@Name(\"lit\")` to customise certain aspects of\ngenerated Decline parser.\n\nFor more configuration options, see [tests](./library.test.scala), [annotations](./annotations.scala).\n\n## Contributing\n\nIf you see something that can be improved in this library – please contribute!\nTurning users into contributors and maintainers is one of the purest joys of OSS.\n\nThis library was largely put together on board of a plane during a very short flight, so it might have some rough edges.\n\nThis is a standard Scala CLI project, with a Makefile for some useful commands.\n\nHere are some useful commands:\n\n- `make test` – run tests. Note that this command runs tests for all three platforms -\n    which might be unnecessarily slow for development purposes. Quickest feedback loop\n    is achieved by just running `scala-cli test *.scala`\n- `make check-docs` – verify that snippets in `README.md` (this file) compile\n- `make pre-ci` – format the code so that it passes CI check\n- `make run-example` – run example from README\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findoorvivants%2Fdecline-derive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findoorvivants%2Fdecline-derive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findoorvivants%2Fdecline-derive/lists"}