for my $repo ( @{ $repolist } ) {
    # =================
    # End of conditions for skipping clone


    if( -e $local_repo_dir ) {
        my $cwd = Cwd::getcwd();
        chdir $local_repo_dir;
        my $guard = guard { chdir $cwd };    # switch back
        print "Updating $local_repo_dir from remotes ..." . $print_progress->() . "\n";

        if( qx{ git config --get core.bare } =~ /\Atrue\n?\Z/ ) {
            # Here I assume remote.<remote>.mirror is automatically set.
            # bacause --bare and --mirror do the set-up.
            qx{ git fetch --all };
        }
        else {
            my $flags = qq();
            $flags .= qq{ -q } unless $self->{verbose};

            # prune deleted remote branches
            qx{git remote update --prune};

            # fetch all remotes
            qx{ git fetch --all };

            # update current working repo
            qx{ git pull $flags --rebase --all };
        }
    }
    else {
        # Support old git (which does not support `git clone --mirror`)
        if ($self->{mirror}) {
            my $cwd = Cwd::getcwd();
            chdir $local_repo_dir;
            my $guard = guard { chdir $cwd };    # switch back
            qx{ git config remote.origin.fetch '+refs/*:refs/*' };
            qx{ git config remote.origin.url $uri };
            qx{ git config remote.origin.mirror true };
        }
    }
}
print "Done\n";

NAME

App::gh::Command::All - clone/update all repositories from one

DESCRIPTION

If you need a mirror of repos from one, you will need this command.

If repos exists, clone command will pull changes for these repos from remotes.

USAGE

$ mkdir github
$ cd github

To clone c9s' repos:

$ gh all c9s

Once you have all repos cloned, to update them, you only need to run all command again:

$ gh all c9s

OPTIONS

Genernal Options:

--prompt
    prompt for each cloning repo.

--into {path}
    clone repos into a {path}.

--skip-exists, -s
    skip existed repos.

--verbose
    verbose output.

--bare
    clone repos as bare repos.
    this option adds postfix ".git" to directory.
    e.g.: "{dirname}.git"

--mirror
    clone repos as mirror repos.
    this option adds postfix ".git" to directory.
    e.g.: "{dirname}.git"

--prefix {prefix}
    Add prefix to repository name.

--force, -f
    remove existed repos before cloning repos.

Clone URL format:

--ssh

--http

--https

--git