Skip to content

Commit

Permalink
fix: output task on pixi run without input (#2193)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-arts authored Oct 3, 2024
1 parent e6459e5 commit 6b8d300
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ use tracing::Level;

/// Runs task in project.
#[derive(Parser, Debug, Default)]
#[clap(trailing_var_arg = true, arg_required_else_help = true)]
#[clap(trailing_var_arg = true)]
pub struct Args {
/// The pixi task or a task shell command you want to run in the project's environment, which can be an executable in the environment's PATH.
#[arg(required = true)]
pub task: Vec<String>,

#[clap(flatten)]
Expand All @@ -56,6 +55,17 @@ pub async fn execute(args: Args) -> miette::Result<()> {
let project = Project::load_or_else_discover(args.project_config.manifest_path.as_deref())?
.with_cli_config(args.prefix_update_config.config.clone());

// Print all available tasks if no task is provided
if args.task.is_empty() {
command_not_found(
&project,
args.environment
.clone()
.and_then(|env| project.environment_from_name_or_env_var(Some(env)).ok()),
);
return Ok(());
}

// Sanity check of prefix location
verify_prefix_location_unchanged(project.default_environment().dir().as_path()).await?;

Expand Down

0 comments on commit 6b8d300

Please sign in to comment.