|
|
@ -33,55 +33,6 @@ gogs web`, |
|
|
|
Flags: []cli.Flag{}, |
|
|
|
Flags: []cli.Flag{}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Subtract(left interface{}, right interface{}) interface{} { |
|
|
|
|
|
|
|
var rleft, rright int64 |
|
|
|
|
|
|
|
var fleft, fright float64 |
|
|
|
|
|
|
|
var isInt bool = true |
|
|
|
|
|
|
|
switch left.(type) { |
|
|
|
|
|
|
|
case int: |
|
|
|
|
|
|
|
rleft = int64(left.(int)) |
|
|
|
|
|
|
|
case int8: |
|
|
|
|
|
|
|
rleft = int64(left.(int8)) |
|
|
|
|
|
|
|
case int16: |
|
|
|
|
|
|
|
rleft = int64(left.(int16)) |
|
|
|
|
|
|
|
case int32: |
|
|
|
|
|
|
|
rleft = int64(left.(int32)) |
|
|
|
|
|
|
|
case int64: |
|
|
|
|
|
|
|
rleft = left.(int64) |
|
|
|
|
|
|
|
case float32: |
|
|
|
|
|
|
|
fleft = float64(left.(float32)) |
|
|
|
|
|
|
|
isInt = false |
|
|
|
|
|
|
|
case float64: |
|
|
|
|
|
|
|
fleft = left.(float64) |
|
|
|
|
|
|
|
isInt = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch right.(type) { |
|
|
|
|
|
|
|
case int: |
|
|
|
|
|
|
|
rright = int64(right.(int)) |
|
|
|
|
|
|
|
case int8: |
|
|
|
|
|
|
|
rright = int64(right.(int8)) |
|
|
|
|
|
|
|
case int16: |
|
|
|
|
|
|
|
rright = int64(right.(int16)) |
|
|
|
|
|
|
|
case int32: |
|
|
|
|
|
|
|
rright = int64(right.(int32)) |
|
|
|
|
|
|
|
case int64: |
|
|
|
|
|
|
|
rright = right.(int64) |
|
|
|
|
|
|
|
case float32: |
|
|
|
|
|
|
|
fright = float64(left.(float32)) |
|
|
|
|
|
|
|
isInt = false |
|
|
|
|
|
|
|
case float64: |
|
|
|
|
|
|
|
fleft = left.(float64) |
|
|
|
|
|
|
|
isInt = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if isInt { |
|
|
|
|
|
|
|
return rleft - rright |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return fleft + float64(rleft) - (fright + float64(rright)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AppHelpers template.FuncMap = map[string]interface{}{ |
|
|
|
var AppHelpers template.FuncMap = map[string]interface{}{ |
|
|
|
"AppName": func() string { |
|
|
|
"AppName": func() string { |
|
|
|
return base.Cfg.MustValue("", "APP_NAME") |
|
|
|
return base.Cfg.MustValue("", "APP_NAME") |
|
|
@ -90,7 +41,7 @@ var AppHelpers template.FuncMap = map[string]interface{}{ |
|
|
|
return APP_VER |
|
|
|
return APP_VER |
|
|
|
}, |
|
|
|
}, |
|
|
|
"TimeSince": base.TimeSince, |
|
|
|
"TimeSince": base.TimeSince, |
|
|
|
"Subtract": Subtract, |
|
|
|
"Subtract": base.Subtract, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func runWeb(*cli.Context) { |
|
|
|
func runWeb(*cli.Context) { |
|
|
|