mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 10:03:42 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			433 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			433 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// +build windows
 | 
						|
 | 
						|
package cobra
 | 
						|
 | 
						|
import (
 | 
						|
	"fmt"
 | 
						|
	"os"
 | 
						|
	"time"
 | 
						|
 | 
						|
	"github.com/inconshreveable/mousetrap"
 | 
						|
)
 | 
						|
 | 
						|
var preExecHookFn = preExecHook
 | 
						|
 | 
						|
func preExecHook(c *Command) {
 | 
						|
	if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
 | 
						|
		c.Print(MousetrapHelpText)
 | 
						|
		if MousetrapDisplayDuration > 0 {
 | 
						|
			time.Sleep(MousetrapDisplayDuration)
 | 
						|
		} else {
 | 
						|
			c.Println("Press return to continue...")
 | 
						|
			fmt.Scanln()
 | 
						|
		}
 | 
						|
		os.Exit(1)
 | 
						|
	}
 | 
						|
}
 |