Giter Site home page Giter Site logo

repos's Introduction

repos

Make it easier to manage local repositories.

By default the base path of the project will be ~/repos. So all the repositories will be cloned and managed from that. So, for example, the repository github.com/rust-lang/rust will be located at ~/repos/github.com/rust-lang/rust.

The expand command will return the path to the repository locally. If the repository does not exist locally, it will show you that and prompt to do the expand with the --clone argument, which will clone the repository and after that, it will be able to expand it.

$ repos expand rust-lang/rust
Repo not found locally in /Users/username/repos/github.com/rust-lang/rust.
Run with --clone if want to clone it.

$ repos expand rust-lang/rust --clone
Repo not found locally.
- Local path:	/Users/username/repos/github.com/rust-lang/rust
- Git repo:	[email protected]:rust-lang/rust.git
Do you want to clone it? (y/n - only 'y' continue)
y
Cloning repo...
/Users/username/repos/github.com/rust-lang/rust%

$ repos expand rust-lang/rust
/Users/username/repos/github.com/rust-lang/rust%

The argument to the expand command (and to the add-alias) can be one of the following formats:

  • git@{host}:{username}/{repo}.git
    • This format will be used as is.
  • {host}/{username}/{repo}
    • This format will be used as is.
  • {username}/{repo}
    • This format will have the {host} be resolved on the following order:
      1. What is on the default_host of the config.
      2. Default to "github.com".
  • {repo}
    • This format will have the host be resolved on the following order:
      1. What is on the default_host of the config.
      2. Default to "github.com".
    • And the username resolved in the following order:
      1. What is on the default_username of the config.
      2. Default to whoami::username().

You can add an alias to an expand so that it is easier to access

$ repos config add-alias rust rust-lang/rust
Alias added:
  rust => /Users/username/repos/github.com/rust-lang/rust

So now when you run expand it will point to the alias

$ repos expand rust
/Users/username/repos/github.com/rust-lang/rust%

For more details about things that are configurable, check repos config --help.

To conveniently be able to cd into the expanded repository, repos have an option to setup a bash script so that you can automatically cd into the expanded repository. Like such:

$ repos setup
Setup will add the following to to your /Users/username/.zshrc file
```

. /Users/username/repos/.repos_shell

```
Do you want to continue? (y/n - only 'y' continue)
y
Ready!
Run 'source /Users/username/.zshrc' to reflect changes.

$ source /Users/username/.zshrc

$ rcd rust

The .repos_shell content can be seen on shell_setup.

The changes of this action can be reversed with repos cleanup.

Config

As of now, some of the configuration file can be managed via the repos config. But not all of it. For example, home_path can be set on the $REPOS_PATH/.config.json, but is not managed via the config on the CLI (as of now).

For better details on the avaialble config, check the config handling file.

Install from source

cargo install --path .

repos's People

Contributors

augustoccesar avatar

Stargazers

 avatar  avatar

Watchers

 avatar

repos's Issues

Validate format of `host`

This is both for when the host is part of one of the arguments, but also for when it is present on one of the configuration fields on the .config.json file.

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.