Add gocage list snapshot myjail

This commit is contained in:
yo
2022-04-03 14:27:26 +02:00
parent 285229009f
commit 910be4ea31
4 changed files with 511 additions and 335 deletions

View File

@ -14,6 +14,7 @@ import (
/********************************************************************************
* List all properties a jail have, with their internal name
* Only print properties name. To get name & values, use GetJailProperties()
*******************************************************************************/
func ListJailsProps(args []string) {
var conf Jail
@ -98,7 +99,7 @@ func ListJails(args []string, display bool) {
/ We support 3 sort criteria max
/**************************************************************/
if len(gSortFields) > 0 && gSortFields != "none" {
js := initSortStruct()
js := initJailSortStruct()
// The way we manage criteria quantity is not very elegant...
var fct1, fct2, fct3 *reflect.Value
@ -126,11 +127,11 @@ func ListJails(args []string, display bool) {
switch len(strings.Split(gSortFields, ",")) {
case 1:
OrderedBy(fct1.Interface().(lessFunc)).Sort(jails)
JailsOrderedBy(fct1.Interface().(jailLessFunc)).Sort(jails)
case 2:
OrderedBy(fct1.Interface().(lessFunc), fct2.Interface().(lessFunc)).Sort(jails)
JailsOrderedBy(fct1.Interface().(jailLessFunc), fct2.Interface().(jailLessFunc)).Sort(jails)
case 3:
OrderedBy(fct1.Interface().(lessFunc), fct2.Interface().(lessFunc), fct3.Interface().(lessFunc)).Sort(jails)
JailsOrderedBy(fct1.Interface().(jailLessFunc), fct2.Interface().(jailLessFunc), fct3.Interface().(jailLessFunc)).Sort(jails)
}
}