From cff6b8d531d1df82a7861eb6e087d543f589d8d0 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Tue, 11 Jun 2019 12:09:57 +0200 Subject: [PATCH] *: rename user local run to user direct run --- cmd/agola/cmd/{locarun.go => directrun.go} | 8 ++--- .../{localrunstart.go => directrunstart.go} | 34 +++++++++---------- internal/services/gateway/action/auth.go | 4 +-- .../services/notification/commitstatus.go | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) rename cmd/agola/cmd/{locarun.go => directrun.go} (85%) rename cmd/agola/cmd/{localrunstart.go => directrunstart.go} (55%) diff --git a/cmd/agola/cmd/locarun.go b/cmd/agola/cmd/directrun.go similarity index 85% rename from cmd/agola/cmd/locarun.go rename to cmd/agola/cmd/directrun.go index b92d1f0..24e0ac2 100644 --- a/cmd/agola/cmd/locarun.go +++ b/cmd/agola/cmd/directrun.go @@ -18,11 +18,11 @@ import ( "github.com/spf13/cobra" ) -var cmdLocalRun = &cobra.Command{ - Use: "localrun", - Short: "localrun", +var cmdDirectRun = &cobra.Command{ + Use: "directrun", + Short: "directrun", } func init() { - cmdAgola.AddCommand(cmdLocalRun) + cmdAgola.AddCommand(cmdDirectRun) } diff --git a/cmd/agola/cmd/localrunstart.go b/cmd/agola/cmd/directrunstart.go similarity index 55% rename from cmd/agola/cmd/localrunstart.go rename to cmd/agola/cmd/directrunstart.go index 95c38f6..024e63b 100644 --- a/cmd/agola/cmd/localrunstart.go +++ b/cmd/agola/cmd/directrunstart.go @@ -25,17 +25,17 @@ import ( "github.com/spf13/cobra" ) -var cmdLocalRunStart = &cobra.Command{ +var cmdDirectRunStart = &cobra.Command{ Use: "start", Run: func(cmd *cobra.Command, args []string) { - if err := localRunStart(cmd, args); err != nil { + if err := directRunStart(cmd, args); err != nil { log.Fatalf("err: %v", err) } }, - Short: "executes a run from a local repository", + Short: "executes a run from a local git repository", } -type localRunStartOptions struct { +type directRunStartOptions struct { statusFilter []string labelFilter []string limit int @@ -44,22 +44,22 @@ type localRunStartOptions struct { ignored bool } -var localRunStartOpts localRunStartOptions +var directRunStartOpts directRunStartOptions func init() { - flags := cmdLocalRunStart.PersistentFlags() + flags := cmdDirectRunStart.PersistentFlags() - flags.StringSliceVarP(&localRunStartOpts.statusFilter, "status", "s", nil, "filter runs matching the provided status. This option can be repeated multiple times") - flags.StringArrayVarP(&localRunStartOpts.labelFilter, "label", "l", nil, "filter runs matching the provided label. This option can be repeated multiple times, in this case only runs matching all the labels will be returned") - flags.IntVar(&localRunStartOpts.limit, "limit", 10, "max number of runs to show") - flags.StringVar(&localRunStartOpts.start, "start", "", "starting run id (excluded) to fetch") - flags.BoolVar(&localRunStartOpts.untracked, "untracked", true, "push untracked files") - flags.BoolVar(&localRunStartOpts.ignored, "ignored", false, "push ignored files") + flags.StringSliceVarP(&directRunStartOpts.statusFilter, "status", "s", nil, "filter runs matching the provided status. This option can be repeated multiple times") + flags.StringArrayVarP(&directRunStartOpts.labelFilter, "label", "l", nil, "filter runs matching the provided label. This option can be repeated multiple times, in this case only runs matching all the labels will be returned") + flags.IntVar(&directRunStartOpts.limit, "limit", 10, "max number of runs to show") + flags.StringVar(&directRunStartOpts.start, "start", "", "starting run id (excluded) to fetch") + flags.BoolVar(&directRunStartOpts.untracked, "untracked", true, "push untracked files") + flags.BoolVar(&directRunStartOpts.ignored, "ignored", false, "push ignored files") - cmdLocalRun.AddCommand(cmdLocalRunStart) + cmdDirectRun.AddCommand(cmdDirectRunStart) } -func localRunStart(cmd *cobra.Command, args []string) error { +func directRunStart(cmd *cobra.Command, args []string) error { gwclient := api.NewClient(gatewayURL, token) user, _, err := gwclient.GetCurrentUser(context.TODO()) @@ -68,13 +68,13 @@ func localRunStart(cmd *cobra.Command, args []string) error { } gs := gitsave.NewGitSave(logger, &gitsave.GitSaveConfig{ - AddUntracked: localRunStartOpts.untracked, - AddIgnored: localRunStartOpts.ignored, + AddUntracked: directRunStartOpts.untracked, + AddIgnored: directRunStartOpts.ignored, }) branch := "gitsavebranch-" + uuid.NewV4().String() - if err := gs.Save("agola local run", branch); err != nil { + if err := gs.Save("agola direct run", branch); err != nil { log.Fatalf("err: %v", err) } diff --git a/internal/services/gateway/action/auth.go b/internal/services/gateway/action/auth.go index 39f38cb..b832749 100644 --- a/internal/services/gateway/action/auth.go +++ b/internal/services/gateway/action/auth.go @@ -188,7 +188,7 @@ func (h *ActionHandler) CanGetRun(ctx context.Context, runGroup string) (bool, e ownerID = p.OwnerID visibility = p.GlobalVisibility case common.GroupTypeUser: - // user local runs + // user direct runs ownerType = types.ConfigTypeUser ownerID = groupID visibility = types.VisibilityPrivate @@ -224,7 +224,7 @@ func (h *ActionHandler) CanDoRunActions(ctx context.Context, runGroup string) (b ownerType = p.OwnerType ownerID = p.OwnerID case common.GroupTypeUser: - // user local runs + // user direct runs ownerType = types.ConfigTypeUser ownerID = groupID } diff --git a/internal/services/notification/commitstatus.go b/internal/services/notification/commitstatus.go index df3ac4f..2c9642a 100644 --- a/internal/services/notification/commitstatus.go +++ b/internal/services/notification/commitstatus.go @@ -62,7 +62,7 @@ func (n *NotificationService) updateCommitStatus(ctx context.Context, ev *rstype return err } - // ignore user local runs + // ignore user direct runs if groupType == common.GroupTypeUser { return nil }