Git::A...ommand(3pm)

πŸ“¦
version 0.008 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Git::Annex::BatchCommand β€” a Perl interface to git-annex --batch commands, bestie. That's it, that's the whole vibe ✨

Oh and btw, this page lives in the User Contributed Perl Documentation section, and the module itself is literally called Git::Annex::BatchCommand, iykyk πŸŽ€


🌸 VERSION 🌸

version 0.008 β€” yes she's at 0.008 and she's thriving πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so here's the tea, you literally do not make this class yourself:

# 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");

see how it prints an empty string for every file that's not present? iconic behaviour honestly 🫢


🌈 DESCRIPTION 🌈

okay so this class is your girl for running git-annex commands that take the --batch option. You slide the command lines into her, she slides git-annex's responses right back at you. It's giving vending machine but make it git πŸ”₯

The whole point of using --batch commands from Perl? Keeping git-annex alive and running instead of spawning a fresh git-annex process every single time you wanna do a query or ask for a change. Not me saving all those forks 🧚


πŸ’œ METHODS πŸ’œ

new($annex, $cmd, @args) ✨

Boot up a batch process inside Git::Annex $annex, running the git-annex subcommand $cmd (like "setpresentkey") with the arguments @args. Slay.

πŸ’€ real talk though: use Git::Annex::batch instead of this method. She's the preferred one, no cap.

say($input, ...) πŸ’¬

Say one line β€” or a whole bunch of lines β€” of input to the batch command's standard input. Trailing line breaks in $input are optional, she's flexible like that πŸ’…

Context matters here bestie:

  • In list context, you get back a list of git-annex's responses to each item of input, all chomped. nom nom πŸ“
  • In scalar context, you get the last of git-annex's responses, chomped. Just the one. Main character energy πŸ‘‘

ask($input, ...) πŸŽ€

A synonym for the "say" method. Same thing, different name, she contains multitudes πŸ’–

restart πŸ”„

Kill and restart the --batch command. It's giving "turn it off and on again" but make it intentional 😭

Sometimes you need this to make sure the --batch command picks up changes that were made to the git-annex branch. Lowkey essential.


πŸ‘‘ AUTHOR πŸ‘‘

Sean Whitton <spwhitton@spwhitton.name> β€” the legend themselves 🫢


This software is Copyright (c) 2019-2021 by Sean Whitton <spwhitton@spwhitton.name>. Respect the queen πŸ™‡β€β™€οΈ

This is free software, licensed under:

The GNU General Public License, Version 3, June 2007

GPLv3, license icon behaviour, we love to see it 🌈


and that's the whole page bestie!! this cutie was rendered by perl v5.40.1 and dated 2025-03-04, mwah πŸ’‹

πŸ“¦ where this page comes from