App-Genpass-ID
view release on metacpan or search on metacpan
script/_genpass-id view on Meta::CPAN
defined($toc_line)
or die "Unexpected end of data section while reading TOC line #$i";
chomp($toc_line);
$toc_line =~ /\S/ or last;
$toc_line =~ /^([^,]+),(\d+),(\d+)(?:,(.*))?$/
or die "Invalid TOC line #$i in data section: $toc_line";
$toc{$1} = [$2, $3, $4];
}
my $pos = tell $fh;
$toc{$_}[0] += $pos for keys %toc;
# calculate the line number of data section
my $data_pos = tell(DATA);
seek DATA, 0, 0;
my $pos = 0;
while (1) {
my $line = <DATA>;
$pos += length($line);
$data_linepos++;
last if $pos >= $data_pos;
}
seek DATA, $data_pos, 0;
\%toc;
};
if ($toc->{$_[1]}) {
seek DATA, $toc->{$_[1]}[0], 0;
read DATA, my($content), $toc->{$_[1]}[1];
my ($order, $lineoffset) = split(';', $toc->{$_[1]}[2]);
$content =~ s/^#//gm;
$content = "# line ".($data_linepos + $order+1 + $lineoffset)." \"".__FILE__."\"\n" . $content;
open my $fh, '<', \$content
or die "DataPacker error loading $_[1]: $!";
return $fh;
}
return;
};
}
# END DATAPACK CODE
# Note: This completer script is generated by App::GenPericmdCompleterScript version 0.11
# on Tue Jan 2 11:42:34 2018. You probably should not manually edit this file.
# NO_PERINCI_CMDLINE_SCRIPT
# PERINCI_CMDLINE_COMPLETER_SCRIPT: {program_name=>"genpass-id",read_config=>0,read_env=>0,skip_format=>undef,subcommands=>undef,url=>"/App/Genpass/ID/genpass"}
# FRAGMENT id=shcompgen-hint completer=1 for=genpass-id
our $DATE = '2018-01-02'; # DATE
our $VERSION = '0.003'; # VERSION
# PODNAME: _genpass-id
# ABSTRACT: Completer script for genpass-id
use 5.010;
use strict;
use warnings;
die "Please run this script under shell completion\n" unless $ENV{COMP_LINE} || $ENV{COMMAND_LINE};
my $args = {program_name=>"genpass-id",read_config=>0,read_env=>0,skip_format=>undef,subcommands=>undef,url=>"/App/Genpass/ID/genpass"};
my $meta = {_orig_args_as=>undef,_orig_result_naked=>undef,args=>{num=>{cmdline_aliases=>{n=>{}},default=>1,schema=>["int",{min=>1,req=>1},{}]},patterns=>{cmdline_aliases=>{p=>{}},default=>["%w %w %w","%w %w %w %w","%w %w %w %w %w","%w %w %w %w %w %w...
my $sc_metas = {};
my $copts = {format=>{default=>undef,getopt=>"format=s",handler=>sub{package Perinci::CmdLine::Base;use warnings;use strict;no feature;use feature ':5.10';my($go, $val, $r) = @_;$$r{'format'} = $val},is_settable_via_config=>1,schema=>["str*","in",["t...
my $r = {};
# get words
my $shell;
my ($words, $cword);
if ($ENV{COMP_LINE}) { $shell = "bash"; require Complete::Bash; require Encode; ($words,$cword) = @{ Complete::Bash::parse_cmdline() }; ($words,$cword) = @{ Complete::Bash::join_wordbreak_words($words,$cword) }; $words = [map {Encode::decode("UTF-8",...
elsif ($ENV{COMMAND_LINE}) { $shell = "tcsh"; require Complete::Tcsh; ($words,$cword) = @{ Complete::Tcsh::parse_cmdline() }; }
@ARGV = @$words;
# strip program name
shift @$words; $cword--;
# parse common_opts which potentially sets subcommand
{
require Getopt::Long;
my $old_go_conf = Getopt::Long::Configure('pass_through', 'no_ignore_case', 'bundling', 'no_auto_abbrev', 'no_getopt_compat', 'gnu_compat');
my @go_spec;
for my $k (keys %$copts) { push @go_spec, $copts->{$k}{getopt} => sub { my ($go, $val) = @_; $copts->{$k}{handler}->($go, $val, $r); } }
Getopt::Long::GetOptions(@go_spec);
Getopt::Long::Configure($old_go_conf);
}
# select subcommand
my $scn = $r->{subcommand_name};
my $scn_from = $r->{subcommand_name_from};
if (!defined($scn) && defined($args->{default_subcommand})) {
# get from default_subcommand
if ($args->{get_subcommand_from_arg} == 1) {
$scn = $args->{default_subcommand};
$scn_from = "default_subcommand";
} elsif ($args->{get_subcommand_from_arg} == 2 && !@ARGV) {
$scn = $args->{default_subcommand};
$scn_from = "default_subcommand";
}
}
if (!defined($scn) && $args->{subcommands} && @ARGV) {
# get from first command-line arg
$scn = shift @ARGV;
$scn_from = "arg";
}
if (defined($scn) && !$sc_metas->{$scn}) { undef $scn } # unknown subcommand name
# XXX read_env
# complete with periscomp
my $compres;
{
require Perinci::Sub::Complete;
$compres = Perinci::Sub::Complete::complete_cli_arg(
meta => defined($scn) ? $sc_metas->{$scn} : $meta,
words => $words,
cword => $cword,
common_opts => $copts,
riap_server_url => undef,
riap_uri => undef,
( run in 3.540 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )