Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 4 additions & 5 deletions src/cli/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,10 @@ async fn list_tasks(workspace: Workspace, args: ListArgs) -> miette::Result<()>
.map(|(env, task_names)| {
let task_map = task_names
.into_iter()
.map(|task_name| {
let task = env
.task(&task_name, None)
.expect("task should be available here");
(task_name, task)
.flat_map(|task_name| {
env.task(&task_name, Some(env.best_platform()))
.ok()
.map(|task| (task_name, task))
})
.collect();
(env, task_map)
Expand Down
23 changes: 23 additions & 0 deletions tests/integration_python/test_main_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1212,3 +1212,26 @@ def test_pixi_info_tasks(pixi: Path, tmp_pixi_workspace: Path) -> None:
"""
manifest.write_text(toml)
verify_cli_command([pixi, "info", "--manifest-path", manifest], stdout_contains="foo, bar")


def test_pixi_task_list_platforms(pixi: Path, tmp_pixi_workspace: Path) -> None:
manifest = tmp_pixi_workspace.joinpath("pixi.toml")
toml = """
[workspace]
name = "test"
channels = []
platforms = ["linux-64", "win-64", "osx-64", "osx-arm64"]

[tasks]
foo = "echo foo"

[target.unix.tasks]
bar = "echo bar"

[target.win.tasks]
bar = "echo bar"
"""
manifest.write_text(toml)
verify_cli_command(
[pixi, "task", "list", "--manifest-path", manifest], stderr_contains=["foo", "bar"]
)