Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 54aa97d

Browse files
committed
Do not accept a directory as argument to service init
Just like we already do for `service aws init`, don't accept a directory as argument of the command. Instead, if you want to set a permission on a subdirectory, you should use the --permission flag.
1 parent bdc68ca commit 54aa97d

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

internals/secrethub/service_init.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

0 commit comments

Comments
 (0)