gigit

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 13 Imported by: 0

README

Gigit

gigit user/repo

Gigit, a tool for downloading repositories at a reasonable speed. It is written in Go, making it very efficient in starting any project.

Installation

go install github.com/nazhard/gigit/cmd/gigit@latest

Example

By default, gigit will download repos from GitHub, our favorite git as a service.

gigit user/repo
Spesific branch, commit hash, tag

You can use specific branches, commits, or tags with a #

gigit user/repo#dev

gigit user/repo#691c0bf

# on spesific tag, "v" is required
gigit user/repo#v1.0.0
Subdir

Get sub directory of a repository.

gigit user/repo/dir

gigit nazhard/gigit/cmd/gigit
Commands

Clone instead of download.

With cloning, you will get a .git folder (because it's just git clone 😂)

gigit clone user/repo

Clone with --depth=1 if you just want to fix typo

gigit c1 user/repo
# or
gigit 1 user/repo

More documentation at pkg.go.dev/github.com/nazhard/gigit

Why not use degit instead?

I don't know. I was originally using degit with pnpm, and I felt this way:

  • Slow
  • Buggy
  • Good

Honestly, it's a good project. But, it doesn't seem to be maintained.

From there I thought about making something similar, with some improvements (maybe).


Contributors are welcome! 🤗

Inspired by degit

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCache

func CheckCache(path, name, commit_hash string) bool

Checks the cache stored in the default cache directory for gigit.

CheckCache returns a boolean. If the cache exists, it returns true. If it doesn't exist, it returns false.

CheckCache requires path for the default cache path, name for the repository name, and commit hash.

func Clone

func Clone(host, user_repo string, depth bool)

Clone repositories using git instead.

This will automatically be used when gigit does not find the intended repository.

This is especially useful when you want to type "gigit user/repo" instead of "git clone https...". In simple terms, it is meant to clone a private repository. Set depth to true if you want using "--depth 1"

user_repo here refers to a string containing "user/repo", not "user" or "repo" only!

func CommitBranch

func CommitBranch(user_repo, branch string) (string, string, error)

func Extract

func Extract(source, target, destination string, strip int)

Extract downloaded repository.

Extract file .tar.gz as "source", then an output directory for the extracted contents of the .tar.gz file as "destination", and a specific directory/path inside the .tar.gz file to extract its contents as "target".

func Get

func Get(name, commit, destination, c_url string) (string, error)

Get is used to download the repository. Get requires the repository name and its commit and output path for downloaded repository and optionally, a custom url. Get returns url used to download repo as string and returns an error when an error occurs.

func LatestCommit

func LatestCommit(user_repo string) string

This function will fetch the latest commit hash from the repository for the extractor's use. GetLatestCommit is only used when the user does not provide a specific commit hash.

Example: "nazhard/gigit"

Types

This section is empty.

Directories

Path Synopsis
cmd
gigit
Gigit the repository downloader
Gigit the repository downloader
internal
cli

Jump to

Keyboard shortcuts

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