@@ -11,7 +11,9 @@ import (
1111
1212 "github.com/drycc/controller-sdk-go/api"
1313 "github.com/drycc/controller-sdk-go/apps"
14+ "github.com/drycc/controller-sdk-go/appsettings"
1415 "github.com/drycc/controller-sdk-go/domains"
16+ "github.com/drycc/controller-sdk-go/ps"
1517 "github.com/drycc/workflow-cli/pkg/git"
1618 "github.com/drycc/workflow-cli/pkg/logging"
1719 "github.com/drycc/workflow-cli/pkg/webbrowser"
@@ -75,11 +77,20 @@ func (d *DryccCmd) AppsList(results int) error {
7577 if d .checkAPICompatibility (s .Client , err ) != nil {
7678 return err
7779 }
78-
79- d .Printf ("=== Apps%s" , limitCount (len (apps ), count ))
80-
81- for _ , app := range apps {
82- d .Println (app .ID )
80+ if count > 0 {
81+ table := d .getDefaultFormatTable ([]string {"ID" , "UUID" , "OWNER" , "CREATED" , "UPDATED" })
82+ for _ , app := range apps {
83+ table .Append ([]string {
84+ app .ID ,
85+ app .UUID ,
86+ app .Owner ,
87+ app .Created ,
88+ app .Updated ,
89+ })
90+ }
91+ table .Render ()
92+ } else {
93+ d .Println ("No apps found." )
8394 }
8495 return nil
8596}
@@ -102,38 +113,71 @@ func (d *DryccCmd) AppInfo(appID string) error {
102113 return err
103114 }
104115
105- if url == "" {
106- url = fmt .Sprintf (noDomainAssignedMsg , appID )
107- }
108-
109- d .Printf ("=== %s Application\n " , app .ID )
110- d .Println ("updated: " , app .Updated )
111- d .Println ("uuid: " , app .UUID )
112- d .Println ("created: " , app .Created )
113- d .Println ("url: " , url )
114- d .Println ("owner: " , app .Owner )
115- d .Println ("id: " , app .ID )
116+ table := d .getDefaultFormatTable ([]string {})
117+ table .Append ([]string {"App:" , app .ID })
118+ table .Append ([]string {"URL:" , url })
119+ table .Append ([]string {"UUID:" , app .UUID })
120+ table .Append ([]string {"Owner:" , app .Owner })
121+ table .Append ([]string {"Created:" , app .Created })
122+ table .Append ([]string {"Updated:" , app .Updated })
116123
117- d .Println ()
118124 // print the app processes
119- if err = d .PsList (app .ID , defaultLimit ); err != nil {
125+ processes , _ , err := ps .List (s .Client , appID , defaultLimit )
126+ if d .checkAPICompatibility (s .Client , err ) != nil {
120127 return err
121128 }
122129
123- d .Println ()
124- // print the app domains
125- if err = d .DomainsList (app .ID , defaultLimit ); err != nil {
126- return err
130+ if len (processes ) > 0 {
131+ table .Append ([]string {"Processes:" })
132+ for index , process := range processes {
133+ table .Append ([]string {"" , "Name:" , process .Name })
134+ table .Append ([]string {"" , "Release:" , process .Release })
135+ table .Append ([]string {"" , "State:" , process .State })
136+ table .Append ([]string {"" , "Type:" , process .Type })
137+ table .Append ([]string {"" , "Started:" , process .Started .Format ("2006-01-02T15:04:05MST" )})
138+ if len (processes ) > index + 1 {
139+ table .Append ([]string {"" })
140+ }
141+ }
142+ } else {
143+ table .Append ([]string {"Processes:" , safeGetString ("" )})
127144 }
128145
129- d .Println ()
130- // print the app labels
131- if err = d .LabelsList (app .ID ); err != nil {
146+ domains , _ , err := domains .List (s .Client , appID , defaultLimit )
147+ if d .checkAPICompatibility (s .Client , err ) != nil {
132148 return err
133149 }
150+ if len (domains ) > 0 {
151+ table .Append ([]string {"Domains:" })
152+ for index , domain := range domains {
153+ table .Append ([]string {"" , "Domain:" , domain .Domain })
154+ table .Append ([]string {"" , "Created:" , domain .Created })
155+ table .Append ([]string {"" , "Updated:" , domain .Updated })
156+ if len (domains ) > index + 1 {
157+ table .Append ([]string {"" })
158+ }
159+ }
160+ } else {
161+ table .Append ([]string {"Domains:" , safeGetString ("" )})
162+ }
134163
135- d .Println ()
136-
164+ appSettings , err := appsettings .List (s .Client , appID )
165+ if d .checkAPICompatibility (s .Client , err ) != nil {
166+ return err
167+ }
168+ if len (appSettings .Label ) > 0 {
169+ table .Append ([]string {"Labels:" })
170+ for index , label := range * sortKeys (appSettings .Label ) {
171+ table .Append ([]string {"" , "Key:" , label })
172+ table .Append ([]string {"" , "Value:" , fmt .Sprintf ("%v" , appSettings .Label [label ])})
173+ if len (appSettings .Label ) > index + 1 {
174+ table .Append ([]string {"" })
175+ }
176+ }
177+ } else {
178+ table .Append ([]string {"Labels:" , safeGetString ("" )})
179+ }
180+ table .Render ()
137181 return nil
138182}
139183
@@ -306,7 +350,7 @@ func (d *DryccCmd) AppTransfer(appID, username string) error {
306350 return nil
307351}
308352
309- const noDomainAssignedMsg = "No domain assigned to %s"
353+ const noDomainAssignedMsg = "no domain assigned to %s"
310354
311355// appURL grabs the first domain an app has and returns this.
312356func (d * DryccCmd ) appURL (s * settings.Settings , appID string ) (string , error ) {
0 commit comments