Giter Site home page Giter Site logo

denisidoro / docpars Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 0.0 47 KB

An ultra-fast parser for declarative command-line options for your shell scripts.

License: Apache License 2.0

Makefile 1.73% Shell 29.57% Rust 68.71%
cli argument-parsing rust shell-scripting

docpars's Introduction

Linkedin Blog

๐Ÿš˜ โ€Ž I work at Uber, where we take on big problems to help drivers, riders, delivery partners, and eaters get moving in more than 600 cities around the world.

๐Ÿ’ถ โ€Ž I also helped build Nubank, a fintech which now has millions of customers and is revolutionizing banking and financial products.

โœจ โ€Ž My most popular repository on GitHub is navi, with 12k+ stars.

Github Stats

docpars's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docpars's Issues

Issue: Optional arguments and final array

Describe the bug
Found a bug with optional arguments and final array.

To Reproduce
Define a docopt like this one in a shell script:

#!/usr/bin/env bash
##? Install a package
##?
##? Usage:
##?    $0 [--pkgmgr <package_manager>] <packages_names>...
eval "$(docpars -h "$(grep "^##?" "$0" | cut -c 5-)" : "$@")"
echo "pkgmgr: $pkgmgr"
echo "package_manager: $package_manager"
echo "packages: ${package_names[*]}"
echo

Call the script with arguments:

--pkgmgr cargo docpars deno bashdoc

Show output:

pkgmgr: true
package_manager: cargo
packages: docpars deno bashdoc

Fail 1

All went well, but if you call with arguments:

docpars deno bashdoc

Will show you:

pkgmgr: false
package_manager: docpars
packages: deno bashdoc

The docpars value is in package_manager and not in the final array.

Fail 2

And finally if you call the script with arguments:

--pkgmgr cargo

It will output:

pkgmgr: true
package_manager:
packages: cargo

cargo is in packages_names instead of package_manager.

Expected behavior

Case fail 1

pkgmgr: false
package_manager:
packages: docpars deno bashdoc

Case fail 2

pkgmgr: true
package_manager: cargo
packages: 

Screenshots
Screenshot 2021-07-14 at 16 58 16

Versions:

  • OS: macos 11.4 Big Sur
  • Shell Version [replace this text with the output of sh --version]
> $SHELL --version
zsh 5.8 (x86_64-apple-darwin20.0)
  • docpars: v0.2.0

Additional context
The script is dot package add of my Dotly fork, see it here:

Cargo Version

Describe the bug
Cargo package version is 0.2.0 in spite of being 0.3.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.