mirror of
https://github.com/luscis/openlan.git
synced 2025-10-06 00:57:03 +08:00
Merge branch 'master' of github.com:luscis/openlan
This commit is contained in:
@@ -51,6 +51,13 @@ func OutTable(data interface{}, tmpl string) error {
|
|||||||
}
|
}
|
||||||
return fmt.Sprintf(format, args...)
|
return fmt.Sprintf(format, args...)
|
||||||
},
|
},
|
||||||
|
"pf": func(space int, decimals int, args ...interface{}) string {
|
||||||
|
format := "%" + strconv.Itoa(space) + "." + strconv.Itoa(decimals) + "f"
|
||||||
|
if space < 0 {
|
||||||
|
format = "%-" + strconv.Itoa(space) + "." + strconv.Itoa(decimals) + "f"
|
||||||
|
}
|
||||||
|
return fmt.Sprintf(format, args...)
|
||||||
|
},
|
||||||
"pt": func(value int64) string {
|
"pt": func(value int64) string {
|
||||||
return libol.PrettyTime(value)
|
return libol.PrettyTime(value)
|
||||||
},
|
},
|
||||||
|
@@ -67,9 +67,9 @@ func (qr QosRule) Remove(c *cli.Context) error {
|
|||||||
|
|
||||||
func (qr QosRule) Tmpl() string {
|
func (qr QosRule) Tmpl() string {
|
||||||
return `# total {{ len . }}
|
return `# total {{ len . }}
|
||||||
{{ps -15 "Name"}} {{ps -15 "Device"}} {{ps -15 "ip"}} {{ps -8 "InSpeed"}}
|
{{ps -28 "Name"}} {{ps -10 "Device"}} {{ps -15 "Ip"}} {{ps -8 "InSpeed"}}
|
||||||
{{- range . }}
|
{{- range . }}
|
||||||
{{ps -15 .Name}} {{ps -15 .Device}} {{ps -15 .Ip}} {{pi -8 .InSpeed}}
|
{{ps -28 .Name}} {{ps -10 .Device}} {{ps -15 .Ip}} {{pf -8 2 .InSpeed}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user