Skip to content
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

ux: list tasks when command is not found #488

Merged

Conversation

ruben-arts
Copy link
Contributor

@ruben-arts ruben-arts commented Nov 22, 2023

Closes #485

Helps user with:

➜ pixi run bla
bla: command not found

Available tasks:
        build
        build-docs
        docs
        install
        lint
        test
        test-all

➜ 

Allows user to:

➜ pixi run 'echo $PIXI_PACKAGE_VERSION'
0.7.1-dev

➜ pixi run 'echo $PIXI_PACKAGE_VERSION && echo $PIXI_PACKAGE_NAME && echo $CONDA_PREFIX'
0.7.1-dev
pixi
/home/rarts/development/pixi/.pixi/env

Depended on denoland/deno_task_shell#98

@ruben-arts ruben-arts marked this pull request as ready for review November 22, 2023 19:27
src/cli/run.rs Outdated
// Use as-is if 'task' already contains multiple elements.
let task = if args.task.len() == 1 {
args.task[0]
.split_whitespace()
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if you pass 'echo "HELLO WORLD!"'? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you should shlex::split? https://docs.rs/shlex/latest/shlex/fn.split.html

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 is already parsed as two things and the pixi run "echo 'Hello World'" also works but that becomes weird.

But to miss edge cases we didn't think of now that shlex lib looks like a beter way forward!

@baszalmstra baszalmstra merged commit f47dde3 into prefix-dev:main Nov 23, 2023
9 checks passed
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.

pixi run should print an error if the task doesn't exist
2 participants