Skip to content

Commit c60966f

Browse files
committed
README tweaks
1 parent 2083a41 commit c60966f

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "cargox-cli"
33
version = "0.1.0"
44
edition = "2024"
55
repository = "https://github.com/pkgxdev/cargox"
6-
description = "Run Cargo binaries on demand, installing them via cargo-binstall when missing."
6+
description = "`npx` for the cargo ecosystem."
77
license = "Apache-2.0"
88

99
[[bin]]

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
# `cargox`
22

33
[![CI](https://github.com/mxcl/cargox/actions/workflows/ci.yml/badge.svg)](https://github.com/mxcl/cargox/actions/workflows/ci.yml)
4+
[![Crates.io](https://img.shields.io/crates/v/cargox-cli.svg)](https://crates.io/crates/cargox-cli)
45

56
`cargox` runs Rust binaries on demand, installing them automatically if necessary.
67
It mirrors the convenience of `npx` for the Cargo ecosystem while prioritising
78
`cargo-binstall` to download prebuilt executables whenever possible.
89

10+
## Installation
11+
12+
We recommend installing cargo-binstall as well, this significantly speeds up
13+
use of `cargox`:
14+
15+
```sh
16+
cargo install cargo-binstall
17+
cargo binstall cargox-cli
18+
```
19+
20+
If you don’t want that then you can just `cargo install cargox-cli`.
21+
922
## Features
1023

1124
- Executes `crate[@version]` binaries, installing them on demand.
@@ -21,21 +34,26 @@ cargox <crate[@version]> [--] [binary-args...]
2134
Examples:
2235

2336
```bash
24-
# Run the latest wasm-pack, installing it if necessary
25-
cargox bat ./README.md
37+
# Run the latest bat that is installed or installing the latest bat if necessary
38+
$ cargox bat ./README.md
39+
40+
$ cargox bat@latest ./README.md
41+
# If the installed bat is old we only check for newer if you do this.
42+
# This is how every foo*x* tool works. We are not being different.
2643

2744
# Install and run a pinned version
28-
cargox cargo-deny@0.16.3 check
45+
$ cargox cargo-deny@0.16.3 check
2946

3047
# Force a reinstall, building from source instead of using cargo-binstall
31-
cargox --force --build-from-source cargo-nextest
48+
$ cargox --force --build-from-source cargo-nextest
49+
# ^^ shorter: cargox -fs cargo-nextest
3250
```
3351

3452
> [!TIP]
3553
>
3654
> - Arguments before the first positional are passed to `cargox`.
37-
> - Arguments after `--` are passed to the invoked binary.
38-
> - Use `--` if necessary to define the separation point.
55+
> - Arguments after the positional argument are passed to the invoked binary.
56+
> - You can use `--` if necessary to define this separation point.
3957
4058
### Flags
4159

src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use clap::Parser;
33
use std::env;
44
use std::ffi::OsString;
55

6-
/// Run Cargo binaries on demand, installing them via `cargo-binstall` when missing.
6+
/// Run Cargo binaries on demand
77
#[derive(Parser, Debug)]
8-
#[command(name = "cargox", author, version, about, long_about = None, arg_required_else_help = true)]
8+
#[command(name = "cargox", author, version, about = "Run Cargo binaries on demand", long_about = None, arg_required_else_help = true)]
99
pub struct Cli {
1010
/// Crate to run, optionally suffixed with `@version`
1111
#[arg(value_name = "crate[@version]")]

src/installer.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ fn install_with_binstall(target: &Target, cli: &Cli, version: &Version) -> Resul
4242
cmd.arg("--quiet");
4343
}
4444
cmd.arg("--no-confirm");
45-
if cli.force {
46-
cmd.arg("--force");
47-
}
45+
cmd.arg("--force");
4846
if let Some(bin) = &cli.bin {
4947
cmd.arg("--bin");
5048
cmd.arg(bin);

0 commit comments

Comments
 (0)