Skip to content

Commit

Permalink
fix: CLI parsing problem with Anaconda upload function (#838)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv authored May 17, 2024
1 parent e1ff000 commit b89d721
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl App {
}

/// Common opts that are shared between [`Rebuild`] and [`Build`]` subcommands
#[derive(Parser, Clone)]
#[derive(Parser, Clone, Debug)]
pub struct CommonOpts {
/// Output directory for build artifacts. Defaults to `./output`.
#[clap(long, env = "CONDA_BLD_PATH")]
Expand Down Expand Up @@ -297,7 +297,7 @@ pub struct RebuildOpts {
}

/// Upload options.
#[derive(Parser)]
#[derive(Parser, Debug)]
pub struct UploadOpts {
/// The package file to upload
#[arg(global = true, required = false)]
Expand Down Expand Up @@ -392,7 +392,7 @@ pub struct AnacondaOpts {
pub owner: String,

/// The channel / label to upload the package to (e.g. main / rc)
#[arg(short, long, env = "ANACONDA_CHANNEL", default_value = "main", num_args = 1..)]
#[arg(short, long, env = "ANACONDA_CHANNEL", default_value = "main")]
pub channel: Vec<String>,

/// The Anaconda API key, if none is provided, the token is read from the keychain / auth-file
Expand Down
4 changes: 4 additions & 0 deletions src/upload/anaconda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ impl Anaconda {
force: bool,
package: &ExtractedPackage<'_>,
) -> miette::Result<bool> {
if channels.is_empty() {
return Err(miette!("No channel selected - please specify at least one channel for upload to Anaconda.org"));
}

let sha256 = package.sha256().into_diagnostic()?;

let package_name = package.package_name();
Expand Down

0 comments on commit b89d721

Please sign in to comment.