Skip to content

feat: enhance pixi task add CLI command to support issue #3828 #3884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DishankChauhan
Copy link

Summary

This PR enhances the pixi task add CLI command to address all requirements from issue #3828.

Changes Made

🔧 Enhanced CLI Features

  • Enhanced dependency parsing: Support for task:env and task::arg1,arg2 formats
  • Task arguments with defaults: --arg name and --arg name=default
  • Inputs/outputs support: --inputs "*.rs" and --outputs "target/*"
  • Alias creation: Create aliases using --depends-on without commands
  • Validation: Ensures either commands or dependencies are provided

🔄 Backward Compatibility

  • All existing functionality preserved
  • Existing task definitions continue to work unchanged
  • No breaking changes to the API

✅ Testing

  • Comprehensive manual testing of all new features
  • All existing tests pass
  • Fixed integration test compilation
  • Clippy and formatting checks pass

Example Usage

# Enhanced dependency with environment
pixi task add deploy --depends-on build:production

# Task with arguments and defaults
pixi task add compile echo "Mode: $MODE" --arg mode=debug

# Alias creation (no commands, just dependencies)
pixi task add test-all --depends-on test-unit test-integration

# With inputs and outputs
pixi task add build cargo build --inputs "src/**/*.rs" --outputs "target/debug/*"

Fixes #3828

…pends-on parsing with environment and arguments - Add task arguments with default values support - Enable alias creation via depends-on without commands - Add inputs and outputs glob patterns support - Add validation to ensure either commands or dependencies are provided - Maintain backward compatibility with existing functionality - Fix clippy linting issues and update tests - Fixes prefix-dev#3828
Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

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

Great additions! It's not yet hooked up properly as i found out with the inputs and outputs. I really like the idea of the splitting you implemented on the args and depends on!

Could you add all possible new commands as an integration test?
The best location for that would be: tests/integration_python/test_main_cli.py.

@@ -212,8 +297,8 @@ impl From<AddArgs> for Task {
Self::Execute(Box::new(Execute {
cmd: CmdArgs::Single(cmd_args.into()),
depends_on,
inputs: None,
outputs: None,
inputs: value.inputs,
Copy link
Contributor

Choose a reason for hiding this comment

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

The inputs and outputs are not serialized when adding e.g.:

pixi task add test10 --inputs "*.rs" --outputs "target" echo hello

results in:

test10 = { cmd = "echo hello" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve pixi task add CLI command.
3 participants