Skip to content

Unable to pass --verbose flag to mise task via usage #285

@lbg-samuelmcneilly

Description

@lbg-samuelmcneilly

Hey there 👋 !

I've recently added a --verbose option to one of my mise tasks, alongside a bunch of other #USAGE flags and arguments. Everything works as expected, other than the --verbose flag.

What I've observed is that, if the --verbose flag is the first parameter, it seems to be grabbed by mise and not passed to the task.

This can be replicated with a minimal task like:

#!/usr/bin/env bash

#MISE description="Sample task."

#USAGE flag "--verbose" help="Output extra debug logging."
#USAGE flag "--other-flag" help="Random extra test flag."
#USAGE flag "--force" help="Ignore caches."

if [ "$usage_verbose" = "true" ] ; then
    echo "Verbose"
else
    echo "Not verbose"
fi

if [ "$usage_force" = "true" ] ; then
    echo "Force"
else
    echo "Do not force"
fi

Running mise run sample-task --verbose results in the unexpected output:

Not verbose
Do not force

Running mise run sample-task --other-flag --verbose results in the expected output:

Verbose
Do not force

Is there anything I need to change in my usage config, or should I be running tasks in a different way? This issue looks similar to #162, but the solution suggested on that ticket just appears to open the interactive task selector for me.

Any guidance is appreciated 🙇‍♂.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions