aboutsummaryrefslogtreecommitdiff
path: root/cmd/root.go
diff options
context:
space:
mode:
authorBryan McNulty <bryanmcnulty@protonmail.com>2025-03-09 12:26:05 -0500
committerBryan McNulty <bryanmcnulty@protonmail.com>2025-03-09 12:26:05 -0500
commitc6460b19bd834875b00f199390e6121d5bdfba7e (patch)
tree11cf6c9c3ddbdf694547cea50c2375d2b6d0df7c /cmd/root.go
parent8099a1d45007ba86f353647bf2a3f09d0cfc73a7 (diff)
downloadgoexec-c6460b19bd834875b00f199390e6121d5bdfba7e.tar.gz
goexec-c6460b19bd834875b00f199390e6121d5bdfba7e.zip
massively improved SCMR module + new DCE client
Diffstat (limited to 'cmd/root.go')
-rw-r--r--cmd/root.go36
1 files changed, 18 insertions, 18 deletions
diff --git a/cmd/root.go b/cmd/root.go
index 441cafc..f083063 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -23,24 +23,6 @@ var (
executableArgs string
workingDirectory string
- 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
- }
- }
-
rootCmd = &cobra.Command{
Use: "goexec",
PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) {
@@ -57,6 +39,24 @@ var (
}
)
+func needsTarget(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
+ }
+}
+
func init() {
ctx = context.Background()