diff --git a/cli/pipeline/log/log.go b/cli/pipeline/log/log.go index 2ca1e1c90..4ea569d79 100644 --- a/cli/pipeline/log/log.go +++ b/cli/pipeline/log/log.go @@ -23,6 +23,7 @@ var Command = &cli.Command{ Name: "log", Usage: "manage logs", Commands: []*cli.Command{ + logShowCmd, logPurgeCmd, }, } diff --git a/cli/pipeline/logs.go b/cli/pipeline/log/log_show.go similarity index 84% rename from cli/pipeline/logs.go rename to cli/pipeline/log/log_show.go index f7725bc46..e9de7a747 100644 --- a/cli/pipeline/logs.go +++ b/cli/pipeline/log/log_show.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package pipeline +package log import ( "context" @@ -27,14 +27,14 @@ import ( "go.woodpecker-ci.org/woodpecker/v2/woodpecker-go/woodpecker" ) -var pipelineLogsCmd = &cli.Command{ - Name: "logs", +var logShowCmd = &cli.Command{ + Name: "show", Usage: "show pipeline logs", ArgsUsage: " [step-number|step-name]", - Action: pipelineLogs, + Action: logShow, } -func pipelineLogs(ctx context.Context, c *cli.Command) error { +func logShow(ctx context.Context, c *cli.Command) error { repoIDOrFullName := c.Args().First() client, err := internal.NewClient(ctx, c) if err != nil { @@ -59,17 +59,17 @@ func pipelineLogs(ctx context.Context, c *cli.Command) error { stepArg := c.Args().Get(2) //nolint:mnd if len(stepArg) == 0 { - return showPipelineLog(client, repoID, number) + return pipelineLog(client, repoID, number) } step, err := internal.ParseStep(client, repoID, number, stepArg) if err != nil { return fmt.Errorf("invalid step '%s': %w", stepArg, err) } - return showStepLog(client, repoID, number, step) + return stepLog(client, repoID, number, step) } -func showPipelineLog(client woodpecker.Client, repoID, number int64) error { +func pipelineLog(client woodpecker.Client, repoID, number int64) error { pipeline, err := client.Pipeline(repoID, number) if err != nil { return err @@ -85,7 +85,7 @@ func showPipelineLog(client woodpecker.Client, repoID, number int64) error { if err := tmpl.Execute(os.Stdout, map[string]any{"workflow": workflow, "step": step}); err != nil { return err } - err := showStepLog(client, repoID, number, step.ID) + err := stepLog(client, repoID, number, step.ID) if err != nil { return err } @@ -95,7 +95,7 @@ func showPipelineLog(client woodpecker.Client, repoID, number int64) error { return nil } -func showStepLog(client woodpecker.Client, repoID, number, step int64) error { +func stepLog(client woodpecker.Client, repoID, number, step int64) error { logs, err := client.StepLogEntries(repoID, number, step) if err != nil { return err diff --git a/cli/pipeline/pipeline.go b/cli/pipeline/pipeline.go index c49107652..abc892600 100644 --- a/cli/pipeline/pipeline.go +++ b/cli/pipeline/pipeline.go @@ -35,7 +35,6 @@ var Command = &cli.Command{ Commands: []*cli.Command{ buildPipelineListCmd(), pipelineLastCmd, - pipelineLogsCmd, pipelineInfoCmd, pipelineStopCmd, pipelineStartCmd, diff --git a/docs/src/pages/migrations.md b/docs/src/pages/migrations.md index 0de359e06..a45c6cca1 100644 --- a/docs/src/pages/migrations.md +++ b/docs/src/pages/migrations.md @@ -42,6 +42,7 @@ This will be the next version of Woodpecker. - `woodpecker-cli log` is now `woodpecker-cli pipeline log` - `woodpecker-cli cron` is now `woodpecker-cli repo cron` - `woodpecker-cli secret [add|rm|...] --repository` is now `woodpecker-cli repo secret [add|rm|...]` + - `woodpecker-cli pipeline logs` is now `woodpecker-cli pipeline log show` ## Admin migrations