Skip to content

Commit 98ba983

Browse files
authored
Change from edit to configure (#65)
1 parent f3a8833 commit 98ba983

File tree

3 files changed

+45
-44
lines changed

3 files changed

+45
-44
lines changed

cmd/app/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ func init() {
2929
Cmd.AddCommand(infoCmd)
3030
Cmd.AddCommand(startCmd)
3131
Cmd.AddCommand(deployCmd)
32-
Cmd.AddCommand(editCmd)
32+
Cmd.AddCommand(configureCmd)
3333
Cmd.AddCommand(cloneCmd)
3434
}

cmd/app/configure.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package app
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/major-technology/cli/singletons"
7+
"github.com/major-technology/cli/utils"
8+
"github.com/spf13/cobra"
9+
)
10+
11+
// configureCmd represents the configure command
12+
var configureCmd = &cobra.Command{
13+
Use: "configure",
14+
Short: "Open the app configurations in your browser",
15+
Long: `Open the app configurations in your default browser for the current application.`,
16+
RunE: func(cmd *cobra.Command, args []string) error {
17+
return runConfigure(cmd)
18+
},
19+
}
20+
21+
func runConfigure(cmd *cobra.Command) error {
22+
// Get application ID
23+
applicationID, err := getApplicationID()
24+
if err != nil {
25+
return err
26+
}
27+
28+
// Get config to access frontend URI
29+
cfg := singletons.GetConfig()
30+
31+
// Construct the app settings URL
32+
configureURL := fmt.Sprintf("%s/home?dialog=app-settings&appId=%s", cfg.FrontendURI, applicationID)
33+
34+
// Open the URL in the browser
35+
if err := utils.OpenBrowser(configureURL); err != nil {
36+
// If browser fails to open, still show the URL
37+
cmd.Printf("Failed to open browser automatically. Please visit:\n%s\n", configureURL)
38+
return nil
39+
}
40+
41+
cmd.Printf("Opening app configurations in your browser:\n%s\n", configureURL)
42+
return nil
43+
}
44+

cmd/app/editor.go

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)