in reply to Is there a way to order --help argument list output by getopt?

I'm just noticing that the sort order of my arguments is the same order as they were defined, it's just the help switch that is getting mixed in with them that appears in random order.

I also just found the MooseX::Getopt::Usage module. Neat, but doesn't seem to have a way to fix this issue.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

  • Comment on Re: Is there a way to order --help argument list output by getopt?

Replies are listed 'Best First'.
Re^2: Is there a way to order --help argument list output by getopt?
by LanX (Saint) on Feb 04, 2018 at 09:19 UTC
    I've never used this module, but ...

    > the help switch that is getting mixed in with them that appears in random order.

    Your examples show -h not at a random position but either on the first or last position, this seems sensible for a generated switch.

    What happens if you include -h in your fixed list?

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Wikisyntax for the Monastery

      The -h also sometimes appears mixed with the other options:

      creates commands for a dzil profile minted with "cli" -d STR --dir STR directory where distribution is located -c STR --cmd STR command name -h -? --usage --help Prints this usage information. -s STR... --subcmd STR... subcommands to create

      If I switch one of the options to -h as well, I get this:

      creates commands for a dzil profile minted with "cli" -h STR --dir STR directory where distribution is located -c STR --cmd STR command name -h -? --usage --help Prints this usage information. -s STR... --subcmd STR... subcommands to create

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
      $nysus = $PM . ' ' . $MCF;
      Click here if you love Perl Monks