You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First argument is a Python method that evaluates to True/False (by Python truthiness rules)
Second argument is a command for the true branch
Third argument is a command for the else branch, if given.
Design question: when should the first argument be evaluated ?
At compose time: we only have access to config and args. Theoretically, only the arguments of the taken branch would be needed but the branch may change between invocations. Argparser would then complain of missing or unrecognized parameters.
At run time: we have access to config, args and previous command output but we don't know which branch would be taken so we need arguments for both.
Alternative: StdinConverter can be (partially) used to replace the executed command at run time. Eg. StdinConverter(Cmd(sub=BranchA()), converter=lambda s: {} if not predicate(s) else {'sub': BranchB()}). However, it would not expose the arguments of BranchB and Cmd is a command that takes a subcommand as its argument.
The text was updated successfully, but these errors were encountered:
If(a, b, c)
Design question: when should the first argument be evaluated ?
Alternative: StdinConverter can be (partially) used to replace the executed command at run time. Eg.
StdinConverter(Cmd(sub=BranchA()), converter=lambda s: {} if not predicate(s) else {'sub': BranchB()})
. However, it would not expose the arguments of BranchB andCmd
is a command that takes a subcommand as its argument.The text was updated successfully, but these errors were encountered: