@@ -16,9 +16,9 @@ import (
1616
1717// NewConfigPluginFetchCmd create a command for fetching plugin metadata
1818func NewConfigPluginFetchCmd (pluginOrg , pluginRepo string ) (cmd * cobra.Command ) {
19- pluginFetchCmd := jcliPluginFetchCmd {
20- PluginOrg : pluginOrg ,
21- PluginRepo : pluginRepo ,
19+ pluginFetchCmd := & jcliPluginFetchCmd {
20+ PluginOrg : pluginOrg ,
21+ PluginRepoName : pluginRepo ,
2222 }
2323
2424 cmd = & cobra.Command {
@@ -34,7 +34,7 @@ but you can change it by giving a command parameter.`, pluginFetchCmd.PluginOrg,
3434 // add flags
3535 flags := cmd .Flags ()
3636 flags .StringVarP (& pluginFetchCmd .PluginRepo , "plugin-repo" , "" ,
37- fmt .Sprintf ("https://github.com/%s/%s" , pluginFetchCmd .PluginOrg , pluginFetchCmd .PluginRepo ),
37+ fmt .Sprintf ("https://github.com/%s/%s" , pluginFetchCmd .PluginOrg , pluginFetchCmd .PluginRepoName ),
3838 "The plugin git repository URL" )
3939 flags .BoolVarP (& pluginFetchCmd .Reset , "reset" , "" , true ,
4040 "If you want to reset the git local repo when pulling it" )
@@ -56,11 +56,12 @@ func (c *jcliPluginFetchCmd) Run(cmd *cobra.Command, args []string) (err error)
5656 return
5757 }
5858
59- pluginRepo := fmt .Sprintf ("%s/.%s /plugins-repo" , userHome , c . PluginRepo )
59+ pluginRepoCache := fmt .Sprintf ("%s/.jenkins-cli /plugins-repo" , userHome )
6060 c .output = cmd .OutOrStdout ()
6161
62+ cmd .Printf ("start to fetch metadata from '%s', cache to '%s'\n " , c .PluginRepo , pluginRepoCache )
6263 var r * git.Repository
63- if r , err = git .PlainOpen (pluginRepo ); err == nil {
64+ if r , err = git .PlainOpen (pluginRepoCache ); err == nil {
6465 var w * git.Worktree
6566 if w , err = r .Worktree (); err != nil {
6667 return
@@ -80,7 +81,7 @@ func (c *jcliPluginFetchCmd) Run(cmd *cobra.Command, args []string) (err error)
8081 }
8182 } else {
8283 cloneOptions := c .getCloneOptions ()
83- _ , err = git .PlainClone (pluginRepo , false , cloneOptions )
84+ _ , err = git .PlainClone (pluginRepoCache , false , cloneOptions )
8485 }
8586 return
8687}
0 commit comments