grh (GitHub Repo Helper) is a command-line tool designed to help you manage GitHub repositories. It allows you to fetch, list, add, and clone repositories from a specified GitHub organization or user.
Features
- Fetch and list public repositories from a specified GitHub organization or user.
- Add selected repositories as submodules to a specified directory.
- Clone selected repositories into a specified directory.
Installation
Ensure you have Python and the required libraries installed. You can install the necessary libraries using pip:
pip install requests
Usage
To use grh, run the following command:
python grh.py <src_directory> [--config <config_file>] [--org <organization>] [--user <username>]
Options
<src_directory>
: The directory where repositories will be added or cloned.--config <config_file>
: Path to the configuration file. Default isconfig.ini
.--org <organization>
: GitHub organization name to fetch repositories from.--user <username>
: GitHub username to fetch repositories from.
Commands
- list: List all repositories from the specified GitHub organization or user.
- add: Search for a repository and add it as a submodule to the specified directory.
- clone: Search for a repository and clone it into the specified directory.
- exit: Exit the tool.
Configuration File
The configuration file (e.g., config.ini
) should have the following format:
[Settings]
github_org = your_organization
github_user = your_username
Examples
List Repositories from an Organization
python grh.py src_directory --org cpp-toolbox
List Repositories from a User
python grh.py src_directory --user cuppajoeman
List Repositories Using a Configuration File
python grh.py src_directory --config config.ini
Add a Repository as a Submodule
python grh.py src_directory --org cpp-toolbox
# Enter 'add' to search and add a repository as a submodule.
Clone a Repository
python grh.py src_directory --user cuppajoeman
# Enter 'clone' to search and clone a repository.