diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-02-08 00:14:10 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-02-08 00:14:10 -0700 |
commit | 2a1c7ef7c020dd3ed47ed18f28f3ce8f9dad9c79 (patch) | |
tree | 6ee6fbf4dca686721b29e92e8358eeef4290e89e /lib/App/annex_to_annex_dropunused.pm | |
parent | 335ce93a4ae9c97ebdb22a3f0349796ef3654c3f (diff) | |
download | p5-Git-Annex-2a1c7ef7c020dd3ed47ed18f28f3ce8f9dad9c79.tar.gz |
option to populate @ARGV using an anonymous array
Now Perl code can call our App:: code and simulate command line
arguments by passing an arrayref.
Note that we can't just say
local @ARGV = @_ if @_;
because then we can't distinguish between the intent to simulate
passing zero command line arguments and a request to look to @ARGV.
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'lib/App/annex_to_annex_dropunused.pm')
-rw-r--r-- | lib/App/annex_to_annex_dropunused.pm | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/App/annex_to_annex_dropunused.pm b/lib/App/annex_to_annex_dropunused.pm index 89b16b5..23c8851 100644 --- a/lib/App/annex_to_annex_dropunused.pm +++ b/lib/App/annex_to_annex_dropunused.pm @@ -47,6 +47,9 @@ documentation for that command. =cut sub main { + shift if $_[0] and ref $_[0] eq ""; # in case main called as a class method + local @ARGV = @{ $_[0] } if $_[0] and ref $_[0] ne ""; + my $annex = Git::Annex->new; my @to_drop; |