You are not logged in.
Pages: 1
Topic closed
I've read the man page, check the wiki in the spots that seem relevant and can't seem to find anything relevant about gotchas. But, I've come across a need to modify the standard output behaviour for pacman and it does have the --print-format option. Although, if a typical: "pacman -Ss <package>" is changed to: "pacman -Ss --print-format "%n" <package>" I get no change it output. It prints the standard two-line 'repo/name version\ndescription' that is typical.
Tried;
1. pacman -Ss --print-format "%n" <package>, no dice
2. pacman --print-format "%n" -Ss <package>, no dice
3. pacman --print --print-format "%n" -Ss <package>, no dice
4. pacman --print -Ss print-format "%n" <package>, no dice
Nothing seems to alter the output. These are just for demonstration. I know if all I wanted was a list of names the "-q" option is avaialable on a search and it will provide that, but that's not my ultimate goal. This is where I'm starting and the starting block doesn't work, no sense going further and just banging my head against a wall.
What's wrong with my commandline?
.--. Pacman v6.0.1 - libalpm v13.0.1
/ _.-' .-. .-. .-. Copyright (C) 2006-2021 Pacman Development Team
\ '-. '-' '-' '-' Copyright (C) 2002-2006 Judd Vinet
'--'
This program may be freely redistributed under
the terms of the GNU General Public License.
Sincerely,
Nathan
Last edited by watham (2022-06-09 17:37:56)
Offline
--print-format only applies to -Sp/-Rp/-Up
Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby
Offline
Try community/expac.
Offline
Wouldn't it be clever if -h and the man page actually mentioned that specifically. There was something in --print (-p) about using --print-format to customize the output. Altough the man page specifically lists --print-format under "TRANSACTION OPTIONS (APPLY TO -S, -R AND -U)" *sigh* should tell us the sub options it only works for too I suppose. Ironically I had tried "-Ss --print --print-format ..." which was unsuccessfull.
Thanks!
Offline
Wouldn't it be clever if -h and the man page actually mentioned that specifically.
No, clever would be actually reading the man page before posting a comment like that:
--print-format <format>
Specify a printf-like format to control the output of the --print operation.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
No, clever would be actually reading the man page before posting a comment like that:
Instead of just being a d***, show me where it explains -p and -s are mutually exclusive since you want to be so snarky. I don't see it. I already alluded to the fact I read that. My blonde moment or not, never used the --print option, and it's also not specified as mutually exclusive in this context or *any* for that matter.
My comment is more like "oh well, life goes on ..." I understand documentation doesn't always match reality and here's a perfect case. I'm not some entitled individual but I did check the documentation and am very confused since none of my examples seemed to do what the documentation indicated they should.
Many options under -S can be combined and wouldn't it make sense you could control the output of -s by doing something like "pacman -Ssp --print-format "....." <package>"? IDK, to me that makes sense. Neither under -s for -Q or -s for -S does it say it ignore -p. Under -p it does NOT say it is ignored by -s. In fact -p is listed as "TRANSACTION OPTIONS (APPLY TO -S, -R AND -U)", doesn't that imply it APPLIES to EVERYTHING under -S -R and -U unless otherwise noted?
If you treat other Newbie Corners like this in the future, you're not a good addition to this board.
Last edited by watham (2022-06-09 19:22:49)
Offline
Try community/expac.
Thank you! I have it installed, and it really is more like what should be used in the context of what I wanted. I was using yay and noticed the print-format and figured it was passed through, so checked the man page in pacman and started reading more. There didn't seem to be a documented restriction for combining "search" and "print" under "sync", so that's where my confusion was! Now I see that there's no need to use "search" as using "print" alone with search for a given argument and output using the supplied --print-format.
Sincerely,
Nathan
Offline
--print-format only applies to -Sp/-Rp/-Up
? that's where there was a breakdown in my understanding. While print-format says to use it with --print, --print doesn't say you can't use it with other things in the "Sync" option set so I was assuming a --search was still needed, but it isn't.
Thank you for your help! I've marked the thread as [SOLVED] with this after a little tinkering.
Offline
I also got confused by this part the first time I read it. I don't know of a technical reason why -p does not apply to operation options like -s though. That might be something to discuss on the pacman-dev mailing list.
Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby
Offline
Instead of just being a d***, show me where it explains -p and -s are mutually exclusive
--print doesn't say you can't use it with other things in the "Sync" option set
Yes it does.
-p, --print
Only print the targets instead of performing the actual operation (sync, remove or upgrade).
But go ahead, and just call me a dick again rather than acknowledging the facts in front of you.
Last edited by Trilby (2022-06-10 01:31:51)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
watham wrote:Instead of just being a d***, show me where it explains -p and -s are mutually exclusive
watham wrote:--print doesn't say you can't use it with other things in the "Sync" option set
Yes it does.
man pacman wrote:-p, --print
Only print the targets instead of performing the actual operation (sync, remove or upgrade).But go ahead, and just call me a dick again rather than acknowledging the facts in front of you.
And where does it say that -S (Notice it's a capital S smarty pants) "sync" then doesn't work at all? In fact you cannot use --print as a single option it must be coupled with one of those three options. Try it since you point that out. Based on how that's written you can't "sync" but "pacman --print" is impossible.
So "pacman -S --print <package>" is how it works. So how does that stop the actual operation? Oh, /right/ it PRINTS. That is EXACTLY what I wanted to do. As I indicated in my original post I understood there was something related with --print-format and --print. I also knew a list was possible to see with just using "-q". Maybe *you* should work on your reading comprehension here since -S and -s are different options in pacman. Where in *anything* have you showed any documentation that says they're mutually exclusive?
So again, don't be a d***. Doesn't matter how many thousands of posts you have.
Offline
"sync" is a description of the operation, not a flag in this case.
Last edited by progandy (2022-06-10 08:18:59)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
A search is not a sync (install), remove or upgrade and it doesn't operate on targets, but on search terms given as regexps. Search already prints its results, so specifying --print as well seems nonsensical. Still, it could be nice if --print-format worked with other operations.
You never properly explained EXACTLY what you wanted to do ("my ultimate goal"). From the use of <package> instead of <search term> in the examples, we could have deduced that you didn't actually want to do a search operation with regexps, but you're making a big fuss over how things should be clearly spelled out.
The man page could maybe be a little clearer, but I think it's good enough. You first have to work out that pacman is a bit unusual though, compared to other package managers or other commands with operations/subcommands (like git/btrfs/...). There's the syntax (operations given as flags), but also consider this: -S by itself is an operation. Some flags only change some aspects of this operation a bit, but others turn it into a completely different operation. Looking at -Ss/-Qs and -Si/-Qi, you could say the operation is actually search/info and there's a required flag (-S/-Q) to specify which db to query. Because the db is different, there are small differences in the output and as you extend this way of looking at (sub)operations to -g and -l, the differences become more pronounced.
Offline
I understand the frustration, but there is no need to resort to name calling. As this has been marked as solved, I'm going to close the topic before it becomes any more heated.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Pages: 1
Topic closed