logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Git::Annex::BatchCommand - Perl interface to git-annex --batch commands

Author

       Sean Whitton <spwhitton@spwhitton.name>

Description

       This class can be used to run git-annex commands which take the "--batch" option.  You can feed the
       command lines of input and you will get back git-annex's responses.

       The main point of using "--batch" commands from Perl is to keep git-annex running rather than repeatedly
       executing new git-annex processes to perform queries or request changes.

Methods

new($annex,$cmd,@args)
       Initialise a batch process in Git::Annex $annex, running git-annex subcommand $cmd (e.g. "setpresentkey")
       with arguments @args.

       You should use Git::Annex::batch in preference to this method.

   say($input,...)
       Say a line or lines of input to the batch command's standard input.  Trailing line breaks in $input are
       optional.

       In list context, returns a list of git-annex's responses to the items of input, chomped.  In scalar
       context, returns the last of git-annex's responses, chomped.

   ask($input,...)
       Synonym for "say" method.

   restart
       Kill and restart the "--batch" command.

       This is sometimes needed to ensure the "--batch" command picks up changes made to the git-annex branch.

Name

       Git::Annex::BatchCommand - Perl interface to git-annex --batch commands

Synopsis

         # you should not instantiate this class yourself; use Git::Annex::batch
         my $annex = Git::Annex->new("/home/spwhitton/annex");
         my $batch = $annex->batch("find", "--not", "--in=here");

         # see git-annex-find(1) -- `git annex find --batch --not --in here`
         # prints an empty string for each file which is not present
         say "foo/bar is not present in this repo" unless $batch->ask("foo/bar");

Version

       version 0.008

See Also