NAME

App::Codeowners::Options - Getopt and shell completion for App::Codeowners

VERSION

version 0.51

METHODS

new

$options = App::Codeowners::Options->new(@ARGV);

Construct a new object.

command

$str = $options->command;

Get the command specified by args provided when the object was created.

args

$args = $options->args;

Get the args provided when the object was created.

get_options

$options = $options->get_options(
    args     => \@ARGV,
    spec     => \@expected_options,
    callback => sub { my ($arg, $results) = @_; ... },
);

Convert command-line arguments to options, based on specified rules.

Returns a hashref of options or undef if an error occurred.

  • args - Arguments from the caller (e.g. @ARGV).

  • spec - List of Getopt::Long compatible option strings.

  • callback - Optional coderef to call for non-option arguments.

  • config - Optional Getopt::Long configuration string.

shell_completion

$options->shell_completion($shell_type);

Print shell code to STDOUT for the given type of shell. When eval'd, the shell code enables completion for the git-codeowners command.

completions

$options->completions($current_arg_index, @args);

Print completions to STDOUT for the given argument list and cursor position, and exit.

May also exit with status 9 and a compgen action printed to STDOUT to indicate that the shell should generate its own completions.

Doesn't return.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/chazmcgarvey/git-codeowners/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Charles McGarvey <chazmcgarvey@brokenzipper.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by Charles McGarvey.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.