Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
d0x7 committed Apr 9, 2023
0 parents commit 8215f97
Show file tree
Hide file tree
Showing 6 changed files with 414 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
release:
types: [created]

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows, darwin]
goarch: ["386", amd64, arm64]
exclude:
- goarch: "386"
goos: darwin
- goarch: arm64
goos: windows
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
compress_assets: OFF
82 changes: 82 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# ---> go
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
ghclone

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# ---> JetBrains
.idea/
*.iws
out/

# ---> Vim
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~

# ---> VisualStudioCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

# ---> macOS
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 XiamLi Technologies / Dorian Heinrichs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# GH Clone

[![.github/workflows/release.yaml](https://github.com/d0x7/ghclone/actions/workflows/release.yaml/badge.svg)](https://github.com/d0x7/ghclone/actions/workflows/release.yaml)
![License](https://img.shields.io/badge/license-MIT-blue)

A simple cli tool that clones whole GitHub accounts or organizations.

## Installation

You can either download the latest release from the [releases page](https://github.com/d0x7/ghclone/releases/latest), or you can install it via `go install`:
```bash
go install github.com/d0x7/ghclone@latest
```

`ghclone` will then be available in your `$GOPATH/bin` directory.

## Usage

To clone a GitHub organization, run the following command:
```bash
ghclone --all golang
```

This will clone all repositories of the `golang` organization into the `golang` directory.

If there are more than 100 repositories, you will be prompted if you wanna clone the next page too, unless the `--all`/`-a` flag is supplied, then all repositories will be downloaded without a prompt.
If `--all`/`-a` is not supplied but `--no-prompt`/`-np` is, the tool will stop after the first page, without a prompt.

If you wanna clone a personal account, run the following command:
```bash
ghclone --type user octocat
```

This would download the first page (by default 100 repositories, customizable with the `--per-page`/`-pp` flag) and if there are more repositories left, it will prompt you if you wanna clone the next page and so on.

## Flags

| Flag | Description | Default |
|---------------------|----------------------------------------------------------------|---------------|
| `--help`/`-h` | Shows the help. | |
| `--type`/`-t` | The type of the GitHub account. Can be either `user` or `org`. | `org` |
| `--page`/`-p` | The page to start cloning from. | `1` |
| `--per-page`/`-pp` | The amount of repositories per page. | `100` |
| `--verbose`/`-v` | Whether to print verbose output. | `false` |
| `--no-prompt`/`-np` | Whether to prompt the user to clone the next page. | `false` |
| `--all`/`-a` | Whether to clone all pages. | `false` |
| `--dry-run`/`-dr` | Whether to only print the repositories that would be cloned. | `false` |
| `--output`/`-o` | The output directory. | Account Name |

## License

[MIT](LICENSE) © 2023 Dorian Heinrichs
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/d0x7/ghclone

go 1.20
Loading

0 comments on commit 8215f97

Please sign in to comment.