structopt v0.3.6 Release Notes

Release Date: 2019-12-22 // over 4 years ago
  • ๐Ÿ›  This is unusually big patch release. It contains a number of bugfixes and ๐Ÿ†• new features, some of them may theoretically be considered breaking. We did our best to avoid any problems on user's side but, if it wasn't good enough, please file an issue ASAP.

    ๐Ÿ›  Bugfixes

    • structopt used to treat ::path::to::type::Vec<T> as Vec<T> special type. This was considered erroneous. (same for Option<T> and bool). Now only exact Vec<T> match is a special type.

    • #[structopt(version = expr)] where expr is not a string literal used to get overridden by auto generated .version() call, incorrectly. Now it doesn't.

    • ๐Ÿ›  Fixed bug with top-level App::* calls on multiple structs, see #289.

    • ๐Ÿ“œ Positional bool args with no explicit #[structopt(parse(...))] annotation are now prohibited. This couldn't work well anyway, see this example for details.

    • Now we've instituted strict priority between doc comments, about, help, and the like. See the documentation.

    HUGE THANKS to @ssokolow for tidying up our documentation, teaching me English and explaining why our doc used to suck. I promise I'll make the rest of the doc up to your standards... sometime later!

    ๐Ÿ†• New features

    • Implement StructOpt for Box<impl StructOpt> so from now on you can use Box<T> with flatten and subcommand (#304).
      enum Command {
          #[structopt(name = "version")]
          PrintVersion,
    
          #[structopt(name = "second")]
          DoSomething {
              #[structopt(flatten)]
              config: Box<DoSomethingConfig>,
          },
    
          #[structopt(name = "first")]
          DoSomethingElse {
              #[structopt(flatten)]
              config: Box<DoSomethingElseConfig>,
          }
      }
    
    • Introduced #[structopt(verbatim_doc_comment)] attribute that keeps line breaks in doc comments, see the documentation.

    • Introduced #[structopt(rename_all_env)] and #[structopt(env)] magical methods so you can derive env var's name from field's name. See the documentation.

    ๐Ÿ‘Œ Improvements

    • Now we have nice README for our examples, check it out!

    • Some error messages were improved and clarified, thanks for all people involved!