- First RPC steps - Work on some flaws in RPC model - Remove unused TLS settings from Engine and Swarm options - Add code to correctly encode data over the network - Add client driver for RPC - Rename server driver file - Start to make marshal make sense - Fix silly RPC method args and add client - Fix some issues with RPC calls, and marshaling - Simplify plugin main.go - Move towards 100% plugin in CLI - Ensure that plugin servers are cleaned up properly - Make flag parsing for driver flags work properly Includes some work carried from @dmp42 updating the build process and tests to use the new method. Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
72 lines
1.1 KiB
Go
72 lines
1.1 KiB
Go
package mcnflag
|
|
|
|
import "fmt"
|
|
|
|
type Flag interface {
|
|
fmt.Stringer
|
|
Default() interface{}
|
|
}
|
|
|
|
type StringFlag struct {
|
|
Name string
|
|
Usage string
|
|
EnvVar string
|
|
Value string
|
|
}
|
|
|
|
// TODO: Could this be done more succinctly using embedding?
|
|
func (f StringFlag) String() string {
|
|
return f.Name
|
|
}
|
|
|
|
func (f StringFlag) Default() interface{} {
|
|
return f.Value
|
|
}
|
|
|
|
type StringSliceFlag struct {
|
|
Name string
|
|
Usage string
|
|
EnvVar string
|
|
Value []string
|
|
}
|
|
|
|
// TODO: Could this be done more succinctly using embedding?
|
|
func (f StringSliceFlag) String() string {
|
|
return f.Name
|
|
}
|
|
|
|
func (f StringSliceFlag) Default() interface{} {
|
|
return f.Value
|
|
}
|
|
|
|
type IntFlag struct {
|
|
Name string
|
|
Usage string
|
|
EnvVar string
|
|
Value int
|
|
}
|
|
|
|
// TODO: Could this be done more succinctly using embedding?
|
|
func (f IntFlag) String() string {
|
|
return f.Name
|
|
}
|
|
|
|
func (f IntFlag) Default() interface{} {
|
|
return f.Value
|
|
}
|
|
|
|
type BoolFlag struct {
|
|
Name string
|
|
Usage string
|
|
EnvVar string
|
|
}
|
|
|
|
// TODO: Could this be done more succinctly using embedding?
|
|
func (f BoolFlag) String() string {
|
|
return f.Name
|
|
}
|
|
|
|
func (f BoolFlag) Default() interface{} {
|
|
return nil
|
|
}
|