MCPcopy Index your code
hub / github.com/devopsctl/gitlabctl / assignListProjectOptions

Function assignListProjectOptions

cmd/flags_assigners.go:34–82  ·  view source on GitHub ↗

assignListProjectOptions assigns the flags' values to gitlab.ListProjectsOptions fields. If a flag's default value is not changed by the caller, it's value will not be assigned to the associated gitlab.ListProjectsOptions field.

(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

32// If a flag's default value is not changed by the caller,
33// it's value will not be assigned to the associated gitlab.ListProjectsOptions field.
34func assignListProjectOptions(cmd *cobra.Command) *gitlab.ListProjectsOptions {
35 opts := new(gitlab.ListProjectsOptions)
36 if cmd.Flag("page").Changed {
37 opts.Page = getFlagInt(cmd, "page")
38 }
39 if cmd.Flag("per-page").Changed {
40 opts.PerPage = getFlagInt(cmd, "per-page")
41 }
42 if cmd.Flag("archived").Changed {
43 opts.Archived = gitlab.Bool(getFlagBool(cmd, "archived"))
44 }
45 if cmd.Flag("order-by").Changed {
46 opts.OrderBy = gitlab.String(getFlagString(cmd, "order-by"))
47 }
48 if cmd.Flag("sort").Changed {
49 opts.Sort = gitlab.String(getFlagString(cmd, "sort"))
50 }
51 if cmd.Flag("search").Changed {
52 opts.Search = gitlab.String(getFlagString(cmd, "search"))
53 }
54 if cmd.Flag("simple").Changed {
55 opts.Simple = gitlab.Bool(getFlagBool(cmd, "simple"))
56 }
57 if cmd.Flag("owned").Changed {
58 opts.Owned = gitlab.Bool(getFlagBool(cmd, "owned"))
59 }
60 if cmd.Flag("membership").Changed {
61 opts.Membership = gitlab.Bool(getFlagBool(cmd, "membership"))
62 }
63 if cmd.Flag("starred").Changed {
64 opts.Starred = gitlab.Bool(getFlagBool(cmd, "starred"))
65 }
66 if cmd.Flag("statistics").Changed {
67 opts.Statistics = gitlab.Bool(getFlagBool(cmd, "statistics"))
68 }
69 if cmd.Flag("visibility").Changed {
70 v := getFlagVisibility(cmd)
71 opts.Visibility = v
72 }
73 if cmd.Flag("with-issues-enabled").Changed {
74 opts.WithIssuesEnabled = gitlab.Bool(
75 getFlagBool(cmd, "with-issues-enabled"))
76 }
77 if cmd.Flag("with-merge-requests-enabled").Changed {
78 opts.WithMergeRequestsEnabled = gitlab.Bool(getFlagBool(cmd,
79 "with-merge-requests-enabled"))
80 }
81 return opts
82}
83
84// assignCreateProjectOptions assigns the flags' values to gitlab.CreateProjectOptions fields.
85// If a flag's default value is not changed by the caller,

Callers 2

runGetProjectsFunction · 0.85
runGetProjectsFromGroupFunction · 0.85

Calls 4

getFlagIntFunction · 0.85
getFlagBoolFunction · 0.85
getFlagStringFunction · 0.85
getFlagVisibilityFunction · 0.85

Tested by

no test coverage detected