structopt VS docopt.rs

Compare structopt vs docopt.rs and see what are their differences.

structopt

Parse command line arguments by defining a struct. (by TeXitoi)

docopt.rs

Docopt for Rust (command line argument parser). (by docopt)
CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
InfluxDB high-performance time series database
Collect, organize, and act on massive volumes of high-resolution data to power real-time intelligent systems.
influxdata.com
featured
structopt docopt.rs
18 5
2,727 752
0.4% -
2.7 0.0
over 1 year ago about 4 years ago
Rust Rust
GNU General Public License v3.0 or later The Unlicense
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

structopt

Posts with mentions or reviews of structopt. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-07-03.

docopt.rs

Posts with mentions or reviews of docopt.rs. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-08-07.
  • Argdown, like Markdown for argument mapping
    7 projects | news.ycombinator.com | 7 Aug 2024
    Yes, according to the archived Rust implmentation[1] which in turn refers you to either clap[2] or structopt[3]. Other implmentations does not mention this but those I looked at had not been touched for years. Either very stable or unmaintained. Unfortunately the latter according to the Rust crate. The dotNet implmentation had a very small version bump in the dependencies but the rest of the project does not seem to have benn touched the past 2 years.

    [1] https://github.com/docopt/docopt.rs

    [2] https://docs.rs/clap/latest/clap/

    [3] https://docs.rs/structopt/latest/structopt/

  • Docopt.sh – Command-Line Argument Parser for Bash 3.2, 4, and 5
    5 projects | news.ycombinator.com | 16 Mar 2023
    Consider using clap or possibly structopt instead.

    It's a lovely way to internalize the CLI argument cultural norms, decrease confusing and verbose argument parsing, make argument parsing work-free for the developer, and make argument parsing a copy-paste across languages. There's no greater pleasure than iteratively adding options to your program by just adding a line of text

    -n, --new-option Do something new

    I honestly think making a docopt parser is just very hard, which may limit its future prospects.

    [the docopt rust repo.]: https://github.com/docopt/docopt.rs

  • Fedora to disallow CC0-licensed code
    2 projects | news.ycombinator.com | 25 Jul 2022
    Ditto, I guess? :P (But obviously with the position on the Unlicense flipped.)

    To address your indictment head-on: you suggesting the 0BSD as a better alternative is really missing my point. The 0BSD is not an alternative for my use case. The Unlicense is one of the very few overt "political" acts that I inject into the software I produce. Its purpose is to make a statement. The 0BSD doesn't do that IMO, so it's not actually an alternative that meets my advocacy goal.

    You and Rick Moen seem to have the same apparent blind spot for this. See my conversation with him that started here (which might also clarify some aspects of my own position): https://github.com/docopt/docopt.rs/issues/1#issuecomment-42...

    And finally, note that my dual licensing scheme is exactly a response to the "problems pointed out by quite a few people": https://github.com/BurntSushi/byteorder/issues/26

  • Docopt
    7 projects | news.ycombinator.com | 31 Dec 2021
    I like Docopt for quick scripts, used it both in Python and Rust projects. It is quite unflexible though.

    The Rust Docopt implementation¹ was deprecated this year, which is probably good because clap v3 (https://github.com/clap-rs/clap) is so awesome. In a project of mine (tealdeer), I noticed that docopt.rs was responsible for the huge majority of CPU instructions when running the binary: https://github.com/dbrgn/tealdeer/issues/106#issuecomment-59... I then switched² to clap and shaved off almost a megabyte from the release binary³. Performance improved as well, time required for rendering a tldr page went down from ~15.9 ms to ~12.4 ms⁴. With the migration, we also managed to reduce a lot of custom validation logic and move this logic into the derive macro attributes.

    ¹ https://github.com/docopt/docopt.rs

  • clap 3.0.0-rc.7
    10 projects | /r/rust | 16 Dec 2021

What are some alternatives?

When comparing structopt and docopt.rs you can also consider the following projects:

clap-rs - A full featured, fast Command Line Argument Parser for Rust

easy_flag - Simple command line flag parser for rust.

rust-starter - Rust Starter Project

argc - A Bash CLI framework, also a Bash command runner.

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
InfluxDB high-performance time series database
Collect, organize, and act on massive volumes of high-resolution data to power real-time intelligent systems.
influxdata.com
featured

Did you know that Rust is
the 5th most popular programming language
based on number of references?