mirror of
https://github.com/safing/portmaster
synced 2025-09-02 10:39:22 +00:00
Suppress arguments for windows snoretoast commands
This commit is contained in:
parent
b671a68aec
commit
23f3f06cf1
3 changed files with 12 additions and 2 deletions
|
@ -28,6 +28,7 @@ var (
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Identifier string // component identifier
|
Identifier string // component identifier
|
||||||
ShortIdentifier string // populated automatically
|
ShortIdentifier string // populated automatically
|
||||||
|
SuppressArgs bool // do not use any args
|
||||||
AllowDownload bool // allow download of component if it is not yet available
|
AllowDownload bool // allow download of component if it is not yet available
|
||||||
AllowHidingWindow bool // allow hiding the window of the subprocess
|
AllowHidingWindow bool // allow hiding the window of the subprocess
|
||||||
NoOutput bool // do not use stdout/err if logging to file is available (did not fail to open log file)
|
NoOutput bool // do not use stdout/err if logging to file is available (did not fail to open log file)
|
||||||
|
@ -134,6 +135,9 @@ func run(cmd *cobra.Command, opts *Options) (err error) {
|
||||||
return cmd.Help()
|
return cmd.Help()
|
||||||
}
|
}
|
||||||
args = os.Args[3:]
|
args = os.Args[3:]
|
||||||
|
if opts.SuppressArgs {
|
||||||
|
args = nil
|
||||||
|
}
|
||||||
|
|
||||||
// adapt identifier
|
// adapt identifier
|
||||||
if onWindows {
|
if onWindows {
|
||||||
|
|
|
@ -54,6 +54,7 @@ var showNotifier = &cobra.Command{
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
return show(cmd, &Options{
|
return show(cmd, &Options{
|
||||||
Identifier: "notifier/portmaster-notifier",
|
Identifier: "notifier/portmaster-notifier",
|
||||||
|
SuppressArgs: true,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
FParseErrWhitelist: cobra.FParseErrWhitelist{
|
FParseErrWhitelist: cobra.FParseErrWhitelist{
|
||||||
|
@ -69,6 +70,9 @@ func show(cmd *cobra.Command, opts *Options) error {
|
||||||
return cmd.Help()
|
return cmd.Help()
|
||||||
}
|
}
|
||||||
args = os.Args[3:]
|
args = os.Args[3:]
|
||||||
|
if opts.SuppressArgs {
|
||||||
|
args = nil
|
||||||
|
}
|
||||||
|
|
||||||
// adapt identifier
|
// adapt identifier
|
||||||
if onWindows {
|
if onWindows {
|
||||||
|
|
|
@ -13,6 +13,7 @@ var showSnoreToast = &cobra.Command{
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
return show(cmd, &Options{
|
return show(cmd, &Options{
|
||||||
Identifier: "notifier/portmaster-snoretoast",
|
Identifier: "notifier/portmaster-snoretoast",
|
||||||
|
SuppressArgs: true,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
FParseErrWhitelist: cobra.FParseErrWhitelist{
|
FParseErrWhitelist: cobra.FParseErrWhitelist{
|
||||||
|
@ -29,6 +30,7 @@ var runSnoreToast = &cobra.Command{
|
||||||
Identifier: "notifier/portmaster-snoretoast",
|
Identifier: "notifier/portmaster-snoretoast",
|
||||||
AllowDownload: false,
|
AllowDownload: false,
|
||||||
AllowHidingWindow: true,
|
AllowHidingWindow: true,
|
||||||
|
SuppressArgs: true,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
FParseErrWhitelist: cobra.FParseErrWhitelist{
|
FParseErrWhitelist: cobra.FParseErrWhitelist{
|
||||||
|
|
Loading…
Add table
Reference in a new issue