diff --git a/.gitignore b/.gitignore index 7c57153..900b34b 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json # Finder (MacOS) folder config .DS_Store +kernel diff --git a/cmd/proxies/list.go b/cmd/proxies/list.go index 616c49d..782dfc1 100644 --- a/cmd/proxies/list.go +++ b/cmd/proxies/list.go @@ -26,7 +26,7 @@ func (p ProxyCmd) List(ctx context.Context) error { // Prepare table data tableData := pterm.TableData{ - {"ID", "Name", "Type", "Config"}, + {"ID", "Name", "Type", "Config", "Status", "Last Checked"}, } for _, proxy := range *items { @@ -38,11 +38,26 @@ func (p ProxyCmd) List(ctx context.Context) error { // Format config based on type configStr := formatProxyConfig(&proxy) + // Format status with color + status := string(proxy.Status) + if status == "" { + status = "-" + } else if status == "available" { + status = pterm.Green(status) + } else if status == "unavailable" { + status = pterm.Red(status) + } + + // Format last checked timestamp + lastChecked := util.FormatLocal(proxy.LastChecked) + tableData = append(tableData, []string{ proxy.ID, name, string(proxy.Type), configStr, + status, + lastChecked, }) } diff --git a/go.mod b/go.mod index 3997442..8341324 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/charmbracelet/fang v0.2.0 github.com/golang-jwt/jwt/v5 v5.2.2 github.com/joho/godotenv v1.5.1 - github.com/onkernel/kernel-go-sdk v0.11.5 + github.com/onkernel/kernel-go-sdk v0.13.0 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c github.com/pterm/pterm v0.12.80 github.com/samber/lo v1.51.0 diff --git a/go.sum b/go.sum index 21539b0..67eb935 100644 --- a/go.sum +++ b/go.sum @@ -91,8 +91,8 @@ github.com/muesli/mango-pflag v0.1.0 h1:UADqbYgpUyRoBja3g6LUL+3LErjpsOwaC9ywvBWe github.com/muesli/mango-pflag v0.1.0/go.mod h1:YEQomTxaCUp8PrbhFh10UfbhbQrM/xJ4i2PB8VTLLW0= github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8= github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig= -github.com/onkernel/kernel-go-sdk v0.11.5 h1:LApX5A/Ful62LwNTW+srhi/3cx3W04pzgZ361PlDEAc= -github.com/onkernel/kernel-go-sdk v0.11.5/go.mod h1:MjUR92i8UPqjrmneyVykae6GuB3GGSmnQtnjf1v74Dc= +github.com/onkernel/kernel-go-sdk v0.13.0 h1:yxXE8I7Blze7d5oyeyvKWna088o1mFPIAyK+rjmhw3g= +github.com/onkernel/kernel-go-sdk v0.13.0/go.mod h1:MjUR92i8UPqjrmneyVykae6GuB3GGSmnQtnjf1v74Dc= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=