aboutsummaryrefslogtreecommitdiff
path: root/cmd/root.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/root.go')
-rw-r--r--cmd/root.go30
1 files changed, 15 insertions, 15 deletions
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)
}