velto-cli 0.2.0

A fast and minimal CLI tool for building and running Velto web apps
Documentation
# Velto CLI ๐Ÿš€

**Velto CLI** is the official command-line tool for [Velto](https://github.com/pjdur/velto), a fast and minimal Rust web framework. It helps you scaffold, run, and manage Velto apps with ease.

---

## โœจ Features

- `velto new <name>` โ€” Create a new Velto project instantly  
- `velto run` โ€” Build and launch your app with clean output  
- `velto build` โ€” Compile your app and optionally package it  
- LiveReload support in dev mode  
- Graceful shutdown on Ctrl+C  
- No noisy Cargo logs โ€” just your app

---

## ๐Ÿ“ฆ Installation

```bash
cargo install velto-cli
```

---

## ๐Ÿš€ Usage

### Create a new project

```bash
velto new my-app
```

This generates:

- `src/main.rs` with a sample route  
- `templates/index.html` with dynamic content  
- `static/` for assets like CSS and JS  
- `Cargo.toml` with Velto dependencies

---

### Run your app

```bash
velto run --port 3000
```

Options:

- `--port <PORT>` โ€” Set the port (default: 8080)  
- `-r`, `--release` โ€” Run in release mode

---

### Build your app

```bash
velto build --release --output dist/ --copy-assets
```

Options:

- `-r`, `--release` โ€” Build in release mode  
- `--target <TRIPLE>` โ€” Cross-compile for a specific target  
- `--output <DIR>` โ€” Copy the binary to a custom directory  
- `--quiet` โ€” Suppress Cargo output  
- `--copy-assets` โ€” Copy `templates/` and `static/` into the output directory

> Note: Running the binary from a custom output directory may require copying assets or setting environment paths.

---

## ๐Ÿงช CLI Tests

You can run these tests using `cargo test` inside the `velto-cli` repo.

### Example: `tests/cli.rs`

```rust
use std::process::Command;

#[test]
fn test_new_project() {
    let output = Command::new("cargo")
        .args(["run", "--", "new", "test-app"])
        .output()
        .expect("Failed to run velto new");

    assert!(output.status.success());
    assert!(std::path::Path::new("test-app/src/main.rs").exists());
}

#[test]
fn test_run_help() {
    let output = Command::new("cargo")
        .args(["run", "--", "run", "--help"])
        .output()
        .expect("Failed to run velto run --help");

    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(stdout.contains("Usage"));
    assert!(output.status.success());
}
```

---

## ๐Ÿ“„ License

MIT

---

## ๐Ÿ”— Links

- [Velto Framework]https://github.com/pjdur/velto
- [Velto CLI]https://github.com/pjdur/velto-cli

---

Happy building with Velto! โšก