Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wzslr321/cdq
Change directory, quickly [WIP]
https://github.com/wzslr321/cdq
cli rust
Last synced: 6 days ago
JSON representation
Change directory, quickly [WIP]
- Host: GitHub
- URL: https://github.com/wzslr321/cdq
- Owner: wzslr321
- Created: 2023-11-29T19:28:33.000Z (12 months ago)
- Default Branch: trunk
- Last Pushed: 2023-12-19T21:27:11.000Z (11 months ago)
- Last Synced: 2023-12-21T06:43:49.763Z (11 months ago)
- Topics: cli, rust
- Language: Rust
- Homepage:
- Size: 43.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Change directory, quickly
Are you tired of changing directories in a big files trees? If so, **cdq** comes with a rescue.
Let's say you have a following structure
```bash
➜ foo tree
.
└── foo
└── bar
└── foobar
└── edit_me.xyz
```If you want to quickly go to foobar directory to edit something there, you do not need to type the entire path with
`cd foo/bar/foobar`. With **cdq** you simply can run `cdq foobar`!> Note: It is an incredibly basic MVP - writing this README took me more time than to write the current code -, but I plan to make it better every time I have some time to spare.
### Installation
As of now it is not integrated with shell too well, so the process is unfortunately a bit cumbersome.
- Clone the repository: `git clone https://github.com/wzslr321/cdq`
- `cd cdq && cargo build -r`
- Add cdq function to your shell config file, to execute the program and interpret its outputExample for `.zshrc`
```sh
cdq() {
local output=$(~/Remi/rust/cdq/target/release/cdq $1)
echo $output
local dir=$(echo $output | awk -F'Path=' '{print $2}')
if [ -d "$dir" ]; then
echo "Proceeding to the $dir"
cd "$dir"
fi
}```
- Refresh shell - `exec zsh`
- Run `cdq --version` to make sure it works!