Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jlebon/codeswitch
Easily switch between git repositories.
https://github.com/jlebon/codeswitch
Last synced: about 1 month ago
JSON representation
Easily switch between git repositories.
- Host: GitHub
- URL: https://github.com/jlebon/codeswitch
- Owner: jlebon
- License: mit
- Created: 2018-02-24T02:45:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-22T15:54:46.000Z (8 months ago)
- Last Synced: 2024-03-22T17:18:40.678Z (8 months ago)
- Language: Rust
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
`codeswitch` is a minimal utility to make it easy to switch between git
repositories. Assuming you keep all your repos in some sort of tree structure
under a directory like `~/Code` or `/srv/hacking`, `codeswitch` can scan the
directory for repositories and lookup specific codebases.For example, to find project `foobar`:
```
$ codeswitch /code foobar
/code/github/foobar
```A complementary bash integration source file is available [here](shell/bash),
which defines a function `code`. You can then quickly change directory to
`foobar` using `code foobar`.The first run will scan the directory and build a cache in
`~/.cache/codeswitch`. Subsequent runs will use the cache. Cache misses
automatically trigger a rebuild (or you can also use `--rebuild`).If there are multiple matches, `codeswitch` will report all matches:
```
$ code foobar
error: multiple matches found
1 /code/github/qwer/foobar
2 /code/github/asdf/foobar
3 /code/github/zxcv/foobar
```You can then be more specific by providing an index (`code foobar 2`), or a
string to match (`code foobar qwer`).`codeswitch` has some fancy handling for symbolic links. For example, if
`code/gh` is a symlink to `github`, then `codeswitch` will automatically drop
`github` paths in favour their shorter `gh` equivalents.This project started as a [toy program](https://en.wikipedia.org/wiki/Toy_program)
to learn Rust, but I now use it daily as a (much faster) replacement to its
shell version. That said, there are probably still many improvements and tweaks
that could be made to make it more idiomatic Rust. If anything jumps out at you,
please feel free to open an issue or a PR to help me learn!