Skip to content

script for monitoring the clipboard for git repo urls and cloning them

License

Notifications You must be signed in to change notification settings

christo/clonewatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Clonewatch

Ever wanted to easily clone a bunch of git repositories in one session without having to organise them into a directory structure by hand?

Clonewatch is a background script that monitors the system clipboard for urls recognisable as git repo urls and automatically cloning that repo into a preconfigured directory tree. Each repo host has a root directory under which account name dirs are created with their cloned repos inside.

Currently supports the following repo hosts:

Add your own as required and send me a pull request to add it.

  • Converts github.com web urls into git repo urls
  • Performs clones concurrently across spawned child processes.
  • Only clones if the clipboard changes
  • Performs a pull if the repo already exists
  • Tested on Linux and MacOS

Requirements

Uses the python library pyperclilp:

pip install pyperclip

Usage

  • Edit the REPO_HOME location to the root directory of these clones. Subdirectories for github.com etc. are created underneath and subdirectories for each user or org under that. This should ensure no name clash occurs.
  • Set the INTERVAL to a number of seconds for polling the clipboard. This should be higher frequency than your rate of copying urls.

The following prints the location of the log file so it can be tailed. This makes it easy to set this up as two panes in a tmux session.

clonewatch.py -l

Known Bugs

  • There is a potential race condition which never happens for me so I haven't bothered to fix it.

About

script for monitoring the clipboard for git repo urls and cloning them

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published