# switchdev
Instantly switch between development projects.
## π Overview
`switchdev` is a small CLI for jumping into development projects and starting them quickly. It solves the repeated friction of remembering project paths, changing directories manually, and typing the same startup command every time.
The core idea is simple: take the usual `cd + run` workflow and automate it. Save a project once, then switch into it with a single command.
## β‘ Features
- Add projects
- List projects
- Switch instantly
- Smart command detection
- Custom commands
- Dry run
- Verbose mode
## π¦ Installation
### From crates.io (recommended)
```bash
cargo install switchdev
```
### From source
```bash
git clone git https://github.com/s0r0j/switchdev.git
cd switchdev
cargo build --release
```
## π§ͺ Usage
### Add project
```bash
switchdev add api ~/dev/api
```
### List
```bash
switchdev list
```
### Switch
```bash
switchdev api
```
## βοΈ Custom Commands
```bash
switchdev add api ~/dev/api --cmd "npm run dev"
```
You can also provide multiple `--cmd` flags when a project needs more than one startup step.
## π Dry Run
```bash
switchdev api --dry-run
```
This previews the final command without executing it.
## π§ How It Works
When no custom command is configured, `switchdev` tries to detect the right startup command automatically.
- Node.js: reads `package.json`
If `scripts.dev` exists, it runs `npm run dev`
Otherwise, it falls back to `npm start`
- Rust: if `Cargo.toml` exists, it runs `cargo run`
- Python: if `main.py` exists, it runs `python main.py`
If `app.py` exists, it runs `python app.py`
If custom commands are saved for a project, those take priority over auto-detection.
## π Config
Config is stored at:
```text
~/.switchdev/config.json
```
Example:
```json
{
"projects": [
{
"name": "api",
"path": "/home/user/dev/api",
"commands": null
}
]
}
```
## π― Philosophy
The best tool is the one you donβt have to think about.
## π£ Future Ideas
- TUI selector
- grouping
- recent projects