aboutsummaryrefslogtreecommitdiffstats
path: root/cli/context.go
diff options
context:
space:
mode:
authorPetter Rasmussen2016-01-18 22:17:50 +0100
committerPetter Rasmussen2016-01-18 22:17:50 +0100
commit2be43fe18545ba6c35ee344b9880d48a18afe878 (patch)
treeefa21a89daa54ba3e6ae1027a629b3d3a3fd83f4 /cli/context.go
parent4f4152ccf32acbd392c7d80e45834ca1f3ea2d62 (diff)
downloadgdrive-2be43fe18545ba6c35ee344b9880d48a18afe878.tar.bz2
Store captured values as interface{} and type cast
Diffstat (limited to 'cli/context.go')
-rw-r--r--cli/context.go16
1 files changed, 4 insertions, 12 deletions
diff --git a/cli/context.go b/cli/context.go
index b1037b0..ab40c87 100644
--- a/cli/context.go
+++ b/cli/context.go
@@ -1,8 +1,5 @@
package cli
-import (
- "strconv"
-)
type Context struct {
args Arguments
@@ -21,21 +18,16 @@ func (self Context) FilterHandlers(prefix string) []*Handler {
return filterHandlers(self.handlers, prefix)
}
-type Arguments map[string]string
+type Arguments map[string]interface{}
func (self Arguments) String(key string) string {
- value, _ := self[key]
- return value
+ return self[key].(string)
}
func (self Arguments) Int64(key string) int64 {
- value, _ := self[key]
- n, _ := strconv.ParseInt(value, 10, 64)
- return n
+ return self[key].(int64)
}
func (self Arguments) Bool(key string) bool {
- value, _ := self[key]
- b, _ := strconv.ParseBool(value)
- return b
+ return self[key].(bool)
}