{"id":22202699,"url":"https://github.com/namchee/parsley","last_synced_at":"2026-07-06T20:31:31.378Z","repository":{"id":250007116,"uuid":"831567735","full_name":"Namchee/parsley","owner":"Namchee","description":"Parse CLI from a string","archived":false,"fork":false,"pushed_at":"2024-07-24T22:49:45.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-30T03:28:00.582Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Namchee.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-21T00:21:46.000Z","updated_at":"2024-07-24T22:49:48.000Z","dependencies_parsed_at":"2024-12-02T16:43:19.988Z","dependency_job_id":null,"html_url":"https://github.com/Namchee/parsley","commit_stats":null,"previous_names":["namchee/parsley"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Namchee%2Fparsley","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Namchee%2Fparsley/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Namchee%2Fparsley/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Namchee%2Fparsley/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Namchee","download_url":"https://codeload.github.com/Namchee/parsley/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245383119,"owners_count":20606265,"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":[],"created_at":"2024-12-02T16:36:58.266Z","updated_at":"2025-10-25T23:17:09.176Z","avatar_url":"https://github.com/Namchee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parsley\n\nParse CLI command, arguments, and flags from a string.\n\n## Installation\n\nYou can install this package using your favorite package manager:\n\n```bash\n# Using npm\nnpm install @namchee/parsley\n\n# Using yarn\nyarn add @namchee/parsley\n\n# Using pnpm\npnpm install @namchee/parsley\n\n# Using bun\nbun install @namchee/parsley\n```\n\n## API\n\n### `parseCLI(command: string)`\n\nParse command line arguments from a string and extract the command, arguments, and flags.\n\n### Parameter\n\n- `command` - The CLI command you want to parse.\n\n### Returns\n\n- `CLICommand` - Extracted CLI command\n\n### Throws\n\n- `InvalidFlagError` - Thrown when the parser tries to parse invalid CLI command.\n\n## Types\n\n### `CLICommand`\n\nExtracted CLI command including its arguments and flags. Returned by `parseCLI` function.\n\n#### Properties\n\n- `command` - The program that's called by this command\n- `args` - Command line arguments\n- `flags` - List of command line flags with their values\n\n## Errors\n\n### `InvalidFlagError`\n\nThrown when the parser encounters unclosed flag quotation or incorrect positional argument position, such as when the positional argument is provided *after* flag definition.\n\n## FAQ\n\n### What's the difference between this and `parseArgs` from `node:util`?\n\n1. This package works in any environment that runs JavaScript\n2. This package doesn't need pre-defined options to parse CLI command\n\n### What's the difference between this and CLI builders\n\n1. This package doesn't support pre-defined template other than flag aliases\n2. This package doesn't automatically read your arguments and parse it, you must provide the string yourself.\n\nTL;DR: This is a more primitive package of CLI builders that only support simple parsing of commands.\n\n### Does this package support chained commands (e.g: `a \u0026\u0026 b`)?\n\nNo, split it yourself for now. However if there is a demand for it, I'll consider it.\n\n### Does this package support nested commands (e.g: `a \\`b\\``)\n\nNot at the moment. However if there is a demand for it, I'll consider it.\n\n### Where does the name come from?\n\n`parsecli` sounds similar to Parsley\n\n## License\n\nThis project is licensed under the [MIT License](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnamchee%2Fparsley","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnamchee%2Fparsley","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnamchee%2Fparsley/lists"}