Skip to content

Commit

Permalink
create_common: add file for *_create common data
Browse files Browse the repository at this point in the history
Some variables were being shared between snippet_ and project_create and it
wasn't clear which one was declaring which vars. This patch adds a file for
holding these common data.

Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
  • Loading branch information
bmeneg committed Jan 25, 2021
1 parent 5c37357 commit ea0c681
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
7 changes: 7 additions & 0 deletions cmd/create_common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package cmd

var (
private bool
public bool
internal bool
)
2 changes: 1 addition & 1 deletion cmd/fork.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func init() {
forkCmd.Flags().StringP("name", "n", "", "fork project with a different name")
forkCmd.Flags().StringP("group", "g", "", "fork project in a different group (namespace)")
forkCmd.Flags().StringP("path", "p", "", "fork project with a different path")
// useHTTP is defined in "project_create.go"
// useHTTP is defined in "util.go"
forkCmd.Flags().BoolVar(&useHTTP, "http", false, "fork using HTTP protocol instead of SSH")
RootCmd.AddCommand(forkCmd)
}
6 changes: 0 additions & 6 deletions cmd/project_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ import (
lab "github.com/zaquestion/lab/internal/gitlab"
)

var (
// private and public are defined in snippet_create.go
internal bool
useHTTP bool
)

// projectCreateCmd represents the create command
var projectCreateCmd = &cobra.Command{
Use: "create [path]",
Expand Down
6 changes: 2 additions & 4 deletions cmd/snippet_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ import (
)

var (
name string
file string
private bool
public bool
name string
file string
)

// mrCmd represents the mr command
Expand Down
2 changes: 2 additions & 0 deletions cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (

var (
CommandPrefix string
// http vs ssh protocol control flag
useHTTP bool
)

// flagConfig compares command line flags and the flags set in the config
Expand Down

0 comments on commit ea0c681

Please sign in to comment.