{"id":15994019,"url":"https://github.com/knutwalker/arguments","last_synced_at":"2026-01-18T03:20:07.553Z","repository":{"id":20211887,"uuid":"23483434","full_name":"knutwalker/arguments","owner":"knutwalker","description":"Simple parsing of command line arguments for Scala","archived":false,"fork":false,"pushed_at":"2014-08-31T22:50:05.000Z","size":208,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-17T18:38:18.257Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/knutwalker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-30T02:53:50.000Z","updated_at":"2014-08-30T02:53:50.000Z","dependencies_parsed_at":"2022-08-28T09:20:09.418Z","dependency_job_id":null,"html_url":"https://github.com/knutwalker/arguments","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/knutwalker/arguments","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2Farguments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2Farguments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2Farguments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2Farguments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knutwalker","download_url":"https://codeload.github.com/knutwalker/arguments/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2Farguments/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28528036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"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":"2024-10-08T07:05:04.400Z","updated_at":"2026-01-18T03:20:07.523Z","avatar_url":"https://github.com/knutwalker.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"Arguments\n=========\n\nSimple parsing of command line arguments for Scala.\n\n## Motivation\n\nThere are already many good argument parsing libraries out there,\nbut I wanted to write this one mainly to explore Scala macros.\nThe goal is to have a macro generate the code that is required to\nparse the arguments into a given type by statically examining this type,\nso that one doesn't have to configure a arguments schema or something similar.\nThe goal is not to have a full featured, highly flexible commandline parser.\n\n\n## Get it\n\nArguments is yet to be coded, it's just an idea for now.\n\n## Usage\n\n```scala\nimport java.io.File\nimport scala.concurrent.duration.Duration\nimport arguments._\n\ncase class Job(target: File) extends AnyVal\ncase class Server(host: String = \"localhost\", port: Int = 8080)\ncase class Cli(name: String, jobs: List[Job], timeout: Duration, server: Server)\n\nobject Main extends App {\n  val cli: Cli = Arguments[Cli](args)\n  println(cli)\n}\n```\n\n\n```\n./foo --name bar --server-host '12.34.56.78' --job /foo/bar --job /bar/baz --timeout 60s\nCli(bar, List(Job(/foo/bar), Job(/bar/baz)), 60 seconds, Server(12.34.56.78, 8080))\n```\n\n### In depth usage\n\nMost arguments/options/cli parser require you to configure a parser instance or provide some kind of schema,\nthen you invoke this parser and extract the result to build up your options types.\nWith Arguments, you specify your options types upfront and they will provide the schema\nby applying some rules and conventions. The rest is done by a macro.\n\n### Conventions\n\n- all parameters are mandatory\n- the name of a parameter names serve as options long name or its base name\n- the type of a parameter determines how it is translated/parsed\n - boolean parameters result in a `--{name}` and a `--no-{name}` flag\n - string and numeric parameters result in a `--{name} {arg}` option\n - java.io.File parameters result in a `--{name} {arg}` option (same as string, really)\n - scala.concurrent.duration.Duration parameters result in a `--{name} {arg}` option, where the `{arg}` is parsed by the Duration constructor\n - List[_] parameter allow for repetition\n - default values allow for optional parameters\n - types that extend AnyVal are treated as value classes, that is their value type determines the result\n - case types introduce groups. their parameters are interpreted recursively, but their names are joined with the name of the case parameters by a `-`\n\n### TODO\n\n- conflict resulution\n- short names\n- backends\n\n## License\n\nApache 2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknutwalker%2Farguments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknutwalker%2Farguments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknutwalker%2Farguments/lists"}