@@ -15,29 +15,29 @@ import (
1515 "github.com/spf13/cobra"
1616)
1717
18- type CreateOptions struct {
19- Repo string
20- Branch string
21- Machine string
22- ShowStatus bool
18+ type createOptions struct {
19+ repo string
20+ branch string
21+ machine string
22+ showStatus bool
2323}
2424
2525func newCreateCmd () * cobra.Command {
26- opts := & CreateOptions {}
26+ opts := & createOptions {}
2727
2828 createCmd := & cobra.Command {
2929 Use : "create" ,
3030 Short : "Create a Codespace" ,
3131 Args : cobra .NoArgs ,
3232 RunE : func (cmd * cobra.Command , args []string ) error {
33- return Create (opts )
33+ return create (opts )
3434 },
3535 }
3636
37- createCmd .Flags ().StringVarP (& opts .Repo , "repo" , "r" , "" , "repository name with owner: user/repo" )
38- createCmd .Flags ().StringVarP (& opts .Branch , "branch" , "b" , "" , "repository branch" )
39- createCmd .Flags ().StringVarP (& opts .Machine , "machine" , "m" , "" , "hardware specifications for the VM" )
40- createCmd .Flags ().BoolVarP (& opts .ShowStatus , "status" , "s" , false , "show status of post-create command and dotfiles" )
37+ createCmd .Flags ().StringVarP (& opts .repo , "repo" , "r" , "" , "repository name with owner: user/repo" )
38+ createCmd .Flags ().StringVarP (& opts .branch , "branch" , "b" , "" , "repository branch" )
39+ createCmd .Flags ().StringVarP (& opts .machine , "machine" , "m" , "" , "hardware specifications for the VM" )
40+ createCmd .Flags ().BoolVarP (& opts .showStatus , "status" , "s" , false , "show status of post-create command and dotfiles" )
4141
4242 return createCmd
4343}
@@ -46,18 +46,18 @@ func init() {
4646 rootCmd .AddCommand (newCreateCmd ())
4747}
4848
49- func Create (opts * CreateOptions ) error {
49+ func create (opts * createOptions ) error {
5050 ctx := context .Background ()
5151 apiClient := api .New (os .Getenv ("GITHUB_TOKEN" ))
5252 locationCh := getLocation (ctx , apiClient )
5353 userCh := getUser (ctx , apiClient )
5454 log := output .NewLogger (os .Stdout , os .Stderr , false )
5555
56- repo , err := getRepoName (opts .Repo )
56+ repo , err := getRepoName (opts .repo )
5757 if err != nil {
5858 return fmt .Errorf ("error getting repository name: %v" , err )
5959 }
60- branch , err := getBranchName (opts .Branch )
60+ branch , err := getBranchName (opts .branch )
6161 if err != nil {
6262 return fmt .Errorf ("error getting branch name: %v" , err )
6363 }
@@ -77,7 +77,7 @@ func Create(opts *CreateOptions) error {
7777 return fmt .Errorf ("error getting codespace user: %v" , userResult .Err )
7878 }
7979
80- machine , err := getMachineName (ctx , opts .Machine , userResult .User , repository , locationResult .Location , apiClient )
80+ machine , err := getMachineName (ctx , opts .machine , userResult .User , repository , locationResult .Location , apiClient )
8181 if err != nil {
8282 return fmt .Errorf ("error getting machine type: %v" , err )
8383 }
@@ -92,7 +92,7 @@ func Create(opts *CreateOptions) error {
9292 return fmt .Errorf ("error creating codespace: %v" , err )
9393 }
9494
95- if opts .ShowStatus {
95+ if opts .showStatus {
9696 if err := showStatus (ctx , log , apiClient , userResult .User , codespace ); err != nil {
9797 return fmt .Errorf ("show status: %w" , err )
9898 }
0 commit comments