A small cli tool to search and clone git repositories from the terminal (currently only Gitlab-v4 endpoints).
This is a personal "for-fun" project. It was only tested on my machine and configured to my liking. It is my first "real" c++ and tui project (which is pretty obvious when looking into the code) so please consider this before doing anything.
If the tool does not work and/or you want another quick solution, have a look at the side-note for a bash script with most functionalities.
Run the qc
command. This will open up the interactive TUI (on first run, the basic config will be generated).
- Query-Prompt (starting position)
UP/DOWN
select between different git endpoints (provided by config file)TYPE
in prompt to set search query (pre-filter of endpoint)- Empty search: get repositories with newest activity
ENTER
send request to selected git endpoint- Nothing found: continue on Query-Prompt
- Something found: automatic switch to Filter-Prompt
- Filter-Prompt
UP/DOWN
select repositoryTYPE
in prompt to filter search resultENTER
clone selected repository and terminate appLEFT/RIGHT
switch between prompts
Either download the newest AppImage (see Releases) and run it or compile the repo manually and run it.
- Download the Appimage on the Releases page
- Make it executable
chmod +x <file>
- For systems that can not run it (Windows: WSL)
- WARNING for some reason only some AppImages work (for WSL), mainly the ones created manually (tagged with
*-manual
), if the newest version does not have one, check older versions/releases open an Issue or compile on your computer
- WARNING for some reason only some AppImages work (for WSL), mainly the ones created manually (tagged with
- Extract it with
./<file> --appimage-extract
- Run the executable in
./squashfs-root/usr/bin/qc
- For systems that can not run it (Windows: WSL)
- Run it
- Currently there is no pre-compiled binaries (ignoring appimage)
- To install: have the needed dependencies and compile the tool on your machine
- On first run, the application will create (if not already existing) the following:
- Folders for
~/.config/quick-clone/
- Config file
~/.config/quick-clone/config.json
- Add example data to the config file
- Only the official gitlab repo works for testing the rest are just example data that will not work
- Folders for
- Add access token in Gitlab with (at least) API-read permissions
- Can be found in your personal settings under "Access Tokens"
(Create)Update config file at~/.config/quick-clone/config.json
(names etc. might change)- An array structure is used, for the purpose of having multiple git endpoints
- Every element is an objcet inside the array
[{...}, {...}, ...]
with the followingname
- Will be shown in the app to identify the selected endpointaccess_token
- Is needed to have access to the endpoint, needs at least read accessurl
- URI to the Gitlab endpoint
Example
[
{
"name": "Work Gitlab",
"access_token": "work-token",
"url": "https://git.workplace.com/api/v4/projects"
},
{
"name": "Personal Gitlab",
"access_token": "personal-token",
"url": "https://gitlab.com/api/v4/projects"
}
]
The first version of this tool was a simple bash script, which uses different tools like fzf
, jq
, awk
, curl
and maybe others.
This should work on most machine that supports bash and the other tools and can be found in my dotfiles.
- ncurses e.g.
apt install libncurses5-dev libncursesw5-dev
- libcurl e.g.
apt install libcurl4-openssl-dev
- nlohmann/json3 e.g.
apt install nlohmann-json3-dev
# generate Makefile in build/
$ cmake -S . -B build/
# for older versions of cmake
$ cd build/ && cmake .. && cd ..
# compile executable (binary can be found in ./build/bin/qc)
$ make -C build/
# format repository
$ clang-format -i --style=Google src/**/*.cpp src/**/*.h
# generate appimage
# when doing manual, do not forget to setup the wanted version in the script (CI/CD does it automatically)
$ ./generate/generate-appimage.sh
This project uses the standard of conventional commits.
The commits are also being used to generate the different releases via github actions, meaning no versions need to be updated manually.