-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
docs: resolve chaotic heading hierarchy in task-arguments.md #8644
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
Merged
+31
−29
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,8 @@ Task arguments allow you to pass parameters to tasks, making them more flexible | |
|
|
||
| The **usage field** is the recommended approach for defining task arguments. It provides a clean, declarative syntax that works with both TOML tasks and file tasks. | ||
|
|
||
| See [Complete Usage Specification Reference](#complete-usage-specification-reference) for more details. | ||
|
|
||
| #### Quick Example | ||
|
|
||
| ```mise-toml [mise.toml] | ||
|
|
@@ -85,6 +87,35 @@ Options: | |
| -h, --help Print help | ||
| ``` | ||
|
|
||
| ### 2. File Task Headers {#file-task-headers} | ||
|
|
||
| For file tasks, you can define arguments directly in the file using special `#MISE` or `#USAGE` comment syntax: | ||
|
|
||
| ```bash [.mise/tasks/deploy] | ||
| #!/usr/bin/env bash | ||
| #MISE description "Deploy application" | ||
| #USAGE arg "<environment>" help="Deployment environment" { | ||
| #USAGE choices "dev" "staging" "prod" | ||
| #USAGE } | ||
| #USAGE flag "--dry-run" help="Preview changes without deploying" | ||
| #USAGE flag "--region <region>" help="AWS region" default="us-east-1" env="AWS_REGION" | ||
|
|
||
| ENVIRONMENT="${usage_environment?}" | ||
| REGION="${usage_region?}" | ||
| DRY_RUN="${usage_dry_run:-false}" | ||
|
|
||
| if [[ "$DRY_RUN" == "true" ]]; then | ||
| echo "DRY RUN: Would deploy to $ENVIRONMENT in $REGION" | ||
| else | ||
| echo "Deploying to $ENVIRONMENT in $REGION..." | ||
| ./scripts/deploy.sh "$ENVIRONMENT" "$REGION" | ||
| fi | ||
| ``` | ||
|
|
||
| ::: tip Syntax Options | ||
| Use `#MISE` (uppercase, recommended) or `#USAGE` for defining arguments in file tasks. `# [MISE]` or `# [USAGE]` are also accepted as workarounds for formatters. | ||
| ::: | ||
|
Comment on lines
+115
to
+117
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ## Complete Usage Specification Reference | ||
|
|
||
| ### Positional Arguments (`arg`) | ||
|
|
@@ -398,35 +429,6 @@ fi | |
| ''' | ||
| ``` | ||
|
|
||
| ### 2. File Task Headers {#file-task-headers} | ||
|
|
||
| For file tasks, you can define arguments directly in the file using special `#MISE` or `#USAGE` comment syntax: | ||
|
|
||
| ```bash [.mise/tasks/deploy] | ||
| #!/usr/bin/env bash | ||
| #MISE description "Deploy application" | ||
| #USAGE arg "<environment>" help="Deployment environment" { | ||
| #USAGE choices "dev" "staging" "prod" | ||
| #USAGE } | ||
| #USAGE flag "--dry-run" help="Preview changes without deploying" | ||
| #USAGE flag "--region <region>" help="AWS region" default="us-east-1" env="AWS_REGION" | ||
|
|
||
| ENVIRONMENT="${usage_environment?}" | ||
| REGION="${usage_region?}" | ||
| DRY_RUN="${usage_dry_run:-false}" | ||
|
|
||
| if [[ "$DRY_RUN" == "true" ]]; then | ||
| echo "DRY RUN: Would deploy to $ENVIRONMENT in $REGION" | ||
| else | ||
| echo "Deploying to $ENVIRONMENT in $REGION..." | ||
| ./scripts/deploy.sh "$ENVIRONMENT" "$REGION" | ||
| fi | ||
| ``` | ||
|
|
||
| ::: tip Syntax Options | ||
| Use `#MISE` (uppercase, recommended) or `#USAGE` for defining arguments in file tasks. `# [MISE]` or `# [USAGE]` are also accepted as workarounds for formatters. | ||
| ::: | ||
|
|
||
| ## Bash Variable Expansion for Usage Variables {#bash-variable-expansion} | ||
|
|
||
| When accessing usage-defined variables in bash scripts, use parameter expansion syntax to help [shellcheck](https://www.shellcheck.net/) understand these variables and provide default values for boolean flags. | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this link helps users quickly navigate to the complete usage specification reference. Consider adding similar links throughout the document where relevant sections are mentioned to improve navigation.