@@ -23,7 +23,7 @@ type ServiceInitCommand struct {
2323 description string
2424 file string
2525 fileMode filemode.FileMode
26- path api.DirPath
26+ repo api.RepoPath
2727 permission string
2828 clipper clip.Clipper
2929 io ui.IO
@@ -54,25 +54,19 @@ func (cmd *ServiceInitCommand) Run() error {
5454 return ErrFlagsConflict ("--clip and --file" )
5555 }
5656
57- repo := cmd .path .GetRepoPath ()
58-
5957 client , err := cmd .newClient ()
6058 if err != nil {
6159 return err
6260 }
6361
6462 credential := credentials .CreateKey ()
65- service , err := client .Services ().Create (repo .Value (), cmd .description , credential )
63+ service , err := client .Services ().Create (cmd . repo .Value (), cmd .description , credential )
6664 if err != nil {
6765 return err
6866 }
6967
70- if strings .Contains (cmd .permission , ":" ) && ! cmd .path .IsRepoPath () {
71- return api .ErrInvalidRepoPath (cmd .path )
72- }
73-
7468 if cmd .permission != "" {
75- err = givePermission (service , cmd .path . GetRepoPath () , cmd .permission , client )
69+ err = givePermission (service , cmd .repo , cmd .permission , client )
7670 if err != nil {
7771 return err
7872 }
@@ -111,7 +105,7 @@ func (cmd *ServiceInitCommand) Run() error {
111105// Register registers the command, arguments and flags on the provided Registerer.
112106func (cmd * ServiceInitCommand ) Register (r command.Registerer ) {
113107 clause := r .Command ("init" , "Create a new service account." )
114- clause .Arg ("repo" , "The service account is attached to the repository in this path." ).Required ().PlaceHolder (repoPathPlaceHolder ).SetValue (& cmd .path )
108+ clause .Arg ("repo" , "The service account is attached to the repository in this path." ).Required ().PlaceHolder (repoPathPlaceHolder ).SetValue (& cmd .repo )
115109 clause .Flag ("description" , "A description for the service so others will recognize it." ).StringVar (& cmd .description )
116110 clause .Flag ("descr" , "" ).Hidden ().StringVar (& cmd .description )
117111 clause .Flag ("desc" , "" ).Hidden ().StringVar (& cmd .description )
0 commit comments