Re: [PATCH cygutils 1/1] cygstart: add 'runas' as option to elevate privileges like UAC
"Vadim \(vadcx\) via Cygwin-apps" <[email protected]>
| Newsgroups | gmane.os.cygwin.applications |
|---|---|
| Message-ID | <[email protected]> |
On 8/8/25 10:51, Mark Geisert wrote:
>> + {"runas", 'r', POPT_ARG_NONE, NULL, 'r',
>> + "Short for: --action runas", NULL},
>
> I understand you're adding a new action selected by arg 'r'...
>
>> {NULL, '\0', 0, NULL, 0, NULL, NULL}
>> };
>> @@ -223,7 +226,7 @@ main (int argc, const char **argv)
>> "Display version information", NULL},
>> {"license", '\0', POPT_ARG_NONE, NULL, 'l',
>> "Display licensing information", NULL},
>> - {"reference", '\0', POPT_ARG_NONE, NULL, 'r',
>> + {"reference", '\0', POPT_ARG_NONE, NULL, 'W',
>> "Open MSDN reference for ShellExecute", NULL},
>
> ... and changing existing action 'r' to 'W'. But the string "reference"
> needs to be changed to something starting with 'W' then. Did you have a
> word in mind when choosing 'W' as the new action?
>
> Alternatively, is there a word+action that better indicates what that
> command does? Granted, it's a pretty obscure and complicated thing to
> reduce down to one word.
Correct, -r should invoke "runas". As far as I can tell after inspecting
these opt structs, this 5th argument (last letter on the line) is only
used to fetch the option in code. The usable short-hand argument is 2nd
(empty here).
So to avoid changing the current --reference option, I decided to rename
the internal letter to "W" as in "Web (reference)", but keep the
long-name. I found it would create less confusion than instead having
option -r not correspond to internal code 'r'. The letter 'M' is taken
by --maximize too.
In the end, it's just an unfortunate letter collision (I hope my
understanding is correct) and one has to give way or rename --reference
entirely (to --web ?). Giving "--action=runas" a different letter than
'r' would make a really awful mnemonic in my opinion.
Cheers,
Vadim