mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-29 18:33:05 +00:00
Better table in namespaces
This commit is contained in:
parent
36f5f78f46
commit
350f7da55d
1 changed files with 6 additions and 2 deletions
|
@ -3,8 +3,10 @@ package cli
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pterm/pterm"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -94,9 +96,11 @@ var listNamespacesCmd = &cobra.Command{
|
|||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("ID\tName\n")
|
||||
|
||||
d := pterm.TableData{{"ID", "Name", "Created"}}
|
||||
for _, n := range *namespaces {
|
||||
fmt.Printf("%d\t%s\n", n.ID, n.Name)
|
||||
d = append(d, []string{strconv.FormatUint(uint64(n.ID), 10), n.Name, n.CreatedAt.Format("2006-01-02 15:04:05")})
|
||||
}
|
||||
pterm.DefaultTable.WithHasHeader().WithData(d).Render()
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue