velto-cli

Crates.iovelto-cli
lib.rsvelto-cli
version0.3.0
created_at2025-10-02 12:35:49.42535+00
updated_at2025-10-18 09:39:27.555224+00
descriptionA fast and minimal CLI tool for building and running Velto web apps
homepagehttps://github.com/pjdur/velto-cli
repositoryhttps://github.com/pjdur/velto-cli
max_upload_size
id1864324
size37,361
Pjdur (Pjdur)

documentation

https://docs.rs/velto-cli

README

Velto CLI ๐Ÿš€

Velto CLI is the official command-line tool for 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
  • velto info โ€” Show your Velto environment and setup
  • LiveReload support in dev mode
  • Graceful shutdown on Ctrl+C
  • No noisy Cargo logs โ€” just your app

๐Ÿ“ฆ Installation

cargo install velto-cli

๐Ÿš€ Usage

Create a new project

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

velto run --port 3000

Options:

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

Build your app

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.


Show environment info

velto info

Outputs:

  • Velto CLI version
  • Velto Framework version (from Cargo.lock)
  • Rust version
  • Target architecture

Helpful for debugging, support, and verifying your setup.


๐Ÿงช CLI Tests

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

Example: tests/cli.rs

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


Happy building with Velto! โšก

Commit count: 0

cargo fmt