示例#1
0
func main() {
	s := ui.NewSpinner("Waiting...", ui.SuffixElapsed(), nil)
	for i := 0; i < 32; i++ {
		s.Step()
		time.Sleep(250 * time.Millisecond)
	}
	s.Finish()
}
示例#2
0
文件: pod.go 项目: dataVerve/jetpack
func (c *Pod) Kill() error {
	c.ui.Println("Shutting down")
	spin := ui.NewSpinner("Waiting for jail to die", ui.SuffixElapsed(), nil)
	defer spin.Finish()
retry:
	switch status := c.Status(); status {
	case PodStatusStopped:
		// All's fine
		return nil
	case PodStatusRunning:
		if err := c.runJail("-r"); err != nil {
			return errors.Trace(err)
		}
		goto retry
	case PodStatusDying:
		// TODO: UI? Log?
		spin.Step()
		time.Sleep(250 * time.Millisecond)
		goto retry
	default:
		return errors.Errorf("Pod is %v, I am confused", status)
	}
}