diff options
author | Bryan McNulty <bryanmcnulty@protonmail.com> | 2025-03-01 20:50:04 -0600 |
---|---|---|
committer | Bryan McNulty <bryanmcnulty@protonmail.com> | 2025-03-01 20:50:04 -0600 |
commit | 6dcae18a99ba7f7ca44c246d0e72b4d9410eb60c (patch) | |
tree | 2c9d4e482cb42d820f853a1bc2e92205b9eeba50 /cmd/root.go | |
parent | 50393c546010da3745b1d80f156aeb713f3411dc (diff) | |
download | goexec-6dcae18a99ba7f7ca44c246d0e72b4d9410eb60c.tar.gz goexec-6dcae18a99ba7f7ca44c246d0e72b4d9410eb60c.zip |
Added tsch module
Diffstat (limited to 'cmd/root.go')
-rw-r--r-- | cmd/root.go | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/cmd/root.go b/cmd/root.go index 00563c6..fdc0ad6 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -16,11 +16,28 @@ var ( ctx context.Context authOpts *adauth.Options - debug, trace bool + debug bool command string + executable string executablePath string executableArgs 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") + } + return + } + rootCmd = &cobra.Command{ Use: "goexec", PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) { @@ -42,13 +59,16 @@ func init() { rootCmd.InitDefaultVersionFlag() rootCmd.InitDefaultHelpCmd() - rootCmd.PersistentFlags().BoolVarP(&debug, "debug", "d", false, "Enable debug logging") + rootCmd.PersistentFlags().BoolVar(&debug, "debug", false, "Enable debug logging") authOpts = &adauth.Options{Debug: log.Debug().Msgf} authOpts.RegisterFlags(rootCmd.PersistentFlags()) scmrCmdInit() rootCmd.AddCommand(scmrCmd) + + tschCmdInit() + rootCmd.AddCommand(tschCmd) } func Execute() { |