@@ -159,6 +159,53 @@ func (d *DryccCmd) PsRestart(appID, target string) error {
159159 return nil
160160}
161161
162+ // PsDescribe describe an app's processes.
163+ func (d * DryccCmd ) PsDescribe (appID , podID string ) error {
164+ s , appID , err := load (d .ConfigFile , appID )
165+ if err != nil {
166+ return err
167+ }
168+ // The 1000 is fake for now until API understands limits
169+ podState , _ , err := ps .Describe (s .Client , appID , podID , 1000 )
170+ if d .checkAPICompatibility (s .Client , err ) != nil {
171+ return err
172+ }
173+ table := d .getDefaultFormatTable ([]string {})
174+ for _ , containerState := range podState {
175+ table .Append ([]string {"Container:" , containerState .Container })
176+ table .Append ([]string {"Image:" , containerState .Image })
177+ table .Append ([]string {"Command:" })
178+ for _ , command := range containerState .Command {
179+ table .Append ([]string {"" , fmt .Sprintf ("- %v" , command )})
180+ }
181+ table .Append ([]string {"Args:" })
182+ for _ , arg := range containerState .Args {
183+ table .Append ([]string {"" , fmt .Sprintf ("- %v" , arg )})
184+ }
185+ // State
186+ for key := range containerState .State {
187+ table .Append ([]string {"State:" , key })
188+ value := containerState .State [key ]
189+ for innerKey := range value {
190+ table .Append ([]string {fmt .Sprintf (" %s:" , innerKey ), strconv .Quote (fmt .Sprintf ("%v" , value [innerKey ]))})
191+ }
192+ }
193+ // LastState
194+ for key := range containerState .LastState {
195+ table .Append ([]string {"Last State:" , key })
196+ value := containerState .LastState [key ]
197+ for innerKey := range value {
198+ table .Append ([]string {fmt .Sprintf (" %s:" , innerKey ), strconv .Quote (fmt .Sprintf ("%v" , value [innerKey ]))})
199+ }
200+ }
201+ table .Append ([]string {"Ready:" , fmt .Sprintf ("%v" , containerState .Ready )})
202+ table .Append ([]string {"Restart Count:" , fmt .Sprintf ("%v" , containerState .RestartCount )})
203+ table .Append ([]string {})
204+ }
205+ table .Render ()
206+ return nil
207+ }
208+
162209func printProcesses (d * DryccCmd , appID string , input []api.Pods ) {
163210 processes := ps .ByType (input )
164211
0 commit comments