Docopt

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • docopt

    This project is no longer maintained. Please see https://github.com/jazzband/docopt-ng

  • typer

    Typer, build great CLIs. Easy to code. Based on Python type hints.

  • These days i use typer (https://typer.tiangolo.com/), but docopt remains a fan favorite of mine for being just so darn cute.

    it's a shame that the last i checked, there wasn't really a formal grammar for it and so doing a lot of the modern conveniences i like is either hard or impossible, but the idea's still charming.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • clap-rs

    A full featured, fast Command Line Argument Parser for Rust

  • 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

  • tealdeer

    A very fast implementation of tldr in Rust.

  • 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

  • docopt.rs

    Discontinued Docopt for Rust (command line argument parser).

  • 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

  • cligen

    Nim library to infer/generate command-line-interfaces / option / argument parsing; Docs at

  • If the PL you are using already has named parameters with defaults then you can roll a CLI on top of it with a better spcified "spec" language (the PL itself) and with less work. There are a few Python packages for this and https://github.com/c-blake/cligen

    This is theoretically even possible for C++ with some kind of compile-time reflection API, but the way the C preprocessor works probably makes it hard to preserve structured comments for automatic documentation extraction. It was quite easy to do in Nim.

  • docopt-ng

    Humane command line arguments parser. Now with maintenance, typehints, and complete test coverage.

  • Just FYI, the docopt package isn't updated anymore and the maintainer doesn't answer any inquiries. There are some annoying bugs one runs into when using the official docopt package. So I recommend using docopt-ng instead: https://github.com/jazzband/docopt-ng

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts