1 package MooseX::Getopt::Dashes;
2 # ABSTRACT: convert underscores in attribute names to dashes
8 around _get_cmd_flags_for_attr => sub {
10 my ( $class, $attr, @rest ) = @_;
12 my ( $flag, @aliases ) = $class->$next($attr, @rest);
14 unless $attr->does('MooseX::Getopt::Meta::Attribute::Trait')
15 && $attr->has_cmd_flag;
17 return ( $flag, @aliases );
28 with 'MooseX::Getopt::Dashes';
30 # Will be called as --some-thingy, not --some_thingy
31 has 'some_thingy' => (
37 # Will be called as --another_thingy, not --another-thingy
38 has 'another_thingy' => (
39 traits => [ 'Getopt' ],
40 cmd_flag => 'another_thingy'
46 # use as MooseX::Getopt
50 This is a version of C<MooseX::Getopt> which converts underscores in
51 attribute names to dashes when generating command line flags.
53 You can selectively disable this on a per-attribute basis by supplying
54 a L<cmd_flag|MooseX::Getopt::Meta::Attribute/METHODS> argument with
55 the command flag you'd like for a given attribute. No underscore to
56 dash replacement will be done on the C<cmd_flag>.