diff --git a/cmd/main.go b/cmd/main.go index f1deed57..8e64e07a 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -33,6 +33,7 @@ import ( "time" "github.com/cheggaaa/pb" + "github.com/inconshreveable/mousetrap" "github.com/minio/cli" "github.com/minio/mc/pkg/probe" "github.com/minio/pkg/console" @@ -76,6 +77,18 @@ VERSION: {{$value}} {{end}}` +func init() { + if runtime.GOOS == "windows" { + if mousetrap.StartedByExplorer() { + fmt.Printf("Don't double-click %s\n", os.Args[0]) + fmt.Println("You need to open cmd.exe/PowerShell and run it from the command line") + fmt.Println("Press the Enter Key to Exit") + fmt.Scanln() + os.Exit(1) + } + } +} + // Main starts mc application func Main(args []string) { diff --git a/go.mod b/go.mod index a1cc37ff..98c41faf 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/google/uuid v1.3.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/inconshreveable/mousetrap v1.0.0 github.com/json-iterator/go v1.1.12 github.com/klauspost/compress v1.13.6 github.com/klauspost/cpuid/v2 v2.0.9 // indirect diff --git a/go.sum b/go.sum index 352368d3..62a44352 100644 --- a/go.sum +++ b/go.sum @@ -194,6 +194,8 @@ github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9 github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=