Published: Wednesday, 30 March 2022 by Michael Twomey
Released clone-repo 0.1.0 (then 0.1.1 a few minutes later)
I’ve just taken an old script I use all the time (clone.py) and released it as a proper CLI tool. Behold: clone-repo (or on PyPI).
$ clone-repo firstname.lastname@example.org:micktwomey/clone-repo.git Cloning into '/Users/mick/src/github.com/micktwomey/clone-repo'... remote: Enumerating objects: 62, done. remote: Counting objects: 100% (62/62), done. remote: Compressing objects: 100% (44/44), done. remote: Total 62 (delta 25), reused 48 (delta 11), pack-reused 0 Receiving objects: 100% (62/62), 26.05 KiB | 13.02 MiB/s, done. Resolving deltas: 100% (25/25), done.
I use it all the time clone random repos. I found very quickly that checking everything out directly into
~/projects lead to very big directories, and even better, some duplicates.
Cloning into a fixed structure helps keep things organized. It also makes it easy to clone forks too!
As a bonus it maps well to Visual Studio Code’s new security model, where they ask if you want to trust a repo and optionally the parent folder too. In this case clone-repo has helpfully used the organization as the parent folder, so you can trust (or not trust) whole organizations.
To install use something like
pipx install clone-repo. See my post on pipx.
Notes on the code
I’ve taken the opportunity to bloat out a simple tool with a bunch of random libraries and tools I’m trying out:
- structlog for my logging. I’ve always wanted to try this out as an alternative to logging. So far I’d say it’s pretty good, but I’m having to overcome over a decade of using Python’s logging patterns!
- just as a make alternative. So far I like it for project management tasks. You can see the justfile here.
- changelog-manager to manage the changelog. As a side effect it also manages the version using semver rules. If I fix stuff it’s a patch bump, if I add stuff it’s a minor version bump and if I change stuff it’s a major bump. This was a nice surprise, as I can now more meaningfully drive my versions from the changes I make (this is something I love in Elm). You can see the changelog here.