{"id":22866840,"url":"https://github.com/insomnimus/clad","last_synced_at":"2026-05-11T03:10:50.169Z","repository":{"id":57675670,"uuid":"482307946","full_name":"insomnimus/clad","owner":"insomnimus","description":"A command line argument parser for Deno","archived":false,"fork":false,"pushed_at":"2022-05-02T20:27:55.000Z","size":56,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T04:18:28.346Z","etag":null,"topics":["argument-parser","cli","deno","flags","javascript","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/insomnimus.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":"2022-04-16T16:42:53.000Z","updated_at":"2022-05-08T12:47:57.000Z","dependencies_parsed_at":"2022-09-26T20:41:38.010Z","dependency_job_id":null,"html_url":"https://github.com/insomnimus/clad","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insomnimus%2Fclad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insomnimus%2Fclad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insomnimus%2Fclad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/insomnimus%2Fclad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/insomnimus","download_url":"https://codeload.github.com/insomnimus/clad/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246453290,"owners_count":20779931,"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":["argument-parser","cli","deno","flags","javascript","typescript"],"created_at":"2024-12-13T12:17:38.322Z","updated_at":"2026-05-11T03:10:45.142Z","avatar_url":"https://github.com/insomnimus.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clad\n[![build badge](https://github.com/insomnimus/clad/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/insomnimus/clad/actions/workflows/main.yml)\n[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https://deno.land/x/clad/mod.ts)\n\nClad is a simple command line arguments parser. It is inspired by the awesome\nrust library, [clap](https://github.com/clap-rs/clap).\n\n## Features\n- Supports short (`-f`), long (`--long`) and positional arguments.\n- `--option value` and `--option=value` are allowed.\n- `-f value`, `-f=value` and `-fvalue` are also allowed.\n- You can combine short flags: `-Syu` is the same as `-S -y -u`.\n- You can specify any flag to take multiple values.\n- You can specify default values.\n- You can limit possible values to a set. (can set the comparison to be case insensitive as well).\n- You can specify a flag as conflicting with another.\n- You can specify a flag as requiring another.\n- Pass positional values that start with `-` after `--`. E.g.\n  `./amyapp -- -somevalue`.\n- Supports required/optional flags.\n- Supports per-argument validation with a closure.\n- Simple interface.\n- Auto generated help message.\n\n## Unsupported\nFor now there is no support for subcommands.\n\n## Usage Example\n\u003e Note: Check out the [examples directory](examples/) for more.\n\n```ts\n// examples/bump-version.ts\nimport { Command } from \"../mod.ts\";\n\nconst args = new Command(\"bump-version\", {\n\tbump: {\n\t\tflags: [\"b\", \"bump\"],\n\t\thelp: \"Bump which field?\",\n\t\t// Only these valeus will be accepted\n\t\tpossible: [\"major\", \"minor\", \"patch\"],\n\t\t// Match above values case insensitively\n\t\tignoreCase: true,\n\t\t// This flag must be present\n\t\trequired: true,\n\t},\n\tver: {\n\t\t// We don't specify `flag` because this is a positional\n\t\thelp: \"The version to bump\",\n\t\trequired: true,\n\t\t// Run this callback to validate the input\n\t\tvalidate: s =\u003e\n\t\t\ts.match(/^\\d+\\.\\d+\\.\\d+$/)\n\t\t\t\t? undefined\n\t\t\t\t: \"the value must be in the form major.minor.patch where each field is a non-negative number\",\n\t},\n})\n\t.version(\"0.1.0\")\n\t.about(\"Increment a semantic version\")\n\t.parse(Deno.args);\n\n// WE can trust the input!\nlet [major, minor, patch] = args.str.ver!.split(\".\").map(x =\u003e parseInt(x));\n\nswitch (args.str.bump.toLowerCase()) {\n\tcase \"major\": {\n\t\tmajor++;\n\t\tminor = 0;\n\t\tpatch = 0;\n\t\tbreak;\n\t}\n\tcase \"minor\": {\n\t\tminor++;\n\t\tpatch = 0;\n\t\tbreak;\n\t}\n\t// guaranteed to be \"patch\"!\n\tdefault: {\n\t\tpatch++;\n\t\tbreak;\n\t}\n}\n\nconsole.log(`${args.str.ver} -\u003e ${major}.${minor}.${patch}`);\n\n```\n\n### Example Session\n```output\n$ deno run ./bump-version.ts -h\nUSAGE: bump-version [OPTIONS] ARGS...\nIncrement a semantic version\n\nOPTIONS:\n    -b, --bump \u003cbump\u003e: Bump which field? (required) [possible values: major, minor, patch]\n    -V, --version: Show version information and exit\n    -h, --help: Show this message and exit\n\nARGS:\n    \u003cver\u003e: The version to bump (required)\n$ deno run ./bump-version.ts --version\nbump-version 0.1.0\n$ deno run ./bump-version.ts --bump major 0.1.0\n0.1.0 -\u003e 1.0.0\n$ deno run ./bump-version.ts 0.1.0 -bMiNoR\n0.1.0 -\u003e 0.2.0\n$ deno run ./bump-version.ts 0.1.0\nerror: missing required value for -b --bump \u003cbump\u003e\nrun with --help for more info\n$ deno run ./bump-version.ts -b mayor 0.1.0\nerror: failed to validate the `mayor` value of -b --bump \u003cbump\u003e: value must be one of [major, minor, patch]\nrun with --help for more info\n$ deno run ./bump-version.ts not_a_version --bump=patch\nerror: failed to validate the `not_a_version` value of \u003cver\u003e: the value must be in the form major.minor.patch where each field is a non-negative number\nrun with --help for more info\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsomnimus%2Fclad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finsomnimus%2Fclad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsomnimus%2Fclad/lists"}