Skip to content
Merged
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
5 changes: 3 additions & 2 deletions e2e/tasks/test_task_help
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env bash

cat <<EOF >mise.toml
cat <<'EOF' >mise.toml
[tasks.atask]
run = 'echo {{arg(name="myarg")}}'
usage = 'arg "<myarg>"'
run = 'echo $usage_myarg'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

When migrating from the Tera-based arg() function to environment variables, it is recommended to quote the variable in the shell script. The previous Tera implementation handled shell-quoting automatically, whereas using $usage_myarg directly in the script can lead to word splitting or glob expansion if the argument contains spaces or special characters.

run = 'echo "$usage_myarg"'

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Tried this — it breaks the bypass-parser assertion at test_task_help:21:

assert "mise atask -q -- --help 2>&1 || true" "--help"

With -- --help the usage parser is skipped, so $usage_myarg is empty. The trailing --help is appended as a script arg:

  • echo $usage_myarg --help--help ✓ (empty word collapses)
  • echo "$usage_myarg" --help --help ✗ (literal empty arg = leading space)

The test specifically exercises this empty-bypass case, so I'm leaving it unquoted. (Generally good advice though.)

This comment was generated by an AI coding assistant.

[tasks.npm]
run = 'echo npm'
EOF
Expand Down
Loading