From 7574b7370be083ff563fa8ad6d01d5ac776d7e4d Mon Sep 17 00:00:00 2001 From: Bryan McNulty Date: Sat, 8 Mar 2025 06:07:29 -0600 Subject: Add a bunch of DCE related options to TSCH module --- cmd/root.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'cmd/root.go') diff --git a/cmd/root.go b/cmd/root.go index 9a84e28..441cafc 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -23,20 +23,22 @@ var ( executableArgs string workingDirectory string - needsTarget = func(cmd *cobra.Command, args []string) (err error) { - if len(args) != 1 { - return fmt.Errorf("command require exactly one positional argument: [target]") - } - if creds, target, err = authOpts.WithTarget(ctx, "cifs", args[0]); err != nil { - return fmt.Errorf("failed to parse target: %w", err) - } - if creds == nil { - return fmt.Errorf("no credentials supplied") - } - if target == nil { - return fmt.Errorf("no target supplied") + needsTarget = func(proto string) func(cmd *cobra.Command, args []string) error { + return func(cmd *cobra.Command, args []string) (err error) { + if len(args) != 1 { + return fmt.Errorf("command require exactly one positional argument: [target]") + } + if creds, target, err = authOpts.WithTarget(ctx, proto, args[0]); err != nil { + return fmt.Errorf("failed to parse target: %w", err) + } + if creds == nil { + return fmt.Errorf("no credentials supplied") + } + if target == nil { + return fmt.Errorf("no target supplied") + } + return } - return } rootCmd = &cobra.Command{ @@ -67,10 +69,8 @@ func init() { scmrCmdInit() rootCmd.AddCommand(scmrCmd) - tschCmdInit() rootCmd.AddCommand(tschCmd) - wmiCmdInit() rootCmd.AddCommand(wmiCmd) } -- cgit v1.2.3