diff --git a/buildtools/cli.go b/buildtools/cli.go index 05309851c..fa7d87993 100644 --- a/buildtools/cli.go +++ b/buildtools/cli.go @@ -738,7 +738,7 @@ func pullCmd(c *cli.Context, image string) error { if show, err := cliutils.ShowGenericCmdHelpIfNeeded(c, c.Args(), "dockerpullhelp"); show || err != nil { return err } - _, rtDetails, _, skipLogin, filteredDockerArgs, buildConfiguration, err := commandsUtils.ExtractDockerOptionsFromArgs(c.Args()) + _, rtDetails, _, skipLogin, filteredDockerArgs, buildConfiguration, err := extractDockerOptionsFromArgs(c.Args()) if err != nil { return err } @@ -761,7 +761,7 @@ func pushCmd(c *cli.Context, image string) (err error) { if show, err := cliutils.ShowCmdHelpIfNeeded(c, c.Args()); show || err != nil { return err } - threads, rtDetails, detailedSummary, skipLogin, filteredDockerArgs, buildConfiguration, err := commandsUtils.ExtractDockerOptionsFromArgs(c.Args()) + threads, rtDetails, detailedSummary, skipLogin, filteredDockerArgs, buildConfiguration, err := extractDockerOptionsFromArgs(c.Args()) if err != nil { return } @@ -794,7 +794,7 @@ func dockerNativeCmd(c *cli.Context) error { if show, err := cliutils.ShowCmdHelpIfNeeded(c, c.Args()); show || err != nil { return err } - _, _, _, _, cleanArgs, _, err := commandsUtils.ExtractDockerOptionsFromArgs(c.Args()) + _, _, _, _, cleanArgs, _, err := extractDockerOptionsFromArgs(c.Args()) if err != nil { return err } @@ -802,6 +802,34 @@ func dockerNativeCmd(c *cli.Context) error { return cm.RunNativeCmd(cleanArgs) } +// Remove all the none docker CLI flags from args. +func extractDockerOptionsFromArgs(args []string) (threads int, serverDetails *coreConfig.ServerDetails, detailedSummary, skipLogin bool, cleanArgs []string, buildConfig *build.BuildConfiguration, err error) { + cleanArgs = append([]string(nil), args...) + var serverId string + cleanArgs, serverId, err = coreutils.ExtractServerIdFromCommand(cleanArgs) + if err != nil { + return + } + serverDetails, err = coreConfig.GetSpecificConfig(serverId, true, true) + if err != nil { + return + } + cleanArgs, threads, err = coreutils.ExtractThreadsFromArgs(cleanArgs, 3) + if err != nil { + return + } + cleanArgs, detailedSummary, err = coreutils.ExtractDetailedSummaryFromArgs(cleanArgs) + if err != nil { + return + } + cleanArgs, skipLogin, err = coreutils.ExtractSkipLoginFromArgs(cleanArgs) + if err != nil { + return + } + cleanArgs, buildConfig, err = build.ExtractBuildDetailsFromArgs(cleanArgs) + return +} + // Assuming command name is the first argument that isn't a flag. // Returns the command name, and the filtered arguments slice without it. func getCommandName(orgArgs []string) (string, []string) { @@ -933,19 +961,20 @@ func pythonCmd(c *cli.Context, projectType project.ProjectType) error { cmdName, filteredArgs := getCommandName(orgArgs) switch projectType { case project.Pip: - pythonCommand := python.NewPipCommand() - pythonCommand.SetServerDetails(rtDetails).SetRepo(pythonConfig.TargetRepo()).SetCommandName(cmdName).SetArgs(filteredArgs) - return commands.Exec(pythonCommand) + pipCommand := python.NewPipCommand() + pipCommand.SetServerDetails(rtDetails).SetRepo(pythonConfig.TargetRepo()).SetCommandName(cmdName).SetArgs(filteredArgs) + return commands.Exec(pipCommand) case project.Pipenv: - pythonCommand := python.NewPipenvCommand() - pythonCommand.SetServerDetails(rtDetails).SetRepo(pythonConfig.TargetRepo()).SetCommandName(cmdName).SetArgs(filteredArgs) - return commands.Exec(pythonCommand) + pipenvCommand := python.NewPipenvCommand() + pipenvCommand.SetServerDetails(rtDetails).SetRepo(pythonConfig.TargetRepo()).SetCommandName(cmdName).SetArgs(filteredArgs) + return commands.Exec(pipenvCommand) case project.Poetry: - pythonCommand := python.NewPoetryCommand() - pythonCommand.SetServerDetails(rtDetails).SetRepo(pythonConfig.TargetRepo()).SetCommandName(cmdName).SetArgs(filteredArgs) - return commands.Exec(pythonCommand) + poetryCommand := python.NewPoetryCommand() + poetryCommand.SetServerDetails(rtDetails).SetRepo(pythonConfig.TargetRepo()).SetCommandName(cmdName).SetArgs(filteredArgs) + return commands.Exec(poetryCommand) + default: + return errorutils.CheckErrorf("%s is not supported", projectType) } - return errorutils.CheckErrorf("%s is not supported", projectType) } func terraformCmd(c *cli.Context) error { diff --git a/general/invite/invite.go b/general/invite/invite.go deleted file mode 100644 index 5d6dd589e..000000000 --- a/general/invite/invite.go +++ /dev/null @@ -1,20 +0,0 @@ -package invite - -import ( - "github.com/jfrog/jfrog-cli-core/v2/common/commands" - "github.com/jfrog/jfrog-cli-core/v2/general/invite" - "github.com/jfrog/jfrog-cli/utils/cliutils" - "github.com/urfave/cli" -) - -func RunInviteCmd(c *cli.Context) error { - if c.NArg() != 1 { - return cliutils.WrongNumberOfArgumentsHandler(c) - } - serverDetails, err := cliutils.CreateArtifactoryDetailsByFlags(c) - if err != nil { - return err - } - inviteCmd := invite.NewInviteCommand().SetInvitedEmail(c.Args().Get(0)).SetServerDetails(serverDetails) - return commands.Exec(inviteCmd) -} diff --git a/go.mod b/go.mod index fb05e4ca0..09f23b1f1 100644 --- a/go.mod +++ b/go.mod @@ -83,7 +83,7 @@ require ( github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect - github.com/jedib0t/go-pretty/v6 v6.5.9 // indirect + github.com/jedib0t/go-pretty/v6 v6.6.1 // indirect github.com/jfrog/froggit-go v1.16.2 // indirect github.com/jfrog/jfrog-apps-config v1.0.1 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect @@ -167,12 +167,13 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace github.com/jfrog/jfrog-cli-core/v2 => github.com/barv-jfrog/jfrog-cli-core/v2 v2.0.0-20241107120828-8102dd2efed2 -// replace github.com/jfrog/jfrog-cli-security => github.com/attiasas/jfrog-cli-security v0.0.0-20240904061406-f368939ce3a0 +replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20241107130834-59ac9764f8b9 + +replace github.com/jfrog/jfrog-cli-security => github.com/jfrog/jfrog-cli-security v1.12.5-0.20241107141149-42cf964808a1 // replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240918081224-1c584cc334c7 // replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20240918150101-ad5b10435a12 -// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog dev +// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog dev \ No newline at end of file diff --git a/go.sum b/go.sum index 37cdf4c60..c732ce200 100644 --- a/go.sum +++ b/go.sum @@ -161,8 +161,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jedib0t/go-pretty/v6 v6.5.9 h1:ACteMBRrrmm1gMsXe9PSTOClQ63IXDUt03H5U+UV8OU= -github.com/jedib0t/go-pretty/v6 v6.5.9/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= +github.com/jedib0t/go-pretty/v6 v6.6.1 h1:iJ65Xjb680rHcikRj6DSIbzCex2huitmc7bDtxYVWyc= +github.com/jedib0t/go-pretty/v6 v6.6.1/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= github.com/jfrog/archiver/v3 v3.6.1 h1:LOxnkw9pOn45DzCbZNFV6K0+6dCsQ0L8mR3ZcujO5eI= github.com/jfrog/archiver/v3 v3.6.1/go.mod h1:VgR+3WZS4N+i9FaDwLZbq+jeU4B4zctXL+gL4EMzfLw= github.com/jfrog/build-info-go v1.10.3 h1:9nqBdZD6xkuxiOvxg+idZ79QLFWQNuucvKkl8Xb42kw= @@ -175,10 +175,12 @@ github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYL github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w= github.com/jfrog/jfrog-cli-artifactory v0.1.6 h1:bMfJsrLQJw0dZp4nqUf1xOmtY0rpCatW/I5q88x+fhQ= github.com/jfrog/jfrog-cli-artifactory v0.1.6/go.mod h1:jbNb22ebtupcjdhrdGq0VBew2vWG6VUK04xxGNDfynE= +github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20241107130834-59ac9764f8b9 h1:zAlXZrJRbThdMtA5UDjC0RouJ/OVY/zv9+VI54NTbFo= +github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20241107130834-59ac9764f8b9/go.mod h1:2E9LLSLDYNwp2585LyMuDaNMuq+ohvgZYg7K5EY933o= github.com/jfrog/jfrog-cli-platform-services v1.4.0 h1:g6A30+tOfXd1h6VASeNwH+5mhs5bPQJ0MFzZs/4nlvs= github.com/jfrog/jfrog-cli-platform-services v1.4.0/go.mod h1:Ky4SDXuMeaiNP/5zMT1YSzIuXG+cNYYOl8BaEA7Awbc= -github.com/jfrog/jfrog-cli-security v1.12.4 h1:X36XIazDOH5YCGLx36QFDGTtvfJHixawakU601nYGmA= -github.com/jfrog/jfrog-cli-security v1.12.4/go.mod h1:eT+Z6HNh35eBeeIaLww8Gf7jHI3CpifBHIJ81bcwR/s= +github.com/jfrog/jfrog-cli-security v1.12.5-0.20241107141149-42cf964808a1 h1:xbyIbEI6CSX87TyokXfzlEfyMnHjS6xqD7zuV2dep6c= +github.com/jfrog/jfrog-cli-security v1.12.5-0.20241107141149-42cf964808a1/go.mod h1:ZovKCEpt1eqQGiulh3H9+JmYgWR9r9qoKtOYiGb5eAs= github.com/jfrog/jfrog-client-go v1.47.4 h1:4FAuDDvoDRy9LEFe1WwUO5prBXkgyhaWGEZ0vXYL/Z4= github.com/jfrog/jfrog-client-go v1.47.4/go.mod h1:NepfaidmK/xiKsVC+0Ur9sANOqL6io8Y7pSaCau7J6o= github.com/jszwec/csvutil v1.10.0 h1:upMDUxhQKqZ5ZDCs/wy+8Kib8rZR8I8lOR34yJkdqhI=