Open JJBT opened 1 year ago
This is currently not possible, and I think tricky to implement without being very weird. I would be open to this if the implementation were very simple though.
@JJBT Though I like the idea as it could potentially avoid lots of otherwise necessary scripting you can do some shebang shell scripting to handle these situations
# UNIX Shell Test
shell_test *NAME:
#!/bin/sh
if [ '{{NAME}}' = '' ]; then
command
else
another_command "{{NAME}}"
fi
or using PowerShell in a cross-platform setup
set windows-shell := ["powershell", "-c"] # To use PowerShell Desktop instead of Core on Windows
set shell := ["pwsh", "-c"] # PowerShell Core (Multi-Platform)
shebang := if os() == 'windows' { 'powershell' } else { '/usr/bin/env pwsh' } # Switch 'powershell' with 'pwsh' for PowerShell Core
# PowerShell Test
pwsh_test *NAME:
#!{{shebang}}
$NAME = "{{NAME}}"
if ($NAME.Length -eq 0) {
command
} else {
another_command "$NAME"
}
Is it possible to use recipes with argument and without as a different recipes without overriding? If not i think it would be great idea to make it works
In my case
command
is a list of some objects andanother_command
is a list of the same objects but with grepping by the NAME.