-
-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
When a task argument has type set to "boolean", I expect default=false and leaving the default unset to behave the same way. However, when the default is not specified, None is passed instead of false.
Setting the type to "boolean" makes the resulting argument a flag that if provided will set the value to the boolean opposite of the default value – i.e. true if no default value is given, or false if default = true.
https://poethepoet.natn.io/guides/args_guide.html#task-argument-options
This is inconvenient when performing variable expansion in a cmd task.
When default=true, I would expect the argument to become an empty string when the flag is provided.
https://poethepoet.natn.io/tasks/task_types/cmd.html#parameter-expansion-operators
example
[tool.poe.tasks.boolean]
cmd = """echo \\
var_default=${var} var_plus=${var:+plus} var_minus=${var:-minus} \\
pos_default=${pos} pos_plus=${pos:+plus} pos_minus=${pos:-minus} \\
neg_default=${neg} neg_plus=${neg:+plus} neg_minus=${neg:-minus}
"""
args = [
{ name = "var", type = "boolean" },
{ name = "pos", type = "boolean", default = true },
{ name = "neg", type = "boolean", default = false },
]$ poe boolean
Poe => echo '
var_default=' var_plus= var_minus=minus '
pos_default=True' pos_plus=plus pos_minus=True '
neg_default=False' neg_plus=plus neg_minus=False
var_default= var_plus= var_minus=minus
pos_default=True pos_plus=plus pos_minus=True
neg_default=False neg_plus=plus neg_minus=False
$ poe boolean --var --pos --neg
Poe => echo '
var_default=True' var_plus=plus var_minus=True '
pos_default=False' pos_plus=plus pos_minus=False '
neg_default=True' neg_plus=plus neg_minus=True
var_default=True var_plus=plus var_minus=True
pos_default=False pos_plus=plus pos_minus=False
neg_default=True neg_plus=plus neg_minus=TrueReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels