CLI tool to clone repos easily
Project description
clone-repo: Easily clone repos
What is this?
For years I've been using a noddy script which clones many types of repos into a fixed location which is generated based on the repo itself. Similar to how go packages are cloned into go/src I typically clone my stuff into ~/src.
e.g. clone-repo git@github.com:micktwomey/clone-repo.git
will clone using git to ~/src/github.com/micktwomey/clone-repo
.
This allows me to clone many different repos without worrying about stepping on each other. It also makes it easy to see where stuff comes from (e.g. rm -rf ~/src/old.git.example.com
will wipe out clones from git server I don't use any more).
Install via pip install clone-repo
.
Install with pipx using pipx install clone-repo
to make it available as a CLI tool everywhere.
Supports:
/path/to/repo
git clone
to~/src/localhost/file/{repo}
file:///path/to/repo
git clone
to~/src/localhost/file/{repo}
git@example.com:org/repo.git
git clone
to~/src/{host}/{org}/{repo}
https://github.com/org/repo.git
git clone
to~/src/github.com/{org}/{repo}
https://github.com/org/repo
git clone
to~/src/github.com/{org}/{repo}
https://gitlab.example.com/org/repo.git
git clone
to~/src/{host}/{org}/{repo}
https://hg.mozilla.org/mozilla-central/
hg clone
to~/src/hg.mozilla.org/{org}/{repo}
https://hg.sr.ht/~org/repo
hg clone
to~/src/hg.sr.ht/{org}/{repo}
keybase://team/org/repo
git clone
to~/src/keybase/{org}/{repo}
man@man.sr.ht:~org/repo
git clone
to~/src/man.sr.ht/{org}/{repo}
ssh://git@example.com:7999/somegroup/myrepo.git
git clone
to~/src/{host}/{org}/{repo}
ssh://hg@bitbucket.org/org/repo
hg clone
to~/src/{host}/{org}/{repo}
For https://
URLs the default is git but some will behave differently based on the domain.
Development
If you want to quickly develop you can use poetry and pytest:
poetry install
pytest -vv
If you want to test across all supported Python versions you can install them via asdf and then use nox:
asdf install
poetry install
nox
If you want to run pre-commit hooks before committing:
poetry install
pre-commit install
Finally, there is a just justfile to run some commands.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for clone_repo-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efdadd7477b561f2b2fa5c7edd8f7e2c4f2ffd5324c1e6744b2b78ee3ae36dd4 |
|
MD5 | 28bca179fae8e3fe0c2fe6e6900f4ebf |
|
BLAKE2b-256 | 62d3917011fec331cbdb5caf2b8ff0e466d2ceba0c232d9e4aac11d9f5e5d352 |