Skip to content

Commit

Permalink
yukictl: Strip .yaml suffix from repo input
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug committed Jul 13, 2024
1 parent fb056ca commit 9c9ebec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/yukictl/cmd/reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewCmdReload(f factory.Factory) *cobra.Command {
Short: "Reload config of one or all repos",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) > 0 {
o.repo = args[0]
o.repo = stripSuffix(args[0])
}
return o.Run(f)
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/yukictl/cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NewCmdSync(f factory.Factory) *cobra.Command {
Example: " yukictl sync REPO",
Short: "Sync local repository with remote",
RunE: func(cmd *cobra.Command, args []string) error {
o.name = args[0]
o.name = stripSuffix(args[0])
return o.Run(f)
},
}
Expand Down
9 changes: 9 additions & 0 deletions pkg/yukictl/cmd/util.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package cmd

import "strings"

const suffixYAML = ".yaml"

func stripSuffix(s string) string {
return strings.TrimSuffix(s, suffixYAML)
}

0 comments on commit 9c9ebec

Please sign in to comment.