@@ -19,6 +19,7 @@ package cmd
1919import (
2020 "fmt"
2121 "strings"
22+ "time"
2223
2324 "github.com/cortexlabs/cortex/cli/cluster"
2425 "github.com/cortexlabs/cortex/cli/local"
@@ -28,10 +29,12 @@ import (
2829 "github.com/cortexlabs/cortex/pkg/lib/errors"
2930 "github.com/cortexlabs/cortex/pkg/lib/exit"
3031 libjson "github.com/cortexlabs/cortex/pkg/lib/json"
32+ "github.com/cortexlabs/cortex/pkg/lib/pointer"
3133 "github.com/cortexlabs/cortex/pkg/lib/sets/strset"
3234 s "github.com/cortexlabs/cortex/pkg/lib/strings"
3335 "github.com/cortexlabs/cortex/pkg/lib/table"
3436 "github.com/cortexlabs/cortex/pkg/lib/telemetry"
37+ libtime "github.com/cortexlabs/cortex/pkg/lib/time"
3538 "github.com/cortexlabs/cortex/pkg/operator/schema"
3639 "github.com/cortexlabs/cortex/pkg/types"
3740 "github.com/cortexlabs/cortex/pkg/types/userconfig"
@@ -63,6 +66,7 @@ func getInit() {
6366 _getCmd .Flags ().StringVarP (& _flagGetEnv , "env" , "e" , getDefaultEnv (_generalCommandType ), "environment to use" )
6467 _getCmd .Flags ().BoolVarP (& _flagWatch , "watch" , "w" , false , "re-run the command every 2 seconds" )
6568 _getCmd .Flags ().VarP (& _flagOutput , "output" , "o" , fmt .Sprintf ("output format: one of %s" , strings .Join (flags .UserOutputTypeStrings (), "|" )))
69+ addVerboseFlag (_getCmd )
6670}
6771
6872var _getCmd = & cobra.Command {
@@ -498,6 +502,23 @@ func getAPI(env cliconfig.Environment, apiName string) (string, error) {
498502 return realtimeAPITable (apiRes , env )
499503}
500504
505+ func apiHistoryTable (apiVersions []schema.APIVersion ) string {
506+ t := table.Table {
507+ Headers : []table.Header {
508+ {Title : "api id" },
509+ {Title : "last deployed" },
510+ },
511+ }
512+
513+ t .Rows = make ([][]interface {}, len (apiVersions ))
514+ for i , apiVersion := range apiVersions {
515+ lastUpdated := time .Unix (apiVersion .LastUpdated , 0 )
516+ t .Rows [i ] = []interface {}{apiVersion .APIID , libtime .SinceStr (& lastUpdated )}
517+ }
518+
519+ return t .MustFormat (& table.Opts {Sort : pointer .Bool (false )})
520+ }
521+
501522func titleStr (title string ) string {
502523 return "\n " + console .Bold (title ) + "\n "
503524}
0 commit comments