github.com/Redstoneguy129/cli@v0.0.0-20230211220159-15dca4e91917/internal/projects/create/create.go (about) 1 package create 2 3 import ( 4 "context" 5 "errors" 6 "fmt" 7 8 "github.com/Redstoneguy129/cli/internal/utils" 9 "github.com/Redstoneguy129/cli/pkg/api" 10 "github.com/spf13/afero" 11 ) 12 13 func Run(ctx context.Context, params api.CreateProjectBody, fsys afero.Fs) error { 14 // TODO: Prompt missing args. 15 { 16 } 17 18 resp, err := utils.GetSupabase().CreateProjectWithResponse(ctx, params) 19 if err != nil { 20 return err 21 } 22 23 if resp.JSON201 == nil { 24 return errors.New("Unexpected error creating project: " + string(resp.Body)) 25 } 26 27 // TODO: Poll until PostgREST is reachable. 28 { 29 } 30 31 fmt.Printf( 32 "Created a new project %s at %s\n", 33 utils.Aqua(resp.JSON201.Name), 34 utils.Aqua(utils.GetSupabaseDashboardURL()+"/project/"+resp.JSON201.Id), 35 ) 36 return nil 37 }