Closed freed00m closed 3 years ago
the trim is there, because i first created the ability of pacui to have arguments and afterwards the "--flag" option.
as you probably know, the syntax of calling the update option in pacaui can be "pacui u", "pacui -u", or "pacui --u" (or all those options with a capital U). i wanted this functionality, because "pacui u" is the shortest argument to type (i.e. i prefer this way) but "pacui --help" is almost a standard for all shell scripts and should therefore be supported. my solution was to remove all leading "-" symbols from every argument (see line 2697). this way, both syntax styles can be used.
the while-loop (line 2684) goes through every given argument, removes leading "-" symbols (and some other stuff) and tries to match the argument to a pacui option. if your argument is "pacui u flag=xxxx", the while-loop is executed once for the first argument "u" and a second time for the argument "flag=xxxx". the second time, line 2786 is executed and the variable "argument_flag" now should contain "xxxx".
i have just checked this by adding the following code to line 110:
echo "argument_flag=""$argument_flag""|"
the result is as follows:
~ > ./dev/pacui/pacui u --flag="--testt"
argument_flag=--testt |
as you can see "--test " (including a space in the end" was correctly assigned to "argument_flag" variable.
i have just run " ./dev/pacui/pacui u --flag="--testt" " using yay, pikaur, and pacman (i.e. no AUR helper):
* yay yields the error message you have noticed,
* pikaur seems to ignore the unknown "testt" argument and
* pacman complains about an unknown "testt" argument: `pacman: unrecognized option '--testt -Syu'`
the problem must be in line 115 when calling "`yay --testt -Syu`". but since the "argument_flag" variable contains the full "--testt " string (and this includes leading dashes), i conclude that the mistake is not on pacui's side because it correctly hands over the "argument_flag" variable to yay, pikaur, and pacman.
have you done similar tests?
what are your results?
p.s.: i seems that i cannot edit or preview comments on github anymore. therefore, the lower half of my previous comment is all marked as code. shame on github.
@excalibur1234 - maybe moving to the gitlab instance? :) Github is becoming more terrible each day.
Yes when I add the echo line on 110 I see the same thing but the flag is stilled trimed.
pacui u --flag="--noconfirm"
argument_flag=--noconfirm |
invalid option 'noconfirm -Syu'
doas (frdm@Warspite) password:
tadadadada
the while-loop (line 2684) goes through every given argument, removes leading "-" symbols (and some other stuff) and tries to match the argument to a pacui option. if your argument is "pacui u flag=xxxx", the while-loop is executed once for the first argument "u" and a second time for the argument "flag=xxxx". the second time, line 2786 is executed and the variable "argument_flag" now should contain "xxxx".
Yes I observed that but I cannot pass something to the yay with dashes then? I want to the argument should be untouched.
I see the argument_flag variable is set up correctly but then the loop does something to it without the possibility to stop it from happening.
The whole idea discussed prior implementing the argument_flag was to add options to the AUR helper and not extra actions.
your first sentence is (probably) not true:
as you can see in the second line of your output, the "argument_flag" variable contains the string "--noconfirm " (i.e. the dashes are still there!).
then, in line 115, yay gets called with the "argument_flag" variable:
yay "$argument_flag"-Syu
this means that the following line SHOULD get called (but for some reason is not):
yay --noconfirm -Syu
i think i found a solution:
can you test to replace line 115
if ( yay "$argument_flag"-Syu )
with this:
if ( yay "$argument_flag" -Syu )
does this work for you?
fixed in bf24fcb2e0082e70d1aeefa9af3c7ded70e6d2d8
Hi,
Just want to ask what is the reason for the trimming. Usin yay btw.
What I want to achieve is to run
pacui u --flag="--noconfirm"
It fails because
Why the trim?
on line 2791
I am so confused.