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:
- What is on the
default_host
of the config. - Default to "github.com".
- What is on the
- This format will have the {host} be resolved on the following order:
{repo}
- This format will have the
host
be resolved on the following order:- What is on the
default_host
of the config. - Default to "github.com".
- What is on the
- And the
username
resolved in the following order:- What is on the
default_username
of the config. - Default to
whoami::username()
.
- What is on the
- This format will have the
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
.
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.
cargo install --path .