Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Workflow = app.Register(&app.Command[WorkflowFlags, app.Empty]{ Use: "workflow [-y] [-c] {workflow}", Desc: "Run workflow", Action: "Run", Prepare: func(cmd *cobra.Command, flags *WorkflowFlags) { cmd.Flags().BoolVarP(&flags.Current, "current", "c", false, "run workflow on current repo") cmd.Flags().BoolVarP(&flags.Edit, "edit", "e", false, "edit repo to run") cmd.Flags().StringVarP(&flags.LogPath, "log-path", "", "", "log file path") cmd.Args = cobra.ExactArgs(1) cmd.ValidArgsFunction = app.Comp(app.CompWorkflow) }, Run: func(ctx *app.Context[WorkflowFlags, app.Empty]) error { wf, err := core.GetWorkflow(ctx.Arg(0)) if err != nil { return err } store, err := core.NewRepositoryStorage() if err != nil { return err } store.ReadOnly() if ctx.Flags.Current { return workflowRunCurrent(store, wf) } if wf.Select == nil { term.Print("nothing to do") return nil } items, err := wf.Select.Match(store) if err != nil { return err } if len(items) == 0 { term.Print("no repo selected") return nil } if ctx.Flags.Edit { items, err = term.EditItems(config.Get().Editor, items, func(item *core.WorkflowMatchItem) string { return item.Path }) if err != nil { return err } } repoWord := english.Plural(len(items), "repo", "repos") term.ConfirmExit("Do you want to run workflow blue|%s| on %s", ctx.Arg(0), repoWord) return workflowRun(ctx, wf.Jobs, items) }, })
Functions ¶
This section is empty.
Types ¶
type WorkflowFlags ¶
Click to show internal directories.
Click to hide internal directories.