Git Product home page Git Product logo

clone-by-path's Introduction

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 '.'...
...

If you find this software useful and would like to show your appreciation, please consider making a small donation!

Donate

clone-by-path's People

Contributors

spikespaz avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.