icy / pacapt

An ArchLinux's pacman-like shell wrapper for many package managers. 56KB and run anywhere.
Other
958 stars 69 forks source link

dkpg -Sy accept options but displays a warning #173

Closed mondeja closed 3 years ago

mondeja commented 3 years ago

I've seen this FIXME in dpkg_Sy:

# FIXME: Should we remove "$@"?
dpkg_Sy() {
  apt-get update "$@" 
}

I can pass options after update in the apt-get command:

$ sudo apt-get update --quiet --quiet
$ echo $?
0

but trying that with pacapt displays a warning:

$ sudo ./pacapt.dev -Sy --quiet --quiet
WARNING ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  The -Sy/u options refresh and/or upgrade all packages.
  To install packages as well, use separate commands:

    ./pacapt.dev -Sy; ./pacapt.dev -S --quiet --quiet
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ echo $?
0
icy commented 3 years ago

@mondeja

This is an expected issue. Let me explain. From the original pacman, it's not recommended to use pacman -Sy foo to install some package and update package database at the same time (hence the warning).

pacapt tries to generate that warning, but it isn't smart enough to know if --quiet is a dpkg's option or package name. To avoid that problem you've facing, this line

https://github.com/icy/pacapt/blob/d51ec5ecd9f98815da4511855bd1b074cccb763e/lib/zz_main.sh#L281

must be rewritten. I don't think that's really easy. So far simply invoking pacman -Sy is the best way.

mondeja commented 3 years ago

From the original pacman, it's not recommended to use pacman -Sy foo to install some package and update package database at the same time (hence the warning).

It would be sufficient to display the warning only if all passed arguments don't start with - character? An argument like -q, -qq or --quiet it would be very strange if it were a package to install. What do you think?

icy commented 3 years ago

You're right. For --quiet I think that's possible/easy: https://github.com/icy/pacapt/pull/177/files , please have a look.

I've invited you to the project. I will do that for other contributors for a convenience purpose (PR review request, build status,...) Feel free to join, and thanks.