@@ -2,13 +2,7 @@ package main
2
2
3
3
import (
4
4
"errors"
5
- "fmt"
6
- "os"
7
5
8
- "github.com/google/uuid"
9
- "github.com/hookcamp/hookcamp"
10
- "github.com/hookcamp/hookcamp/util"
11
- "github.com/olekukonko/tablewriter"
12
6
"github.com/spf13/cobra"
13
7
)
14
8
@@ -31,22 +25,22 @@ func listApplications(a *app) *cobra.Command {
31
25
Use : "list" ,
32
26
Short : "List all applications" ,
33
27
RunE : func (cmd * cobra.Command , args []string ) error {
34
- ctx , cancelFn := getCtx ()
35
- defer cancelFn ()
28
+ // ctx, cancelFn := getCtx()
29
+ // defer cancelFn()
36
30
37
- apps , err := a .applicationRepo .LoadApplications (ctx )
38
- if err != nil {
39
- return err
40
- }
31
+ // apps, err := a.applicationRepo.LoadApplications(ctx)
32
+ // if err != nil {
33
+ // return err
34
+ // }
41
35
42
- table := tablewriter .NewWriter (os .Stdout )
43
- table .SetHeader ([]string {"ID" , "Name" , "Org name" , "Created at" })
36
+ // table := tablewriter.NewWriter(os.Stdout)
37
+ // table.SetHeader([]string{"ID", "Name", "Org name", "Created at"})
44
38
45
- for _ , app := range apps {
46
- table .Append ([]string {app .ID .String (), app .Title , app .Organisation .OrgName , app .CreatedAt .String ()})
47
- }
39
+ // for _, app := range apps {
40
+ // table.Append([]string{app.UID .String(), app.Title, app.Organisation.OrgName, app.CreatedAt.String()})
41
+ // }
48
42
49
- table .Render ()
43
+ // table.Render()
50
44
return nil
51
45
},
52
46
}
@@ -62,40 +56,40 @@ func createApplication(a *app) *cobra.Command {
62
56
Use : "create" ,
63
57
Short : "Create an application" ,
64
58
RunE : func (cmd * cobra.Command , args []string ) error {
65
- if util .IsStringEmpty (name ) {
66
- return errors .New ("please provide application name" )
67
- }
59
+ // if util.IsStringEmpty(name) {
60
+ // return errors.New("please provide application name")
61
+ // }
68
62
69
- if util .IsStringEmpty (orgID ) {
70
- return errors .New ("please provide the org ID" )
71
- }
63
+ // if util.IsStringEmpty(orgID) {
64
+ // return errors.New("please provide the org ID")
65
+ // }
72
66
73
- id , err := uuid .Parse (orgID )
74
- if err != nil {
75
- return fmt .Errorf ("could not parse org ID..%w" , err )
76
- }
67
+ // id, err := uuid.Parse(orgID)
68
+ // if err != nil {
69
+ // return fmt.Errorf("could not parse org ID..%w", err)
70
+ // }
77
71
78
- ctx , cancelFn := getCtx ()
79
- defer cancelFn ()
72
+ // ctx, cancelFn := getCtx()
73
+ // defer cancelFn()
80
74
81
- org , err := a .orgRepo .FetchOrganisationByID (ctx , id )
82
- if err != nil {
83
- return err
84
- }
75
+ // org, err := a.orgRepo.FetchOrganisationByID(ctx, id)
76
+ // if err != nil {
77
+ // return err
78
+ // }
85
79
86
- app := & hookcamp.Application {
87
- Title : name ,
88
- OrgID : org .ID ,
89
- }
80
+ // app := &hookcamp.Application{
81
+ // Title: name,
82
+ // OrgID: org.ID,
83
+ // }
90
84
91
- ctx , cancelFn = getCtx ()
92
- defer cancelFn ()
85
+ // ctx, cancelFn = getCtx()
86
+ // defer cancelFn()
93
87
94
- if err := a .applicationRepo .CreateApplication (ctx , app ); err != nil {
95
- return err
96
- }
88
+ // if err := a.applicationRepo.CreateApplication(ctx, app); err != nil {
89
+ // return err
90
+ // }
97
91
98
- fmt .Printf ("Your application was successfully created. ID = %s \n " , app .ID )
92
+ // fmt.Printf("Your application was successfully created. ID = %s \n", app.ID)
99
93
return nil
100
94
},
101
95
}
@@ -118,27 +112,27 @@ func getApplicationCommand(a *app) *cobra.Command {
118
112
return nil
119
113
},
120
114
RunE : func (cmd * cobra.Command , args []string ) error {
121
- ID := args [0 ]
115
+ // ID := args[0]
122
116
123
- appID , err := uuid .Parse (ID )
124
- if err != nil {
125
- return fmt .Errorf ("Please provide a valid ID..%w" , err )
126
- }
117
+ // appID, err := uuid.Parse(ID)
118
+ // if err != nil {
119
+ // return fmt.Errorf("Please provide a valid ID..%w", err)
120
+ // }
127
121
128
- ctx , cancelFn := getCtx ()
129
- defer cancelFn ()
122
+ // ctx, cancelFn := getCtx()
123
+ // defer cancelFn()
130
124
131
- app , err := a .applicationRepo .FindApplicationByID (ctx , appID )
132
- if err != nil {
133
- return fmt .Errorf ("could not fetch app ID..%w" , err )
134
- }
125
+ // app, err := a.applicationRepo.FindApplicationByID(ctx, appID)
126
+ // if err != nil {
127
+ // return fmt.Errorf("could not fetch app ID..%w", err)
128
+ // }
135
129
136
- table := tablewriter .NewWriter (os .Stdout )
137
- table .SetHeader ([]string {"ID" , "Description" })
130
+ // table := tablewriter.NewWriter(os.Stdout)
131
+ // table.SetHeader([]string{"ID", "Description"})
138
132
139
- table .Append ([]string {app .ID .String (), app .Title })
133
+ // table.Append([]string{app.ID.String(), app.Title})
140
134
141
- table .Render ()
135
+ // table.Render()
142
136
return nil
143
137
},
144
138
}
0 commit comments