mirror of
https://github.com/kemko/nomad.git
synced 2026-01-10 12:25:42 +03:00
Adding '-verbose' will print out the allocation information for the deployment. This also changes the job run command so that it now blocks until deployment is complete and adds timestamps to the output so that it's more in line with the output of node drain. This uses glint to print in place in running in a tty. Because glint doesn't yet support cmd/powershell, Windows workflows use a different library to print in place, which results in slightly different formatting: 1) different margins, and 2) no spinner indicating deployment in progress.
38 lines
798 B
Go
38 lines
798 B
Go
package glint
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// TextComponent is a Component that renders text.
|
|
type TextComponent struct {
|
|
terminalComponent
|
|
f func(rows, cols uint) string
|
|
}
|
|
|
|
// Text creates a TextComponent for static text. The text here will be word
|
|
// wrapped automatically based on the width of the terminal.
|
|
func Text(v string) *TextComponent {
|
|
return TextFunc(func(rows, cols uint) string { return v })
|
|
}
|
|
|
|
// TextFunc creates a TextComponent for text that is dependent on the
|
|
// size of the draw area.
|
|
func TextFunc(f func(rows, cols uint) string) *TextComponent {
|
|
return &TextComponent{
|
|
f: f,
|
|
}
|
|
}
|
|
|
|
func (el *TextComponent) Body(context.Context) Component {
|
|
return nil
|
|
}
|
|
|
|
func (el *TextComponent) Render(rows, cols uint) string {
|
|
if el.f == nil {
|
|
return ""
|
|
}
|
|
|
|
return el.f(rows, cols)
|
|
}
|