Path: blob/main/vendor/github.com/spf13/cobra/command_win.go
2875 views
// Copyright 2013-2023 The Cobra Authors1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314//go:build windows15// +build windows1617package cobra1819import (20"fmt"21"os"22"time"2324"github.com/inconshreveable/mousetrap"25)2627var preExecHookFn = preExecHook2829func preExecHook(c *Command) {30if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {31c.Print(MousetrapHelpText)32if MousetrapDisplayDuration > 0 {33time.Sleep(MousetrapDisplayDuration)34} else {35c.Println("Press return to continue...")36fmt.Scanln()37}38os.Exit(1)39}40}414243