manjaro / pacman-mirrors

This repo has been archived. Our code is now hosted at
https://gitlab.manjaro.org
GNU General Public License v3.0
25 stars 16 forks source link

Unknown flag is not treated as uknown #124

Closed petsam closed 6 years ago

petsam commented 6 years ago

Running pacman-mirrors -G the script updated mirrors in /etc/pacman.d/mirrorlist

$ sudo pacman-mirrors -G
.: INFO Downloading mirrors from repo.manjaro.org
.: INFO Using custom mirror file
.: INFO Querying mirrors - This may take some time
   0.398 Bulgaria       : http://manjaro.telecoms.bg/
   0.530 Bulgaria       : https://mirrors.netix.net/manjaro/
   0.626 Denmark        : https://www.uex.dk/public/manjaro/
   0.248 France         : http://kibo.remi.lu/
   0.500 France         : https://fr.mirror.babylon.network/manjaro/
   0.264 Germany        : http://mirror.ragenetwork.de/manjaro/
   0.471 Germany        : https://mirror.alpix.eu/manjaro/
   0.904 Germany        : https://mirror.netzspielplatz.de/manjaro/packages/
   0.516 Netherlands    : https://nl.mirror.babylon.network/manjaro/
   0.269 United_Kingdom : http://manjaro.mirrors.uk2.net/
   0.286 United_Kingdom : http://mirror.catn.com/pub/manjaro/
   0.462 United_Kingdom : https://www.mirrorservice.org/sites/repo.manjaro.org/repos/
   0.968 United_Kingdom : http://repo.manjaro.org.uk/
   0.935 United_States  : https://mirror.math.princeton.edu/pub/manjaro/
.: INFO Writing mirror list
   France          : http://kibo.remi.lu/testing/$repo/$arch
   Germany         : http://mirror.ragenetwork.de/manjaro/testing/$repo/$arch
   United_Kingdom  : http://manjaro.mirrors.uk2.net/testing/$repo/$arch
   United_Kingdom  : http://mirror.catn.com/pub/manjaro/testing/$repo/$arch
   Bulgaria        : http://manjaro.telecoms.bg/testing/$repo/$arch
   United_Kingdom  : https://www.mirrorservice.org/sites/repo.manjaro.org/repos/testing/$repo/$arch
   Germany         : https://mirror.alpix.eu/manjaro/testing/$repo/$arch
   France          : https://fr.mirror.babylon.network/manjaro/testing/$repo/$arch
   Netherlands     : https://nl.mirror.babylon.network/manjaro/testing/$repo/$arch
   Bulgaria        : https://mirrors.netix.net/manjaro/testing/$repo/$arch
   Denmark         : https://www.uex.dk/public/manjaro/testing/$repo/$arch
   Germany         : https://mirror.netzspielplatz.de/manjaro/packages/testing/$repo/$arch
   United_States   : https://mirror.math.princeton.edu/pub/manjaro/testing/$repo/$arch
   United_Kingdom  : http://repo.manjaro.org.uk/testing/$repo/$arch
.: INFO Mirror list generated and saved to: /etc/pacman.d/mirrorlist
.: INFO To remove custom config run  'sudo pacman-mirrors -c all'

Expected behavior should be an info/error message about uknown flag. I did not want my mirrorlist affected, since I manually handle it.

fhdk commented 6 years ago

-G is not an unknown argument/flag - it is an API argument and as such it does not work if -a/--api is missing.

It is documented in https://github.com/manjaro/pacman-mirrors/blob/master/docs/index.md in GENERAL INFO ABOUT ARGUMENTS section

Some arguments requires another argument present to have effect.

and

API specific arguments. For those to have effect the -a/--api argument must be present.

and in the API section

-G, --get-branch : Return branch from configuration.

petsam commented 6 years ago

The expected behavior would be to… what in your opinion? If the script understands the args, do a refresh mirrors action? Is this at least documented?

Please, don't close the issues before at least get some more response. It is not nice.

fhdk commented 6 years ago

Since the subject of the issue is claiming the -G argument is unknown and undocumented then the issue is not an issue and can be closed when the solution is presented.

We do not need a lengthy debate whether it is documented or not since it is, and the behavior is expected.

Also have look at issue #126 and issue #125

fhdk commented 6 years ago

Duplicate - see #125

petsam commented 6 years ago

From man pacman-mirrrors

  > If no arguments are given pacman-mirrors lists available options.

Which you say it is not exactly right.

Normal behavior when one or more arguments is present is to parse the arguments and - unless --no-mirrorlist is specified - to create a mirror list.

I thought feedback was welcome. Sorry. Have a nice flight.

fhdk commented 6 years ago

If no arguments are given pacman-mirrors lists available options.

But an argument is given -G

And feedback are welcome.

petsam commented 6 years ago

But an argument is given -G

that is not handled correctly. This is an issue, whether you close the issue, or not.

I have read half the code to understand as I can and very well read man page and help. I have used the script and decided to not use it unless for testing. Well done! There are no open issues on pacman-mirrors. That's a great achievment!

fhdk commented 6 years ago

https://github.com/manjaro/pacman-mirrors/commit/5eda817fbc7362a30bf23b1913eaa78944b14ba7