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 dd1c18c87..7690817fa 100644 --- a/go.mod +++ b/go.mod @@ -16,13 +16,13 @@ require ( github.com/docker/docker v27.3.1+incompatible github.com/gocarina/gocsv v0.0.0-20240520201108-78e41c74b4b1 github.com/jfrog/archiver/v3 v3.6.1 - github.com/jfrog/build-info-go v1.10.3 + github.com/jfrog/build-info-go v1.10.4 github.com/jfrog/gofrog v1.7.6 github.com/jfrog/jfrog-cli-artifactory v0.1.6 github.com/jfrog/jfrog-cli-core/v2 v2.56.5 github.com/jfrog/jfrog-cli-platform-services v1.4.0 github.com/jfrog/jfrog-cli-security v1.12.4 - github.com/jfrog/jfrog-client-go v1.47.4 + github.com/jfrog/jfrog-client-go v1.47.5 github.com/jszwec/csvutil v1.10.0 github.com/manifoldco/promptui v0.9.0 github.com/stretchr/testify v1.9.0 @@ -71,7 +71,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/golang-jwt/jwt/v4 v4.5.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/go-github/v56 v56.0.0 // indirect @@ -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,9 +167,9 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace github.com/jfrog/jfrog-cli-core/v2 => github.com/eyaldelarea/jfrog-cli-core/v2 add_setup_cli_usage +replace github.com/jfrog/jfrog-cli-core/v2 => github.com/eyaldelarea/jfrog-cli-core/v2 v2.0.0-20241110113131-ec983f11abbf -// replace github.com/jfrog/jfrog-cli-security => github.com/attiasas/jfrog-cli-security v0.0.0-20240904061406-f368939ce3a0 +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 diff --git a/go.sum b/go.sum index 33d137cc3..eb116bf5c 100644 --- a/go.sum +++ b/go.sum @@ -87,6 +87,8 @@ github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcej github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= +github.com/eyaldelarea/jfrog-cli-core/v2 v2.0.0-20241110113131-ec983f11abbf h1:UL/rNJpjlklVlHmb077Gw/AU/t8zKmn1cLGCky9jWQ0= +github.com/eyaldelarea/jfrog-cli-core/v2 v2.0.0-20241110113131-ec983f11abbf/go.mod h1:In9hwLK96tY8Vu79FvahRVpeiV3JCfz6qVtacA5yXfQ= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -120,8 +122,8 @@ github.com/gocarina/gocsv v0.0.0-20240520201108-78e41c74b4b1 h1:FWNFq4fM1wPfcK40 github.com/gocarina/gocsv v0.0.0-20240520201108-78e41c74b4b1/go.mod h1:5YoVOkjYAQumqlV356Hj3xeYh4BdZuLE0/nRkf2NKkI= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= +github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -159,12 +161,12 @@ 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= -github.com/jfrog/build-info-go v1.10.3/go.mod h1:JcISnovFXKx3wWf3p1fcMmlPdt6adxScXvoJN4WXqIE= +github.com/jfrog/build-info-go v1.10.4 h1:LBkmXEX1JyIHkrqvLrN7D8y8peyQrBi+A64jFGQs57Q= +github.com/jfrog/build-info-go v1.10.4/go.mod h1:JcISnovFXKx3wWf3p1fcMmlPdt6adxScXvoJN4WXqIE= github.com/jfrog/froggit-go v1.16.2 h1:F//S83iXH14qsCwYzv0zB2JtjS2pJVEsUoEmYA+37dQ= github.com/jfrog/froggit-go v1.16.2/go.mod h1:5VpdQfAcbuyFl9x/x8HGm7kVk719kEtW/8YJFvKcHPA= github.com/jfrog/gofrog v1.7.6 h1:QmfAiRzVyaI7JYGsB7cxfAJePAZTzFz0gRWZSE27c6s= @@ -175,10 +177,10 @@ github.com/jfrog/jfrog-cli-artifactory v0.1.6 h1:bMfJsrLQJw0dZp4nqUf1xOmtY0rpCat github.com/jfrog/jfrog-cli-artifactory v0.1.6/go.mod h1:jbNb22ebtupcjdhrdGq0VBew2vWG6VUK04xxGNDfynE= 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-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/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.5 h1:vNsPPQW+2AJozRH6YY4c7BvSr/y5aFxy/e5HOVSswXo= +github.com/jfrog/jfrog-client-go v1.47.5/go.mod h1:0krZWJWiFMBr4f2BKeQvWF98UCxNFDiom+pEAPcCG+U= github.com/jszwec/csvutil v1.10.0 h1:upMDUxhQKqZ5ZDCs/wy+8Kib8rZR8I8lOR34yJkdqhI= github.com/jszwec/csvutil v1.10.0/go.mod h1:/E4ONrmGkwmWsk9ae9jpXnv9QT8pLHEPcCirMFhxG9I= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=