On Nov 14, 2022, at 03:14, Lukas Oberhuber wrote: > > I was wondering where the port command flags are documented. For example, I'm > trying to uninstall a port in a script, but when two versions of the port are > installed, it interactively asks which I want to uninstall. > > The following versions of gimp3 are currently installed: > 1) gimp3 @2.99.14_0+debugoptimized+quartz+vala > 2) gimp3 @2.99.13_1+debugoptimized+quartz+vala (active) > Enter option(s) [1-2/all]: > > This kills my script. What I can't tell is if port -N uninstall gimp3 exists, > or if that is only for port install. > > And before you say: "try it", it's on a ci system so a little harder to try, > and really, I want a way to understand all the available flags. > > And finally, there is no error message when a flag is used in the wrong > place, so that makes trial and error even harder. Example port install -N > gimp3 does not apply the flag but doesn't error.
The port(1) manpage was already mentioned, but a web version of it is also available at: https://man.macports.org/port.1.html Single-dash single-letter flags like "-N" are global and apply to all commands and go after "port" and before the command verb (e.g. "sudo port -N install foo" not "sudo port install -N foo"). Double-dash multi-letter flags are specific to the command verb and go after the command verb and before any subsequent list of ports (like "--no-sync" is specific to the "selfupdate" verb and is used as "sudo port selfupdate --no-sync" not "sudo port --no-sync selfupdate"). If you have multiple versions of a port installed and try to uninstall just by name, it prompts interactively to ask which one(s). If you turn off interactivity with "-N", the uninstall will fail since it doesn't know which one to uninstall. If you want to uninstall all installed versions of a particular port, you could use e.g. sudo port -N uninstall installed and name:'^gimp3$'