Bug 205849

Summary: popt should support required options
Product: [Fedora] Fedora Reporter: Ben <bench>
Component: poptAssignee: Robert Scheck <redhat-bugzilla>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: medium    
Version: rawhideCC: pmatilai
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.12-3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-08-23 23:17:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 249352    
Bug Blocks:    

Description Ben 2006-09-08 23:44:18 UTC
maybe I'm missing something, but it doesn't seem that there's any way to mark an
entry in popt's option table as required. I can certainly error out if it's not
specified, but it would be nice if the auto-generated help could mark it as
required. As it is right now, all options are marked as optional in the
auto-generated help (dennoted by [], as opposed to <> for required).

Comment 1 Jeff Johnson 2006-09-12 00:09:54 UTC
What exactly are you asking for? It appears you want to see <...>
rather than [...] in --help output, but I have no idea what output
you are looking at.

Can you supply an example?

NEEDINFO

Comment 2 Ben 2006-09-12 02:05:01 UTC
woops, sorry. An example for, say, cp, might be:

cp [-p] [-r] <src [src2 [src3]]> <dst>

Basically, somehow denote that -p, -r, src2, and src3 are all optional options,
but that src and dst are required "options". If I'm not seeing something, or if
there's another way to denote that optional vs. required info, then please clue
me in.

Comment 3 Jeff Johnson 2006-09-12 14:34:32 UTC
popt provides 2 means to display help automagically, a short form with --usage,
and a long form with --help.

Unfortunately, there ios no means currently to mark an option as required, so there's
no easy way to use <...> instead of [...] displaying options. The short form display
with --usage is different than your example as well.

You could choose to add "REQUIRED" string to the long description displayed with --help.

I'll take a look this weekend at the feasibility of adding a POPT_ARGFLAG_REQURED marker
so that the output display might use <...> and [...] somewhen.

But please note that there are so many older versions of popt floating around that
you're unlikely to see the change soon (assuming that I'm successful).

Comment 4 Red Hat Bugzilla 2007-08-21 05:25:40 UTC
User pnasrat's account has been closed

Comment 5 Panu Matilainen 2007-08-22 06:29:58 UTC
Reassigning to owner after bugzilla made a mess, sorry about the noise...

Comment 6 Robert Scheck 2007-08-23 23:17:26 UTC
IMHO this problem is solved in 1.12-3, which should reach Rawhide soon. If not, 
please reopen this bug report.