Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit 9e181db

Browse files
authored
Merge pull request #57 from sloppyio/console-fetch-project
fix(console): validate project before exec
2 parents a8292b7 + 3885fe3 commit 9e181db

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

command/console.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,20 @@ func (c *ConsoleCommand) Run(args []string) int {
7575
return c.UI.ErrorNotEnoughArgs("console", "", 2)
7676
}
7777

78+
appsClient := c.Client.Apps
7879
appPath = args[0]
80+
app := strings.Split(strings.Trim(appPath, "/"), "/")
7981

80-
if !(strings.Count(strings.Trim(appPath, "/"), "/") == 2) {
82+
if len(app) != 3 {
8183
return c.UI.ErrorInvalidAppPath(args[0])
8284
}
8385

86+
_, _, err := appsClient.Get(app[0], app[1], app[2])
87+
if err != nil {
88+
c.UI.Error(err.Error())
89+
return 1
90+
}
91+
8492
if ttyOpt && !stdinOpt {
8593
c.UI.Error("-i must be enabled if running with tty")
8694
return 1

0 commit comments

Comments
 (0)