Last active
September 1, 2021 18:25
-
-
Save ghedo/3657403 to your computer and use it in GitHub Desktop.
Clone all the gists of a GitHub user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Usage: gist_backup.pl <user> | |
# Clone all the gists of a GitHub user | |
use strict; | |
use warnings; | |
use Git::Raw; | |
use Pithub::Gists; | |
my $gist = Pithub::Gists -> new; | |
my $user = shift or die 'Provide a user name'; | |
my $gists = $gist -> list(user => $user); | |
while (my $row = $gists -> next) { | |
print "Cloning gist '" . $row -> {'id'} . "'..."; | |
Git::Raw::Repository -> clone($row -> {'git_pull_url'}, $row -> {'id'}, {}); | |
print " done.\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment