Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
utils
Commits
fd7c713e
Commit
fd7c713e
authored
23 years ago
by
Christian Beckmann
Browse files
Options
Downloads
Patches
Plain Diff
Added functionality to make options invisible (i.e. not appear in a
usage line)
parent
de1dff08
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
options.h
+27
-2
27 additions, 2 deletions
options.h
with
27 additions
and
2 deletions
options.h
+
27
−
2
View file @
fd7c713e
...
@@ -43,12 +43,27 @@ namespace Utilities {
...
@@ -43,12 +43,27 @@ namespace Utilities {
*/
*/
BaseOption
(
const
string
&
k
,
const
string
&
ht
,
bool
c
,
ArgFlag
f
)
:
BaseOption
(
const
string
&
k
,
const
string
&
ht
,
bool
c
,
ArgFlag
f
)
:
key_
(
k
),
help_text_
(
ht
),
arg_flag_
(
f
),
key_
(
k
),
help_text_
(
ht
),
arg_flag_
(
f
),
unset_
(
true
),
compulsory_
(
c
)
{}
unset_
(
true
),
compulsory_
(
c
),
visible_
(
true
)
{}
/**
@param k comma seperated list of key aliases
@param ht the help text to be printed for this option
@param c if true then this option is compulsory
@param f one of no_argument, requires_argument, optional_argument
@param v true or false -- display the option in usage
to indicate what arguments should be supplied
*/
BaseOption
(
const
string
&
k
,
const
string
&
ht
,
bool
c
,
ArgFlag
f
,
bool
v
)
:
key_
(
k
),
help_text_
(
ht
),
arg_flag_
(
f
),
unset_
(
true
),
compulsory_
(
c
),
visible_
(
v
)
{}
/**
/**
@return true if the option is compulsory
@return true if the option is compulsory
*/
*/
bool
compulsory
()
{
return
compulsory_
;
}
bool
compulsory
()
{
return
compulsory_
;
}
/**
@return true if the option should be visible
*/
bool
visible
()
{
return
visible_
;
}
/**
/**
@return true if the option requires an argument
@return true if the option requires an argument
*/
*/
...
@@ -97,7 +112,7 @@ namespace Utilities {
...
@@ -97,7 +112,7 @@ namespace Utilities {
ArgFlag
arg_flag_
;
ArgFlag
arg_flag_
;
protected
:
protected
:
bool
unset_
,
compulsory_
;
bool
unset_
,
compulsory_
,
visible_
;
};
};
ostream
&
operator
<<
(
ostream
&
os
,
const
BaseOption
&
o
);
ostream
&
operator
<<
(
ostream
&
os
,
const
BaseOption
&
o
);
...
@@ -122,6 +137,16 @@ namespace Utilities {
...
@@ -122,6 +137,16 @@ namespace Utilities {
Option
(
const
string
&
k
,
const
T
&
v
,
const
string
&
ht
,
Option
(
const
string
&
k
,
const
T
&
v
,
const
string
&
ht
,
bool
c
,
ArgFlag
f
=
no_argument
)
:
bool
c
,
ArgFlag
f
=
no_argument
)
:
BaseOption
(
k
,
ht
,
c
,
f
),
default_
(
v
),
value_
(
v
)
{}
BaseOption
(
k
,
ht
,
c
,
f
),
default_
(
v
),
value_
(
v
)
{}
/**
@param k Comma seperated list of key aliases
@param v Default value for this option
@param ht Help text to be printed when outputting usage
@param c If true then this option is compulsory
@param f This options argument requirements
*/
Option
(
const
string
&
k
,
const
T
&
v
,
const
string
&
ht
,
bool
c
,
ArgFlag
f
,
bool
vis
)
:
BaseOption
(
k
,
ht
,
c
,
f
,
vis
),
default_
(
v
),
value_
(
v
)
{}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment