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
The goal is to address a limitation in the file provisioner of the Provisioner SDK where the current AddArgs function does not handle commands with positional arguments at the end. Such commands cannot accept additional flag arguments after the positional arguments, leading to invalid command construction.
Proposed solution:
Replace AddArgs with:
PrependArgs: Adds arguments to the beginning of the command (but after the command itself).
AppendArgs: Adds arguments to the end of the command, same functionality as the AddArgs function currently.
This change will allow the file provisioner to generate valid commands for age and other CLIs with similar requirements. An argument could be made also for other functionality such as InsertAt(index) or InsertAfter(string) to allow exact placement of the injected argument.
Current behavior
The current implementation of AddArgs appends arguments to the end of the command without considering the position of positional arguments. This leads to issues when commands have strict ordering requirements for flags and positional arguments.
For example, in the file provisioner, consider the age command:
$ age --encrypt --recipients-file key.txt -o output.txt input.txt
In this example:
The flag --recipients-file key.txt must appear before the positional argument input.txt
Using AddArgs to append these flags results in an invalid command:
$ age --encrypt -o output.txt input.txt --recipients-file key.txt
age: error: too many INPUT arguments: "input.txt" "--recipients-file" "key.txt"
age: hint: the input file must be specified after all flags
age: hint: did you mean:
age: hint: age --encrypt -o output.txt --recipients-file key.txt input.txt
Relevant log output
No response
op CLI version
No response
shell-plugins local ref
No response
The text was updated successfully, but these errors were encountered:
What does it concern?
The plugin SDK, design, or schema
Goal or desired behavior
The goal is to address a limitation in the file provisioner of the Provisioner SDK where the current
AddArgs
function does not handle commands with positional arguments at the end. Such commands cannot accept additional flag arguments after the positional arguments, leading to invalid command construction.Proposed solution:
AddArgs
with:PrependArgs
: Adds arguments to the beginning of the command (but after the command itself).AppendArgs
: Adds arguments to the end of the command, same functionality as theAddArgs
function currently.This change will allow the file provisioner to generate valid commands for
age
and other CLIs with similar requirements. An argument could be made also for other functionality such asInsertAt(index)
orInsertAfter(string)
to allow exact placement of the injected argument.Current behavior
The current implementation of
AddArgs
appends arguments to the end of the command without considering the position of positional arguments. This leads to issues when commands have strict ordering requirements for flags and positional arguments.For example, in the file provisioner, consider the
age
command:In this example:
--recipients-file key.txt
must appear before the positional argumentinput.txt
AddArgs
to append these flags results in an invalid command:Relevant log output
No response
op CLI version
No response
shell-plugins local ref
No response
The text was updated successfully, but these errors were encountered: