Skip to main content

clone-by-path

A small CLI tool to infer the clone URL by the current path and arguments.

Setup

There are now two versions. One is in Python, one is in D. If you're a static-typed guy, follow the instructions below. But if you have Python, just run pip install cbp and continue to the next section, Usage.

Linux, place the cbp file in /usr/bin/ and make it executable with sudo chmod +x /usr/bin/cbp.

Windows, save cbp.exe somewhere and expose its location to your system PATH environment variable.

Usage

The best way to understand how this works is to read the source code. It can be a little confusing otherwise.

cbp <repo> [args...]

CBP assumes that each repository URL is three parts. The domain, the author, and the repository name. It is also assumed that these are delimited by a forward-slash (/). All arguments after the <repo> position are passed as arguments to the subsequent git clone command.

There are several examples to help you understand how the command works. Pay attention to the current working directory, the generated clone command, and the directory to clone into.

spikespaz@jacob-linux:~$ cbp github.com/spikespaz/clone-by-path
> git clone https://github.com/spikespaz/clone-by-path.git github.com/spikespaz/clone-by-path
Cloning into 'github.com/spikespaz/clone-by-path'...
...
spikespaz@jacob-windows:~/github.com$ cbp spikespaz/clone-by-path
> git clone https://github.com/spikespaz/clone-by-path.git spikespaz/clone-by-path
Cloning into 'spikespaz/clone-by-path'...
...
spikespaz@jacob-windows:~/github.com/spikespaz$ cbp clone-by-path
> git clone https://github.com/spikespaz/clone-by-path.git clone-by-path
Cloning into 'clone-by-path'...
...
spikespaz@jacob-windows:~/github.com/spikespaz/clone-by-path$ cbp .
> git clone https://github.com/spikespaz/clone-by-path.git .
Cloning into '.'...
...

Donations

If you would like to show appreciation for my work, I would gladly accept a small donation!

I will accept donations through PayPal.Me, Buy Me a Coffee, or Patreon.

Buy Me a Coffee PayPal.Me Patreon

Metadata

Release files for cbp 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cbp 1.1.3
File Size Uploaded
cbp-1.1.3.tar.gz 2.6 kB Details

Release files / cbp-1.1.3.tar.gz

Download URL cbp-1.1.3.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
85f051fc6b7a308e08b7bfbf764cc2aaba944d2c4d11df3e91e3dcfe1af06e06
BLAKE2b-256 checksum
How to use checksums
4ab5e0c16306d2992e2d2d0f407841a240d761b2b5465add4f80100f084bfd46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

Release history Release notifications | RSS feed

This release

1.1.3 This release

1 release file

1.1.2

1 release file

1.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page