Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
ad863046
Commit
ad863046
authored
Oct 24, 2008
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- set initial value in flag variable if provided
R=r DELTA=10 (9 added, 0 deleted, 1 changed) OCL=17806 CL=17812
parent
cec64a2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
src/lib/flag.go
src/lib/flag.go
+10
-1
No files found.
src/lib/flag.go
View file @
ad863046
...
...
@@ -111,6 +111,9 @@ type BoolValue struct {
}
func
NewBoolValue
(
val
bool
,
p
*
bool
)
*
BoolValue
{
if
p
!=
nil
{
*
p
=
val
}
return
&
BoolValue
{
val
,
p
}
}
...
...
@@ -164,6 +167,9 @@ type IntValue struct {
}
func
NewIntValue
(
val
int64
,
p
*
int64
)
*
IntValue
{
if
p
!=
nil
{
*
p
=
val
}
return
&
IntValue
{
val
,
p
}
}
...
...
@@ -214,6 +220,9 @@ type StringValue struct {
}
func
NewStringValue
(
val
string
,
p
*
string
)
*
StringValue
{
if
p
!=
nil
{
*
p
=
val
}
return
&
StringValue
{
val
,
p
}
}
...
...
@@ -397,7 +406,7 @@ func (f *Flags) ParseOne(index int) (ok bool, next int)
}
}
name
:=
s
[
num_minuses
:
len
(
s
)];
if
len
(
name
)
==
0
||
name
[
0
]
==
'-'
||
name
[
0
]
==
'='
{
if
len
(
name
)
==
0
||
name
[
0
]
==
'-'
||
name
[
0
]
==
'='
{
print
(
"bad flag syntax: "
,
s
,
"
\n
"
);
Usage
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment