diff --git a/docs/tools/forge-cli.md b/docs/tools/forge-cli.md index c1ab85db..67f4e5ea 100644 --- a/docs/tools/forge-cli.md +++ b/docs/tools/forge-cli.md @@ -534,9 +534,7 @@ Create a pull request * `--body-file ` — Read body from a file. `-` means stdin * `--draft` — Open as draft. Ignored in `--agit` mode * `--push` — Push the local `--head` branch to `--remote` before creating the PR -* `--remote ` — Remote to push to - - Default value: `origin` +* `--remote ` — Remote to push to (default: `forge`, or `origin` in `--agit` mode) * `--agit` — Open the PR via Forgejo's `AGit` flow instead of pushing a branch — works for read-only collaborators. Run from inside a cloned repo * `--topic ` — `AGit` topic — groups repeated pushes into one PR (re-run with the same topic to update it). Defaults to the branch name. Only meaningful with `--agit` * `--label ` — Label name to attach, repeatable (for example `--label area/ops --label type/bug`). Same spelling `labels add` accepts — an unresolved name errors out rather than silently attaching fewer labels than asked for. In `--agit` mode `pr create` applies this as a follow-up call once it learns the PR number (the `AGit` push itself has no label field), so it silently skips them (not a label-resolution error) if it couldn't parse the PR URL back out of the push output — same fallback as the deferred multi-line body diff --git a/hive-forge/src/verbs/pr_create.rs b/hive-forge/src/verbs/pr_create.rs index 8885fca9..9f98e3aa 100644 --- a/hive-forge/src/verbs/pr_create.rs +++ b/hive-forge/src/verbs/pr_create.rs @@ -3,7 +3,7 @@ //! the PR URL. //! //! With `--push` the local `--head` branch is pushed to `--remote` -//! (default `origin`) before the API call, and forgejo's post-push +//! (default `forge`) before the API call, and forgejo's post-push //! "Create a new pull request" / "Visit the existing pull request" //! hint block is filtered out of git's stderr (we print the canonical //! URL ourselves once the API returns). Other git stderr passes @@ -56,9 +56,9 @@ pub struct Args { /// Push the local `--head` branch to `--remote` before creating the PR. #[arg(long)] push: bool, - /// Remote to push to. - #[arg(long, default_value = "origin")] - remote: String, + /// Remote to push to (default: `forge`, or `origin` in `--agit` mode). + #[arg(long)] + remote: Option, /// Open the PR via Forgejo's `AGit` flow instead of pushing a branch — /// works for read-only collaborators. Run from inside a cloned repo. #[arg(long)] @@ -98,7 +98,7 @@ pub fn run(client: &Client, args: Args) -> Result<()> { .head .as_deref() .expect("clap requires --head unless --agit"); - let remote = args.remote.as_str(); + let remote = args.remote.as_deref().unwrap_or("forge"); if args.push { push_branch(remote, head)?; } @@ -149,7 +149,7 @@ pub fn run(client: &Client, args: Args) -> Result<()> { /// PATCH, mirroring the manual `pr create --title …` + `issue edit /// --body-file` two-step. fn agit_create(client: &Client, args: &Args, body: &str) -> Result<()> { - let remote = args.remote.as_str(); + let remote = args.remote.as_deref().unwrap_or("origin"); let topic = match &args.topic { Some(t) => t.clone(), None => current_branch().unwrap_or_else(|| "contribution".to_owned()),