{"id":21323203,"url":"https://github.com/wilwade/arguments","last_synced_at":"2025-03-15T23:15:56.975Z","repository":{"id":57478965,"uuid":"97252713","full_name":"wilwade/arguments","owner":"wilwade","description":"Argument parser for Elixir","archived":false,"fork":false,"pushed_at":"2017-07-14T17:32:07.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T10:19:39.501Z","etag":null,"topics":["elixir"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wilwade.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":"2017-07-14T16:21:47.000Z","updated_at":"2017-07-21T00:55:52.000Z","dependencies_parsed_at":"2022-09-05T11:11:12.316Z","dependency_job_id":null,"html_url":"https://github.com/wilwade/arguments","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilwade%2Farguments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilwade%2Farguments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilwade%2Farguments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilwade%2Farguments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wilwade","download_url":"https://codeload.github.com/wilwade/arguments/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243801688,"owners_count":20350108,"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":["elixir"],"created_at":"2024-11-21T20:21:27.866Z","updated_at":"2025-03-15T23:15:56.935Z","avatar_url":"https://github.com/wilwade.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Arguments\n\nArguments parses command line arguments with a declarative, simple setup\n\nProduces results as a map for super pattern matching argument handling in your app!\n\n`$ cmd new myname --more`\ninto\n`%{new: true, name: \"myname\", more: true}`\n\nDocumentation: [https://hexdocs.pm/arguments/](https://hexdocs.pm/arguments/)\n\n## Installation\n\nAdd `arguments` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:arguments, \"~\u003e 0.1.0\"}]\nend\n```\n\n## Usage\n\nArguments provides a module with argument parsing through `YourArguments.parse(incoming)`\n\n`use Arguments`\n\nThere are two styles of arguments allowed\n- [`command`](https://hexdocs.pm/arguments/Arguments.html#command/2) - `$ cmd new project`\n- [`flag`](https://hexdocs.pm/arguments/Arguments.html#flag/2) - `$ cmd --dir /etc`\n\nThese two styles can be mixed, but the flags will always take priority\n\n### Full Example:\n```elixir\nmodule MyArguments do\n  use Arguments\n\n  command \"new\", do: [\n    arguments: [:name, :dir]\n  ]\n\n  flag \"name\", do: [\n    type: :string,\n    alias: :n,\n    defaults: fn (n) -\u003e [\n      dir: \"./#\\{n\\}\"\n    ] end\n  ]\n\n  flag \"more\", do: %{\n    type: :boolean,\n    alias: :m\n  }\n\n  flag \"more_defaults\", do: %{\n    type: :boolean,\n    alias: :m,\n    defaults: [\n      something: \"else\"\n    ]\n  }\n\n  flag \"dir\", do: [\n    type: :string\n  ]\nend\n```\n\n```elixir\niex\u003e MyArguments.parse([\"--name\", \"myname\"])\n%{name: \"myname\", dir: \"./myname\"}\n\niex\u003e MyArguments.parse([\"new\", \"myname\", \"dirhere\"])\n%{new: true, name: \"myname\", dir: \"dirhere\"}\n\niex\u003e MyArguments.parse([\"--more\"])\n%{more: true}\n\niex\u003e MyArguments.parse([\"-m\"])\n%{more: true}\n\niex\u003e MyArguments.parse([\"--not-defined\"])\n%{}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilwade%2Farguments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilwade%2Farguments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilwade%2Farguments/lists"}