lxc/utils/progress.go
func (p *ProgressRenderer) Done(msg string) {
	// Acquire rendering lock
	p.lock.Lock()
	defer p.lock.Unlock()

	// Check if we're already done
	if p.done {
		return
	}

	// Mark this renderer as done
	p.done = true

	// Handle quiet mode
	if p.Quiet {
		msg = ""
	}

	// Truncate msg to terminal length
	msg = p.truncate(msg)

	// If we're not printing a completion message and nothing was printed before just return
	if msg == "" && p.maxLength == 0 {
		return
	}

	// Print the new message
	if msg != "" {
		msg += "\n"
	}

	if len(msg) > p.maxLength {
		p.maxLength = len(msg)
	} else {
		fmt.Printf("\r%s", strings.Repeat(" ", p.maxLength))
	}

	fmt.Print("\r")
	fmt.Print(msg)
}
func (p *ProgressRenderer) Done(msg string) {
	// Acquire rendering lock
	p.lock.Lock()
	defer p.lock.Unlock()

	// Check if we're already done
	if p.done {
		return
	}

	// Mark this renderer as done
	p.done = true

	// Handle quiet mode
	if p.Quiet {
		msg = ""
	}

	// Truncate msg to terminal length
	msg = p.truncate(msg)

	// If we're not printing a completion message and nothing was printed before just return
	if msg == "" && p.maxLength == 0 {
		return
	}

	// Print the new message
	if msg != "" {
		msg += "\n"
	}

	if len(msg) > p.maxLength {
		p.maxLength = len(msg)
	} else {
		fmt.Printf("\r%s", strings.Repeat(" ", p.maxLength))
	}

	fmt.Print("\r")
	fmt.Print(msg)
}
func ( p * ProgressRenderer ) Done ( msg string ) { // Acquire rendering lock p . lock . Lock ( ) defer p . lock . Unlock ( ) // Check if we're already done if p . done { return } // Mark this renderer as done p . done = true // Handle quiet mode if p . Quiet { msg = " " } // Truncate msg to terminal length msg = p . truncate ( msg ) // If we're not printing a completion message and nothing was printed before just return if msg == " " && p . maxLength == 0 { return } // Print the new message if msg != " " { msg += " \n " } if len ( msg ) > p . maxLength { p . maxLength = len ( msg ) } else { fmt . Printf ( " \r " , strings . Repeat ( " " , p . maxLength ) ) } fmt . Print ( " \r " ) fmt . Print ( msg ) }
// Done prints the final status and prevents any update
Done prints the final status and prevents any update