Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
a17a2664
Commit
a17a2664
authored
Apr 29, 2015
by
Eric Paris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update kube to support new pflag/cobra
parent
b7217a33
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
5 deletions
+18
-5
hyperkube.go
cmd/hyperkube/hyperkube.go
+1
-1
server.go
cmd/hyperkube/server.go
+1
-1
version.go
cmd/kube-version-change/version.go
+2
-1
factory.go
pkg/kubectl/cmd/util/factory.go
+1
-1
flags.go
pkg/util/flags.go
+13
-1
No files found.
cmd/hyperkube/hyperkube.go
View file @
a17a2664
...
@@ -70,7 +70,7 @@ func (hk *HyperKube) Flags() *pflag.FlagSet {
...
@@ -70,7 +70,7 @@ func (hk *HyperKube) Flags() *pflag.FlagSet {
if
hk
.
baseFlags
==
nil
{
if
hk
.
baseFlags
==
nil
{
hk
.
baseFlags
=
pflag
.
NewFlagSet
(
hk
.
Name
,
pflag
.
ContinueOnError
)
hk
.
baseFlags
=
pflag
.
NewFlagSet
(
hk
.
Name
,
pflag
.
ContinueOnError
)
hk
.
baseFlags
.
SetOutput
(
ioutil
.
Discard
)
hk
.
baseFlags
.
SetOutput
(
ioutil
.
Discard
)
hk
.
baseFlags
.
Set
WordSeparators
([]
string
{
"-"
,
"_"
}
)
hk
.
baseFlags
.
Set
NormalizeFunc
(
util
.
WordSepNormalizeFunc
)
hk
.
baseFlags
.
BoolVarP
(
&
hk
.
helpFlagVal
,
"help"
,
"h"
,
false
,
"help for "
+
hk
.
Name
)
hk
.
baseFlags
.
BoolVarP
(
&
hk
.
helpFlagVal
,
"help"
,
"h"
,
false
,
"help for "
+
hk
.
Name
)
// These will add all of the "global" flags (defined with both the
// These will add all of the "global" flags (defined with both the
...
...
cmd/hyperkube/server.go
View file @
a17a2664
...
@@ -68,7 +68,7 @@ func (s *Server) Flags() *pflag.FlagSet {
...
@@ -68,7 +68,7 @@ func (s *Server) Flags() *pflag.FlagSet {
if
s
.
flags
==
nil
{
if
s
.
flags
==
nil
{
s
.
flags
=
pflag
.
NewFlagSet
(
s
.
Name
(),
pflag
.
ContinueOnError
)
s
.
flags
=
pflag
.
NewFlagSet
(
s
.
Name
(),
pflag
.
ContinueOnError
)
s
.
flags
.
SetOutput
(
ioutil
.
Discard
)
s
.
flags
.
SetOutput
(
ioutil
.
Discard
)
s
.
flags
.
Set
WordSeparators
([]
string
{
"-"
,
"_"
}
)
s
.
flags
.
Set
NormalizeFunc
(
util
.
WordSepNormalizeFunc
)
}
}
return
s
.
flags
return
s
.
flags
}
}
cmd/kube-version-change/version.go
View file @
a17a2664
...
@@ -31,6 +31,7 @@ import (
...
@@ -31,6 +31,7 @@ import (
_
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1"
_
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1"
_
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta2"
_
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta2"
_
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta3"
_
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta3"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/ghodss/yaml"
"github.com/ghodss/yaml"
flag
"github.com/spf13/pflag"
flag
"github.com/spf13/pflag"
...
@@ -55,7 +56,7 @@ func isYAML(data []byte) bool {
...
@@ -55,7 +56,7 @@ func isYAML(data []byte) bool {
func
main
()
{
func
main
()
{
runtime
.
GOMAXPROCS
(
runtime
.
NumCPU
())
runtime
.
GOMAXPROCS
(
runtime
.
NumCPU
())
flag
.
CommandLine
.
Set
WordSeparators
([]
string
{
"-"
,
"_"
}
)
flag
.
CommandLine
.
Set
NormalizeFunc
(
util
.
WordSepNormalizeFunc
)
flag
.
Parse
()
flag
.
Parse
()
if
*
rewrite
!=
""
{
if
*
rewrite
!=
""
{
...
...
pkg/kubectl/cmd/util/factory.go
View file @
a17a2664
...
@@ -86,7 +86,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
...
@@ -86,7 +86,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
mapper
:=
kubectl
.
ShortcutExpander
{
latest
.
RESTMapper
}
mapper
:=
kubectl
.
ShortcutExpander
{
latest
.
RESTMapper
}
flags
:=
pflag
.
NewFlagSet
(
""
,
pflag
.
ContinueOnError
)
flags
:=
pflag
.
NewFlagSet
(
""
,
pflag
.
ContinueOnError
)
flags
.
Set
WordSeparators
([]
string
{
"-"
,
"_"
}
)
flags
.
Set
NormalizeFunc
(
util
.
WordSepNormalizeFunc
)
clientConfig
:=
optionalClientConfig
clientConfig
:=
optionalClientConfig
if
optionalClientConfig
==
nil
{
if
optionalClientConfig
==
nil
{
...
...
pkg/util/flags.go
View file @
a17a2664
...
@@ -16,11 +16,23 @@ limitations under the License.
...
@@ -16,11 +16,23 @@ limitations under the License.
package
util
package
util
import
"strings"
import
"github.com/spf13/pflag"
import
"github.com/spf13/pflag"
func
WordSepNormalizeFunc
(
f
*
pflag
.
FlagSet
,
name
string
)
pflag
.
NormalizedName
{
from
:=
[]
string
{
"-"
,
"_"
}
to
:=
"."
for
_
,
sep
:=
range
from
{
name
=
strings
.
Replace
(
name
,
sep
,
to
,
-
1
)
}
// Type convert to indicate normalization has been done.
return
pflag
.
NormalizedName
(
name
)
}
// InitFlags normalizes and parses the command line flags
// InitFlags normalizes and parses the command line flags
func
InitFlags
()
{
func
InitFlags
()
{
pflag
.
CommandLine
.
Set
WordSeparators
([]
string
{
"-"
,
"_"
}
)
pflag
.
CommandLine
.
Set
NormalizeFunc
(
WordSepNormalizeFunc
)
AddAllFlagsToPFlags
()
AddAllFlagsToPFlags
()
pflag
.
Parse
()
pflag
.
Parse
()
}
}
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