{"id":13804941,"url":"https://github.com/nedpals/vargs","last_synced_at":"2025-05-13T18:33:00.465Z","repository":{"id":97412768,"uuid":"194396241","full_name":"nedpals/vargs","owner":"nedpals","description":"Simple argument parsing library for V.","archived":true,"fork":false,"pushed_at":"2020-06-14T23:52:54.000Z","size":43,"stargazers_count":38,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-18T21:46:47.595Z","etag":null,"topics":["argument-parser","cli","v","vlang"],"latest_commit_sha":null,"homepage":"","language":"V","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/nedpals.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}},"created_at":"2019-06-29T11:04:10.000Z","updated_at":"2024-05-27T13:10:43.000Z","dependencies_parsed_at":"2024-01-27T09:38:29.733Z","dependency_job_id":"65aeea32-e546-4264-83d5-0aa5e9d73086","html_url":"https://github.com/nedpals/vargs","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/nedpals%2Fvargs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nedpals%2Fvargs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nedpals%2Fvargs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nedpals%2Fvargs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nedpals","download_url":"https://codeload.github.com/nedpals/vargs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254003465,"owners_count":21997891,"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","v","vlang"],"created_at":"2024-08-04T01:00:55.540Z","updated_at":"2025-05-13T18:33:00.208Z","avatar_url":"https://github.com/nedpals.png","language":"V","readme":"# vargs 0.5\nA simple argument parsing library for [V](https://vlang.io). Ported from [this file](https://github.com/nedpals/kuman/blob/master/src/parser.ts) which was originally written on Typescript.\n\n\u003e The version of this module will remain in `0.x.x` unless the language API's are finalized and implemented.\n\n```v\n// dummy.v\nimport vargs // or import nedpals.vargs for vpm users\nimport os\n\nfn main() {\n    // Second argument removes the first argument which contains the path of the executable.\n    mut _args := vargs.new(os.args, 1)\n    \n    // Use the `alias` method if you want to map an option to an existing option.\n    _args.alias('W', 'with')\n\n    // Parsing is now a separate step\n    _args.parse()\n\n    println(_args.str())\n    println(_args.command)\n    println(_args.unknown[0])\n    println('with? ' + _args.options['with'])\n}\n```\n\n```bash\n./dummy cook chicken --with love -W soul\n# { command: \"cook\", options: {\"with\" =\u003e \"love\"}, unknown: [\"chicken\"] }\n# cook\n# chicken\n# with? love,soul\n```\n\n## Installation\nVia vpm:\n```\nv install nedpals.vargs\n```\n\nVia [vpkg](https://github.com/vpkg-project/vpkg):\n```\nvpkg get vargs\n\n# or\n\nvpkg get https://github.com/nedpals/vargs\n```\n\n## Changes in `0.5`\n1. Breaking change on the usage of the library.\n2. `alias(orig, dest)` for mapping options to existing ones.\n3. Array and the `start` index are now moved into the `Args` struct as internal fields.\n4. Default values are now moved inside the declaration of the `Args` struct.\n\n## Changes in `0.4`\n1. Use comma-separated values of an option as array of strings with the `array_option(name)` function\n2. Fixed unused variable error.\n3. Options values are now merged if the name of the option has already existed.\n4. Fixed problem when installing module from VPM. #2\n5. Final stable release? Hmmm\n\n### `0.4.1`\n1. Merge duplicate codes into a function.\n2. Fixed another unused variable error.\n\n### `0.4.2`\n1. Fixed parsing errors when used in complex scenarios.\n2. Add proper tests.\n3. Now only works with `0.1.22` and above.\n4. Fixed maps formatting when converting `Args` to string.\n5. Partial refactoring of code including converting `if` statements to `match`\n\n### `0.4.3`\n1. Fix breaking changes when compiling on V `0.1.23`\n\n## Contributing\n1. Fork it (\u003chttps://github.com/nedpals/vargs/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Testing\nTo test the module, just type the following command:\n```\nv test vargs_test.v\n```\n\n## License\n[MIT](LICENSE)\n\n## Contributors\n\n- [Ned Palacios](https://github.com/nedpals) - creator and maintainer\n","funding_links":[],"categories":["Libraries"],"sub_categories":["Command line interface (CLI) / Terminal / Shell"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnedpals%2Fvargs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnedpals%2Fvargs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnedpals%2Fvargs/lists"}