Skip to content

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

Open
onenewcode wants to merge 1 commit into
SeaQL:masterfrom
onenewcode:feat/cargo-sea-subcommand
Open

Support invoking sea-orm-cli as a Cargo subcommand#3187
onenewcode wants to merge 1 commit into
SeaQL:masterfrom
onenewcode:feat/cargo-sea-subcommand

Conversation

@onenewcode

@onenewcode onenewcode commented Aug 27, 2026

Copy link
Copy Markdown

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

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

1 participant