Skip to content

Commit 326c24d

Browse files
authored
Merge pull request #1 from Kaiden-AC/dev
v0.2
2 parents 44bb771 + 304f708 commit 326c24d

2 files changed

Lines changed: 196 additions & 124 deletions

File tree

README.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# clonetool
22

3-
`clonetool` is a command-line utility written in Rust designed to clone all repositories for specified GitHub users or organizations. It's a handy tool for quickly backing up or mirroring all of someone's repositories.
3+
`clonetool` is a command-line utility written in Rust designed to clone all repositories for specified GitHub or GitLab users or organizations. It's a handy tool for quickly backing up or mirroring all of someone's repositories.
44

55
## Features
66

7-
* Clones all repositories for specified GitHub users or organizations.
7+
* Clones all repositories for specified GitHub or GitLab users or organizations.
88
* Clones repositories into separate folders named after the user/organization in a specified destination directory.
99
* Uses `git clone --mirror` to create bare mirror repositories.
1010
* Provides a `--debug` flag for command output and more verbose messages.
1111
* Prompts the user before removing existing local directories with the same name as the repos to clone.
1212
* Allows automated "yes" responses for directory removal with the `--yes` or `-y` flag.
1313
* Allows automated "no" responses for directory removal with the `--no` or `-n` flag.
14+
* Allows excluding specific packages using the `--exclude` or `-x` flag.
15+
* Allows selecting between GitHub or GitLab using the `--provider` flag.
1416

1517
## How to Use
1618

@@ -39,22 +41,24 @@ The basic usage of `clonetool` is:
3941
clonetool -u <usernames> -d <destination_directory> [options]
4042
```
4143

42-
* `-u, --users <usernames>`: A comma-separated list of GitHub usernames or organization names.
44+
* `-u, --users <usernames>`: A comma-separated list of GitHub or GitLab usernames or organization names.
4345
* `-d, --destination <destination_directory>`: The local directory to clone repositories into.
4446
* `--debug`: Enables debug output, showing executed git commands.
4547
* `-y, --yes`: Automatically removes existing local directories without prompting.
4648
* `-n, --no`: Automatically skips cloning if a local directory exists.
49+
* `-x, --exclude <packages>`: Comma-separated list of packages to exclude, in the form of `user/package`.
50+
* `--provider <provider>`: The provider to use: `github` or `gitlab`. Default is `github`.
4751

4852
### Examples
4953

50-
1. **Clone all repositories for a user to the `/home/user/repos` directory:**
54+
1. **Clone all repositories for a user from GitHub to the `/home/user/repos` directory:**
5155

5256
```bash
5357
clonetool -u testuser -d /home/user/repos
5458
```
5559
This will create a directory called `testuser` inside the `repos` directory and all the repos inside that directory will be cloned into separate folders.
5660

57-
2. **Clone all repositories for multiple users to the `/mnt/data/github` directory:**
61+
2. **Clone all repositories for multiple users from GitHub to the `/mnt/data/github` directory:**
5862

5963
```bash
6064
clonetool -u testuser1,testuser2,testorg -d /mnt/data/github
@@ -79,18 +83,41 @@ clonetool -u <usernames> -d <destination_directory> [options]
7983
clonetool -u testuser -d /home/user/repos --no
8084
```
8185

86+
6. **Clone repositories, skipping some packages using the `--exclude` flag:**
87+
88+
```bash
89+
clonetool -u testuser -d /home/user/repos -x testuser/repo1,testuser/repo2
90+
```
91+
This will clone all repos from `testuser`, except for the repos called `repo1` and `repo2`.
92+
93+
7. **Clone all repositories for a user from GitLab to the `/home/user/repos` directory:**
94+
95+
```bash
96+
clonetool -u testuser -d /home/user/repos --provider gitlab
97+
```
98+
This will clone all repositories in GitLab under the user named `testuser`.
99+
100+
8. **Clone all repositories for multiple users from GitLab to the `/mnt/data/github` directory:**
101+
102+
```bash
103+
clonetool -u testuser1,testuser2,testorg -d /mnt/data/github --provider gitlab
104+
```
105+
This will create a directory called `testuser1`, `testuser2` and `testorg` inside the `github` directory and all the repos inside each user/org directory will be cloned into separate folders.
106+
82107
### Note
83108

84109
* The tool uses `git clone --mirror` so, while all branches are cloned, it does not clone a standard working directory.
85110
* There is unfortunately no way to pull changes in a bare repo for all branches at once. As a workaround, you can clone the repos again. The program will prompt you to remove existing local folders so you can clone the latest version.
86-
* If a user or organization deletes a repository, `clonetool` will not ask to remove that repository because it no longer gets the path from the GitHub API.
111+
* If a user or organization deletes a repository, `clonetool` will not ask to remove that repository because it no longer gets the path from the GitHub or GitLab API.
87112
* The program will create the specified destination directory if it does not exist.
88113
* The program will create separate directories inside the destination, with each directory named after the user/org provided.
89114
* Usernames/organization names must only contain alphanumeric characters, underscores, or hyphens.
115+
* Destination directories do not have to be absolute paths.
90116

91117
## License
92118

93119
This project is open source and available under the [MIT License](LICENSE). The full text of the license can be found in the `LICENSE` file.
94120

95121
## Acknowledgment
96-
This tool was created with the assistance of Google Gemini 2.0 Flash.
122+
123+
This tool was created with the assistance of Google Gemini 2.0 Flash.

0 commit comments

Comments
 (0)