Skip to content
Open
Changes from 1 commit
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
13 changes: 11 additions & 2 deletions crates/pixi_cli/src/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use indexmap::IndexMap;
use miette::IntoDiagnostic;
use pixi_config::ConfigCli;
use pixi_core::{WorkspaceLocator, environment::sanity_check_workspace, workspace::DependencyType};
use pixi_manifest::{FeatureName, KnownPreviewFeature, SpecType};
use pixi_manifest::{FeatureName, KnownPreviewFeature, SpecType, PrioritizedChannel};
use pixi_spec::{GitSpec, SourceLocationSpec, SourceSpec};
use rattler_conda_types::{MatchSpec, PackageName};
use rattler_conda_types::{MatchSpec, PackageName, NamedChannelOrUrl};

use crate::{
cli_config::{DependencyConfig, LockFileUpdateConfig, NoInstallConfig, WorkspaceConfig},
Expand Down Expand Up @@ -92,6 +92,11 @@ pub struct Args {
/// Whether the pypi requirement should be editable
#[arg(long, requires = "pypi")]
pub editable: bool,

// Specify channel
#[arg(long)]
pub channel: Option<String>,

}

pub async fn execute(args: Args) -> miette::Result<()> {
Expand All @@ -111,6 +116,10 @@ pub async fn execute(args: Args) -> miette::Result<()> {

let mut workspace = workspace.modify()?;

// Add a channel
let channel = args.channel;
workspace.manifest().add_channels([PrioritizedChannel::from(NamedChannelOrUrl::Name(String::from(channel.unwrap_or_default()))).clone()], &FeatureName::DEFAULT, false)?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line just calls the add_channels() function with the args given from the user, so testing this is essentially testing the functionalities of add_channel() which is already tested and also includes the situation where we try to add channel when it's already present.

@baszalmstra Do you think we sould still try to add tests for this? If so could me point to where the tests for cli inputs are(or should be) present.


// Add the platform if it is not already present
workspace
.manifest()
Expand Down
Loading