On July 26, 2022 1:48:24 PM GMT+02:00, Alexis <flexibe...@gmail.com> wrote:
>
>Chris Narkiewicz <he...@ezaquarii.com> writes:
>
>> Is it possible to match command arguments against an expression in
>> doas.conf?
>>
>> I'd like to allow user to run wsconsctl display.brightness=<0-100> and
>> the only solution i found so far is to explicitly put all values in
>> doas.conf.
>
>Since no-one has yet offered any better suggestions: perhaps you could write a
>wrapper script that can be called without arguments, and instead takes the
>brightness value from stdin? E.g. something like:
>
>$ echo 50 | doas /usr/local/bin/my-wrapper
>
>where my-wrapper is something like:
>
> #!/bin/ksh
>
> IFS=
> read -u VAL
> wsconsctl display.brightness=${VAL}
>
>(Obviously the script should check that VAL is an appropriate value.)
Better yet, the wrapper could be allowed with no argument restrictions and just
do
wsconsctl "display.brightness=$1"
or even (maybe; untested)
wsconsctl "display.brightness${1%%[!+-]*}=${1#[+-]}"
for moar fanziness.
/Alexander
>
>
>Alexis.
>