cargo-new-workspace

Crates.iocargo-new-workspace
lib.rscargo-new-workspace
version1.0.1
created_at2025-12-21 20:32:38.785734+00
updated_at2025-12-21 21:12:10.779343+00
descriptionA tiny binary that creates a minimal Cargo.toml file that a workspace requires
homepage
repositoryhttps://github.com/AskSkivdal/cargo-new-workspace
max_upload_size
id1998554
size2,669
Ask Skivdal (AskSkivdal)

documentation

README

cargo-new-workspace

This is a tiny cargo command to create a workspace in the current directory.

What does it do?

This program is really simple it just creates a minimal Cargo.toml in the current directory. The file will contain

[workspace]
resolver = "3"

Thats it, its literaly nothing more than

use std::{fs, path::PathBuf, process::exit};

fn main() {
    let cargo_file = PathBuf::from("./Cargo.toml");

    if cargo_file.exists() {
        eprintln!("This directory already has a Cargo.toml file");
        exit(1);
    }

    fs::write(cargo_file, b"[workspace]\nresolver = \"3\"").unwrap();
}

How to install

cargo install cargo-new-workspace

How to use

Since the program does not create a directory you will have to do that before you run cargo new-workspace

mkdir my-workspace
cd my-workspace
cargo new-workspace
Commit count: 0

cargo fmt