{"id":19466901,"url":"https://github.com/jaredkrinke/flags_usage","last_synced_at":"2025-10-20T11:20:13.852Z","repository":{"id":62422421,"uuid":"428093029","full_name":"jaredkrinke/flags_usage","owner":"jaredkrinke","description":"Adds \"--help\" to Deno's std/flags module","archived":false,"fork":false,"pushed_at":"2021-12-21T04:46:13.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-08T20:46:02.055Z","etag":null,"topics":["deno","flags","help","usage"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit-0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaredkrinke.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":"2021-11-15T02:05:50.000Z","updated_at":"2023-04-04T23:59:05.000Z","dependencies_parsed_at":"2022-11-01T17:32:37.352Z","dependency_job_id":null,"html_url":"https://github.com/jaredkrinke/flags_usage","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredkrinke%2Fflags_usage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredkrinke%2Fflags_usage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredkrinke%2Fflags_usage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredkrinke%2Fflags_usage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredkrinke","download_url":"https://codeload.github.com/jaredkrinke/flags_usage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240680795,"owners_count":19840312,"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":["deno","flags","help","usage"],"created_at":"2024-11-10T18:31:29.491Z","updated_at":"2025-10-20T11:20:13.769Z","avatar_url":"https://github.com/jaredkrinke.png","language":"TypeScript","readme":"# flags_usage\nAdds \"--help\" to Deno's std/flags module, for printing out command line usage/option information.\n\n# Example\nmain.ts:\n```typescript\nimport { processFlags } from \"https://deno.land/x/flags_usage/mod.ts\";\n\nconst options = {\n    preamble: \"Usage: my-tool \u003coptions\u003e\",        // New: Optional preamble for describing non-flag/positional arguments\n    description: { output: \"Output directory\" }, // New: Description of flag\n    argument: { output: \"dir\" },                 // New: \"\u003cdir\u003e\" in the output below\n    string: [ \"output\" ],\n    default: { output: \"out\" },\n};\n\n// `processFlags` parses normally, except it will print usage and exit on `--help`\nconst { output } = processFlags(Deno.args, options);\n```\n\nOutput:\n```\n$ deno run main.ts --help\nUsage: my-tool \u003coptions\u003e\n\nOptions:\n  --output \u003cdir\u003e  Output directory (default: \"out\")\n  -h, -?, --help  Display usage information\n```\n\nNote that `parseFlags`, `logUsage`, etc. (see API) can be used if automatically exiting on `--help` is not desirable.\n\n# API\n## Options\nAll `options` arguments follow std/flags's interface, with the following new, *optional* properties:\n\n* `preamble`: An optional string to print out before flag information on `--help`\n* `description`: An object mapping flags to descriptions that will be displayed on `--help`\n* `argument`: An object mapping flags to names for their arguments to be displayed on `--help` (e.g. mapping `out` to `path` will display `--out \u003cpath\u003e ...` instead of the generic `--out \u003cstr\u003e` for string arguments)\n\n## `processFlags(Deno.args, options)`\nParse options as usual, but add `--help` and automatically print usage and exit if `--help`/`-h`/`-?` are specified.\n\n## `parseFlags(Deno.args, options)`\nParse options as usual, with `--help`/`-h`/`-?` added as a Boolean flag (note: with this function, the caller must decide what to do if the `help` flag is set to true--use `processFlags` to automatically print usage and exit).\n\n## `formatUsage(options)`\nFormat usage information as a string.\n\n## `logUsage(options)`\nFormat usage information and print to the console.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredkrinke%2Fflags_usage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredkrinke%2Fflags_usage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredkrinke%2Fflags_usage/lists"}