mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-02 18:00:18 +00:00
* Replace nektos/act imports with actions-oss/act-cli * Update go.mod to reference new repo * Fix goimports "not properly formatted" complaints. Replacing the imports left some out of alphabetical order.
39 lines
760 B
Go
39 lines
760 B
Go
package cmd
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/actions-oss/act-cli/pkg/common"
|
|
"github.com/actions-oss/act-cli/pkg/model"
|
|
)
|
|
|
|
func drawGraph(plan *model.Plan) error {
|
|
drawings := make([]*common.Drawing, 0)
|
|
|
|
jobPen := common.NewPen(common.StyleSingleLine, 96)
|
|
arrowPen := common.NewPen(common.StyleNoLine, 97)
|
|
for i, stage := range plan.Stages {
|
|
if i > 0 {
|
|
drawings = append(drawings, arrowPen.DrawArrow())
|
|
}
|
|
|
|
ids := make([]string, 0)
|
|
for _, r := range stage.Runs {
|
|
ids = append(ids, r.String())
|
|
}
|
|
drawings = append(drawings, jobPen.DrawBoxes(ids...))
|
|
}
|
|
|
|
maxWidth := 0
|
|
for _, d := range drawings {
|
|
if d.GetWidth() > maxWidth {
|
|
maxWidth = d.GetWidth()
|
|
}
|
|
}
|
|
|
|
for _, d := range drawings {
|
|
d.Draw(os.Stdout, maxWidth)
|
|
}
|
|
return nil
|
|
}
|