gitget

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT

README

gitget

A minimal CLI tool and library for downloading and unpacking git archives. Basically, the Go version of degit.

Status

Features:

  • Automatically download the latest default branch (as opposed to assuming main or master)
  • Specify branches, tags, or commit hashes
  • Specify subdirectories
  • Support private repositories

Providers:

  • GitHub
  • GitLab
  • Bitbucket

Installing

go install github.com/AaronCQL/gitget/cmd/gitget

Usage

Downloads the latest default branch to the current working directory:

gitget https://github.com/owner/repo

The following are all equivalent:

gitget github:owner/repo
gitget [email protected]:owner/repo
gitget github.com/owner/repo

Specific branches, tags, and commit hashes can also be specified. Use the --help flag for more info:

gitget --help

Go API

gitget can be used programmatically in your Go code. Start by installing this package:

go get -u github.com/AaronCQL/gitget

Then, use the gitget.Clone function:

package main

import (
  "fmt"

  "github.com/AaronCQL/gitget/pkg/gitget"
)

func main() {
  res, err := gitget.Clone("github.com/owner/repo", gitget.Config{})
  if err != nil {
    panic(err)
  }
  fmt.Printf(
    "Cloned %v/%v (%v) into %v\n",
    res.RepoOwner, res.RepoName, res.RepoFragment, res.TargetDirRel,
  )
}

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

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