Skip to content

Commit fd01c4e

Browse files
author
Mehrad
committed
debug image.delete()
1 parent a190780 commit fd01c4e

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

cmd/application.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func ApplicationCreate(appName, image, plan, EndpointType string, port, minScale
113113
req.Values["ports"] = fmt.Sprintf("%d/%s", port, EndpointType)
114114
req.Values["minimum-scale"] = fmt.Sprintf("%d", minScale)
115115
req.Values["image"] = image
116-
req.Values["debug"] = fmt.Sprintf("%b", debugMode)
116+
req.Values["debug"] = fmt.Sprintf("%t", debugMode)
117117

118118
client := grpcConnect()
119119
defer client.Close()

cmd/image.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ func imgInfo(cmd *cobra.Command, args []string) {
2626
}
2727

2828
func imgDelete(cmd *cobra.Command, args []string) {
29-
imageTag := cmd.Flag("tag").Value.String() // Repository tag
30-
imageName := cmd.Flag("name").Value.String() // Repository name
29+
imageName := forceArgGetStrValue(args, 0, "Enter Image Name [Format: hub.yottab.io/<user>/<name> ]") // Repository name
30+
imageTag := forceArgGetStrValue(args, 1, "Enter Tag:") // Repository tag
3131

3232
req := new(ybApi.ImgBuildReq)
3333
req.RepositoryName = imageName

cmd/requests.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"log"
5+
56
ybApi "github.com/yottab/proto-api/proto"
67
)
78

cmd/utils.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ func forceFlagGetStrValue(cmd *cobra.Command, flagName, inputAnswr string) (val
4949
return
5050
}
5151

52+
func forceArgGetStrValue(args []string, index int, inputAnswr string) (val string) {
53+
val = getCliRequiredArg(args, index)
54+
if val == "" {
55+
val = readFromConsole(inputAnswr)
56+
}
57+
return
58+
}
59+
5260
func readFromConsole(inputAnswr string) (val string) {
5361
fmt.Print(inputAnswr)
5462
reader := bufio.NewReader(os.Stdin)
@@ -89,12 +97,10 @@ func toTime(t *ybApi.Timestamp) (out string) {
8997

9098
func endpointTypeValid(etype string) error {
9199
switch etype {
92-
case "http":
93-
return nil
94-
case "grpc":
100+
case "http", "grpc", "private":
95101
return nil
96102
default:
97-
return errors.New("Endpoint type is invalid, valid values are http, grpc")
103+
return errors.New("Endpoint type is invalid, valid values are http, grpc and private")
98104
}
99105
}
100106

@@ -167,7 +173,6 @@ func streamBuildLog(appName, appTag string, waitToReady bool) {
167173
break
168174
}
169175
}
170-
171176
}
172177

173178
//wrapRemove is a middleware for confirm object removes
@@ -178,7 +183,6 @@ func wrapRemove(objectType string, f func(cmd *cobra.Command, args []string)) fu
178183
//Run the original func if confirmed
179184
f(cmd, args)
180185
}
181-
182186
}
183187

184188
//confirmF check for confirmations, exit on no confirmation, otherwise a noop function

0 commit comments

Comments
 (0)