cloneorg

package module
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 8 Imported by: 1

README

clone-org

Release Software License Build status Go Report Card Godoc

A simple command line tool to clone all repos of a given organization.

I needed to do that so I can grep all repos for some stuff. GitHub search wasn't powerful enough to do what I needed, so, here it is.

Usage

NAME:
   clone-org - Clone all repos of a github organization

USAGE:
   clone-org [global options] command [command options] [arguments...]

VERSION:
   master

COMMANDS:
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --org value, -o value
   --token value, -t value         [$GITHUB_TOKEN]
   --destination value, -d value
   --help, -h                     show help
   --version, -v                  print the version

Notes

  • if no destination is provided, the clone will be made in /tmp/organization-name
  • a git clone --depth 1 will be performed, meaning that only the last commit of the default branch will be available. On future versions this may be configurable.

Install

go:

go install -v github.com/caarlos0/clone-org/cmd/clone-org@latest

homebrew:

brew install caarlos0/tap/clone-org

snap:

snap install clone-org

apt:

echo 'deb [trusted=yes] https://repo.caarlos0.dev/apt/ /' | sudo tee /etc/apt/sources.list.d/caarlos0.list
sudo apt update
sudo apt install clone-org

yum:

echo '[caarlos0]
name=caarlos0
baseurl=https://repo.caarlos0.dev/yum/
enabled=1
gpgcheck=0' | sudo tee /etc/yum.repos.d/caarlos0.repo
sudo yum install clone-org

deb/rpm/apk:

Download the .apk, .deb or .rpm from the releases page and install with the appropriate commands.

manually:

Download the pre-compiled binaries from the releases page or clone the repo build from source.

Stargazers over time

Stargazers over time

Documentation

Overview

Package cloneorg contains useful functions to find and clone a github organization repositories.

Index

Constants

This section is empty.

Variables

View Source
var ErrClone = errors.New("git clone failed")

ErrClone happens when a git clone fails.

View Source
var ErrCreateDir = errors.New("failed to create directory")

ErrCreateDir happens when we fail to create the target directory.

Functions

func Clone

func Clone(repo Repo, destination string) error

Clone a given repository into a given destination.

func CreateDir added in v1.1.0

func CreateDir(directory string) error

CreateDir creates the directory if it does not exists.

Types

type Repo

type Repo struct {
	Name string
	URL  string
}

Repo represents the repository data we need.

func AllOrgRepos

func AllOrgRepos(token, org string) (repos []Repo, err error)

AllOrgRepos finds all repositories of a given organization.

Directories

Path Synopsis
cmd
internal
ui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL