"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
fs: add support for flag --no-console on windows to hide the console window
albertony7a496752f32e
diff --git a/cmd/cmd.go b/cmd/cmd.goindex 7a93f159e..9ce1acd15 100644--- a/cmd/cmd.go+++ b/cmd/cmd.go@@ -382,6 +382,11 @@ func initConfig() {// Finish parsing any command line flagsconfigflags.SetFlags(ci)+ // Hide console window+ if ci.NoConsole {+ terminal.HideConsole()+ }+// Load filterserr := filterflags.Reload(ctx)if err != nil {diff --git a/fs/config.go b/fs/config.goindex 356479731..f913de579 100644--- a/fs/config.go+++ b/fs/config.go@@ -121,6 +121,7 @@ type ConfigInfo struct {DownloadHeaders []*HTTPOptionHeaders []*HTTPOptionRefreshTimes bool+ NoConsole bool}// NewConfig creates a new config with everything set to the defaultdiff --git a/fs/config/configflags/configflags.go b/fs/config/configflags/configflags.goindex e5fc527bf..2cdbbe3d7 100644--- a/fs/config/configflags/configflags.go+++ b/fs/config/configflags/configflags.go@@ -124,6 +124,7 @@ func AddFlags(ci *fs.ConfigInfo, flagSet *pflag.FlagSet) {flags.StringArrayVarP(flagSet, &downloadHeaders, "header-download", "", nil, "Set HTTP header for download transactions")flags.StringArrayVarP(flagSet, &headers, "header", "", nil, "Set HTTP header for all transactions")flags.BoolVarP(flagSet, &ci.RefreshTimes, "refresh-times", "", ci.RefreshTimes, "Refresh the modtime of remote files.")+ flags.BoolVarP(flagSet, &ci.NoConsole, "no-console", "", ci.NoConsole, "Hide console window. Supported on Windows only.")}// ParseHeaders converts the strings passed in via the header flags into HTTPOptionsdiff --git a/lib/terminal/hidden_other.go b/lib/terminal/hidden_other.gonew file mode 100644index 000000000..2a15b21b1--- /dev/null+++ b/lib/terminal/hidden_other.go@@ -0,0 +1,7 @@+// +build !windows++package terminal++// HideConsole is only supported on windows+func HideConsole() {+}diff --git a/lib/terminal/hidden_windows.go b/lib/terminal/hidden_windows.gonew file mode 100644index 000000000..0745e87ed--- /dev/null+++ b/lib/terminal/hidden_windows.go@@ -0,0 +1,19 @@+// +build windows++package terminal++import (+ "syscall"+)++// HideConsole hides the console window and activates another window+func HideConsole() {+ getConsoleWindow := syscall.NewLazyDLL("kernel32.dll").NewProc("GetConsoleWindow")+ showWindow := syscall.NewLazyDLL("user32.dll").NewProc("ShowWindow")+ if getConsoleWindow.Find() == nil && showWindow.Find() == nil {+ hwnd, _, _ := getConsoleWindow.Call()+ if hwnd != 0 {+ showWindow.Call(hwnd, 0)+ }+ }+}