{"id":13903096,"url":"https://github.com/denisidoro/docpars","last_synced_at":"2025-03-22T06:30:52.587Z","repository":{"id":50888888,"uuid":"272095314","full_name":"denisidoro/docpars","owner":"denisidoro","description":"An ultra-fast parser for declarative command-line options for your shell scripts.","archived":false,"fork":false,"pushed_at":"2022-08-01T12:48:50.000Z","size":47,"stargazers_count":23,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-13T05:09:25.260Z","etag":null,"topics":["argument-parsing","cli","rust","shell-scripting"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denisidoro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"github":"denisidoro"}},"created_at":"2020-06-13T22:27:15.000Z","updated_at":"2024-03-10T07:55:16.000Z","dependencies_parsed_at":"2022-08-25T15:50:58.429Z","dependency_job_id":null,"html_url":"https://github.com/denisidoro/docpars","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisidoro%2Fdocpars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisidoro%2Fdocpars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisidoro%2Fdocpars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denisidoro%2Fdocpars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denisidoro","download_url":"https://codeload.github.com/denisidoro/docpars/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244189619,"owners_count":20412986,"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-parsing","cli","rust","shell-scripting"],"created_at":"2024-08-06T22:01:36.936Z","updated_at":"2025-03-22T06:30:52.146Z","avatar_url":"https://github.com/denisidoro.png","language":"Rust","funding_links":["https://github.com/sponsors/denisidoro"],"categories":["cli"],"sub_categories":[],"readme":"# docpars [![Actions Status](https://github.com/denisidoro/docpars/workflows/CI/badge.svg)](https://github.com/denisidoro/docpars/actions) ![GitHub release](https://img.shields.io/github/v/release/denisidoro/docpars?include_prereleases)\n\nAn ultra-fast parser for declarative command-line options for your shell scripts.\n\nIt implements the [Docopt syntax](http://docopt.org/) and is written in Rust.\n\nTable of contents\n-----------------\n\n   * [Usage](#usage)\n   * [Motivation](#motivation)\n   * [Installation](#installation)\n      * [Using Homebrew or Linuxbrew](#using-homebrew-or-linuxbrew)\n      * [Using cargo](#using-cargo)\n      * [Downloading pre-compiled binaries](#downloading-pre-compiled-binaries)\n      * [Building from source](#building-from-source)\n   * [Credits](#credits)\n\nUsage\n------------\n\nIf you run `coffee make --dark` for the following script...\n```bash\n#!/usr/bin/env bash\n\n##? Coffee tool\n##?\n##? Usage:\n##?     coffee make [--dark]\n##?     coffee drink\n\n# This function can be included in a helper bash file \n# and imported by all your scripts\nargs::parse() {\n   eval \"$(/path/to/docpars -h \"$(grep \"^##?\" \"$0\" | cut -c 5-)\" : \"$@\")\"\n}\n\nargs::parse \"$@\"\n\nif $drink; then\n   echo \"Drinking coffee...\"\nelif $make; then\n   $dark \u0026\u0026 echo \"Making dark coffee...\" || echo \"Making coffee...\"\nfi\n```\n\n...then `Making dark coffee...` should be printed.\n\nMotivation\n------------\nThe [default implementation](https://github.com/docopt/docopts) of docopt for shell scripts uses Python under the hood. You may want to use *docpars* instead in the following scenarios\n\n### You don't want to install Python\n\nThis may be the case of CI/CD instances, minimal docker containers or environments where you may want to run some scripts but aren't equipped with your whole dev arsenal, such as [Termux on Android](https://termux.com/) or [WSL on Windows](https://docs.microsoft.com/en-us/windows/wsl/install-win10).\n\nInstead of installing Python you can simply drop a ~1MB static binary.\n\n### You want extreme performance\n\n[Benchmarks](https://github.com/denisidoro/docpars/blob/master/docs/benchmark.md) show that *docpars* is up to 5.7 times faster than the Python equivalent.\n\nThis may not be noticible for most use-cases but it may make the difference if your script is called inside a for loop, for example.\n\nInstallation\n------------\n\n### Using [Homebrew](http://brew.sh/) or [Linuxbrew](http://linuxbrew.sh/)\n\n```sh\nbrew install denisidoro/tools/docpars\n```\n\n### Using [cargo](https://github.com/rust-lang/cargo)\n\n```bash\ncargo install docpars\n```\n\n### Downloading pre-compiled binaries\n\nYou can download binaries [here](https://github.com/denisidoro/docpars/releases/latest).\n\nThey are available for OSX, Android and Linux with ARM and x86_64 variants.\n\n### Building from source\n\n```bash\ngit clone https://github.com/denisidoro/docpars ~/.docpars\ncd ~/.docpars\ncargo install --path .\n```\n\nCredits\n------------\n\nMost work was done in [docopt.rs](https://github.com/docopt/docopt.rs) by [BurntSushi](https://github.com/BurntSushi), where the actual Docopt parsing is implemented.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenisidoro%2Fdocpars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenisidoro%2Fdocpars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenisidoro%2Fdocpars/lists"}