Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
6da5b2fc
Commit
6da5b2fc
authored
Apr 09, 2015
by
Bas van Kervel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reformat code with goimports
parent
5304f430
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
93 deletions
+93
-93
customflags.go
cmd/utils/customflags.go
+76
-76
customflags_test.go
cmd/utils/customflags_test.go
+17
-17
No files found.
cmd/utils/customflags.go
View file @
6da5b2fc
package
utils
package
utils
import
(
import
(
"path/filepath"
"flag"
"fmt"
"os"
"os"
"strings"
"os/user"
"os/user"
"path/filepath"
"strings"
"github.com/codegangsta/cli"
"github.com/codegangsta/cli"
"flag"
"fmt"
)
)
// Custom type which is registered in the flags library which cli uses for
// Custom type which is registered in the flags library which cli uses for
...
@@ -55,6 +57,7 @@ func eachName(longName string, fn func(string)) {
...
@@ -55,6 +57,7 @@ func eachName(longName string, fn func(string)) {
fn
(
name
)
fn
(
name
)
}
}
}
}
// called by cli library, grabs variable from environment (if in env)
// called by cli library, grabs variable from environment (if in env)
// and adds variable to flag set for parsing.
// and adds variable to flag set for parsing.
func
(
self
DirectoryFlag
)
Apply
(
set
*
flag
.
FlagSet
)
{
func
(
self
DirectoryFlag
)
Apply
(
set
*
flag
.
FlagSet
)
{
...
@@ -69,7 +72,7 @@ func (self DirectoryFlag) Apply(set *flag.FlagSet) {
...
@@ -69,7 +72,7 @@ func (self DirectoryFlag) Apply(set *flag.FlagSet) {
}
}
eachName
(
self
.
Name
,
func
(
name
string
)
{
eachName
(
self
.
Name
,
func
(
name
string
)
{
set
.
Var
(
self
.
Value
,
self
.
Name
,
"a: "
+
self
.
Usage
)
set
.
Var
(
self
.
Value
,
self
.
Name
,
"a: "
+
self
.
Usage
)
})
})
}
}
...
@@ -128,6 +131,3 @@ func expandPath(p string) string {
...
@@ -128,6 +131,3 @@ func expandPath(p string) string {
return
filepath
.
Clean
(
os
.
ExpandEnv
(
p
))
return
filepath
.
Clean
(
os
.
ExpandEnv
(
p
))
}
}
cmd/utils/customflags_test.go
View file @
6da5b2fc
package
utils
package
utils
import
(
import
(
"testing"
"os"
"os"
"os/user"
"os/user"
"testing"
)
)
func
TestPathExpansion
(
t
*
testing
.
T
)
{
func
TestPathExpansion
(
t
*
testing
.
T
)
{
user
,
_
:=
user
.
Current
()
user
,
_
:=
user
.
Current
()
tests
:=
map
[
string
]
string
{
tests
:=
map
[
string
]
string
{
"/home/someuser/tmp"
:
"/home/someuser/tmp"
,
"/home/someuser/tmp"
:
"/home/someuser/tmp"
,
"~/tmp"
:
user
.
HomeDir
+
"/tmp"
,
"~/tmp"
:
user
.
HomeDir
+
"/tmp"
,
"$DDDXXX/a/b"
:
"/tmp/a/b"
,
"$DDDXXX/a/b"
:
"/tmp/a/b"
,
...
...
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