Skip to content

Support invoking sea-orm-cli as a Cargo subcommand - #3187

Merged
Huliiiiii merged 2 commits into
SeaQL:masterfrom
onenewcode:feat/cargo-sea-subcommand
Oct 5, 2026
Merged

Huliiiiii merged 2 commits into
SeaQL:masterfrom
onenewcode:feat/cargo-sea-subcommand

Conversation

@onenewcode

@onenewcode onenewcode commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Closes #3151.

It's currently not possible to run the CLI as a standard Cargo subcommand (cargo sea ...), which prevents users from defining Cargo aliases for long commands, e.g.:

[alias]
m-entity = "sea generate entity --database-url ..."

Changes

  • Add a cargo-sea binary target (reusing the existing src/bin/main.rs), so Cargo can discover it as the sea subcommand.
  • When invoked as a Cargo subcommand, Cargo injects the subcommand name (sea) as argv[1]; strip it before parsing, but only under a cargo- binary name, so standalone sea / sea-orm-cli invocations are unaffected.

Usage

cargo install sea-orm-cli        # also installs the `cargo-sea` binary
cargo sea generate entity -u sqlite://bakery.db -o out
cargo sea migrate up

@Huliiiiii
Huliiiiii force-pushed the feat/cargo-sea-subcommand branch from c7121a9 to 391dcc1 Compare October 5, 2026 00:08
@Huliiiiii
Huliiiiii merged commit e25a35b into SeaQL:master Oct 5, 2026
20 checks passed
@Huliiiiii

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sea or sea-orm-cli implemented as a standard Cargo subcommand

2 participants