andrewgregory / pacutils

Helper library for libalpm based programs.
MIT License
107 stars 17 forks source link

pacini: empty output when specifying directives without "-" and stdin input #41

Closed AladW closed 2 years ago

AladW commented 3 years ago

According to pacini(1):

If file is omitted or "-" the configuration will be read from stdin.

However, if file is omitted I do not get any output:

$ pacconf | pacini --section=custom SigLevel
$ pacconf | pacini --section=custom - SigLevel
PackageOptional
PackageTrustAll
DatabaseOptional
DatabaseTrustAll

If no directive is specified, both - and leaving out file behave the same:

$ pacconf --repo=custom | pacini
Usage = All
SigLevel = PackageOptional
SigLevel = PackageTrustAll
SigLevel = DatabaseOptional
SigLevel = DatabaseTrustAll
Server = file:///home/custompkgs

$ pacconf --repo=custom | pacini -
Usage = All
SigLevel = PackageOptional
SigLevel = PackageTrustAll
SigLevel = DatabaseOptional
SigLevel = DatabaseTrustAll
Server = file:///home/custompkgs

Version: pacutils-git 0.10.0.13.gb3cbcbf-1

andrewgregory commented 2 years ago

File is required if a directive is provided, otherwise there's no way to tell a directive from a file name. The syntax diagram in the man page indicates this correctly, but the --help output needs to be fixed and there should be an error message there.