Re: Where is port command documented?
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$'
Re: Where is port command documented?
On Mon, Nov 14, 2022 at 09:14:26AM +, Lukas Oberhuber wrote: > 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. It does exist, but it won't help you in this case, since the command will just fail. If you want to remove both, use port -N uninstall installed and gimp3 You can replace 'installed' with 'inactive' if you want to only uninstall the inactive version. If you run the port(1) command but its stdout or stdin are not connected to a terminal, you get non-interactive mode (-N) by default. > 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. The manpages are also available online, e.g., at https://man.macports.org/port.1.html > 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 general rule is that single-letter flags go after 'port' and everything else goes the command. HTH, Clemens
Re: Where is port command documented?
There is documentation for port command flags in the online manual pages: man port also in Chapter 3 of the MacPorts Guide with examplese https://guide.macports.org/chunked/using.html Hope that helps. > On Nov 14, 2022, at 04:14, Lukas Oberhuber wrote: > > > Hi, > > 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. > > Thanks for your help! > > Lukas
Where is port command documented?
Hi, 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. Thanks for your help! Lukas