Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ enum Commands {
fixed: Vec<String>,
#[arg(long, help = "Adjusted change item", action = clap::ArgAction::Append, num_args = 1)]
adjusted: Vec<String>,
#[arg(
long = "yes",
short = 'y',
visible_alias = "force",
help = "Skip confirmation (required when non-interactive)"
)]
yes: bool,
Comment on lines +127 to +133

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flag naming is inverted relative to clear-playtest-data, and --force is now overloaded three ways.

clear-playtest-data (src/main.rs:218-224) declares long = "force", short = 'y', visible_alias = "yes"; this declares the mirror image. Both accept all three spellings, so nothing breaks — but the help output disagrees:

  • wavedash clear-playtest-data --help-y, --force [aliases: yes]
  • wavedash publish --help-y, --yes [aliases: force]

Separately, --force already means something different elsewhere in the CLI: on stat delete (src/main.rs:365) and achievement delete (src/main.rs:463) it means "proceed even though user progress is attached", not "skip the confirmation prompt" — and neither of those exposes -y. Making --force a visible alias here pushes a third meaning into the same word.

--yes reads better for publish (it isn't destructive, just consequential), so I'd keep it canonical and demote the alias to a hidden one — compatibility for anyone who reaches for --force out of habit, without advertising the overloaded name:

Suggested change
#[arg(
long = "yes",
short = 'y',
visible_alias = "force",
help = "Skip confirmation (required when non-interactive)"
)]
yes: bool,
#[arg(
long = "yes",
short = 'y',
alias = "force",
help = "Skip confirmation (required when non-interactive)"
)]
yes: bool,

Flipping clear-playtest-data to match is the other reasonable direction — the point is that the two confirmation gates should read the same way.

},
Team {
#[command(subcommand)]
Expand Down Expand Up @@ -638,6 +645,7 @@ async fn run() -> Result<()> {
removed,
fixed,
adjusted,
yes,
} => {
handle_publish(PublishArgs {
config_path: config,
Expand All @@ -648,6 +656,7 @@ async fn run() -> Result<()> {
removed,
fixed,
adjusted,
yes,
})
.await?;
}
Expand Down
29 changes: 28 additions & 1 deletion src/publish.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::auth::AuthManager;
use crate::config::{self, WavedashConfig};
use anyhow::Result;
use colored::Colorize;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

Expand Down Expand Up @@ -43,6 +44,7 @@ pub struct PublishArgs {
pub removed: Vec<String>,
pub fixed: Vec<String>,
pub adjusted: Vec<String>,
pub yes: bool,
}

fn trim_optional(value: Option<String>) -> Option<String> {
Expand Down Expand Up @@ -105,20 +107,45 @@ pub async fn handle_publish(args: PublishArgs) -> Result<()> {
removed,
fixed,
adjusted,
yes,
} = args;

let wavedash_config = WavedashConfig::load(&config_path)?;
let game_id = wavedash_config.game_id()?;

let auth_manager = AuthManager::new()?;
let api_key = auth_manager
.get_api_key()
.ok_or_else(|| anyhow::anyhow!("Not authenticated. Run 'wavedash auth login' first."))?;

if !yes {
if crate::is_non_interactive() {
anyhow::bail!(
"Refusing to publish without confirmation.\n\
Re-run with --yes (alias --force / -y) to proceed non-interactively."
);
}

println!(
"{} This will make build {} live for players of game {}.",
"Warning:".yellow().bold(),
build_id.bold(),
game_id.bold()
);
let confirmed = cliclack::confirm("Are you sure you want to continue?")
.initial_value(false)
.interact()?;
if !confirmed {
println!("Aborted. Nothing was published.");
return Ok(());
}
}

let client = config::create_http_client()?;
let api_host = config::get("api_host")?;
let url = format!(
"{}/api/games/{}/builds/{}/publish",
api_host, wavedash_config.game_id()?, build_id
api_host, game_id, build_id
);

let notes = build_release_notes(title, summary, added, removed, fixed, adjusted);
Expand Down
Loading