Move repos subcommand to a dedicated source file (#137)
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
		
							parent
							
								
									9032395818
								
							
						
					
					
						commit
						bb20fcaf5b
					
				|  | @ -0,0 +1,24 @@ | ||||||
|  | package cmd | ||||||
|  | 
 | ||||||
|  | import ( | ||||||
|  | 	"github.com/helmfile/helmfile/pkg/app" | ||||||
|  | 	"github.com/helmfile/helmfile/pkg/config" | ||||||
|  | 	"github.com/urfave/cli" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | func addReposSubcommand(cliApp *cli.App) { | ||||||
|  | 	cliApp.Commands = append(cliApp.Commands, cli.Command{ | ||||||
|  | 		Name:  "repos", | ||||||
|  | 		Usage: "sync repositories from state file (helm repo add && helm repo update)", | ||||||
|  | 		Flags: []cli.Flag{ | ||||||
|  | 			cli.StringFlag{ | ||||||
|  | 				Name:  "args", | ||||||
|  | 				Value: "", | ||||||
|  | 				Usage: "pass args to helm exec", | ||||||
|  | 			}, | ||||||
|  | 		}, | ||||||
|  | 		Action: Action(func(a *app.App, c config.ConfigImpl) error { | ||||||
|  | 			return a.Repos(c) | ||||||
|  | 		}), | ||||||
|  | 	}) | ||||||
|  | } | ||||||
|  | @ -26,6 +26,7 @@ func RootCommand() *cli.App { | ||||||
| 
 | 
 | ||||||
| 	// add subcommands
 | 	// add subcommands
 | ||||||
| 	addDepsSubcommand(cliApp) | 	addDepsSubcommand(cliApp) | ||||||
|  | 	addReposSubcommand(cliApp) | ||||||
| 
 | 
 | ||||||
| 	return cliApp | 	return cliApp | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										14
									
								
								main.go
								
								
								
								
							
							
						
						
									
										14
									
								
								main.go
								
								
								
								
							|  | @ -14,20 +14,6 @@ func main() { | ||||||
| 
 | 
 | ||||||
| 	rootCmd := cmd.RootCommand() | 	rootCmd := cmd.RootCommand() | ||||||
| 	subCommands := []cli.Command{ | 	subCommands := []cli.Command{ | ||||||
| 		{ |  | ||||||
| 			Name:  "repos", |  | ||||||
| 			Usage: "sync repositories from state file (helm repo add && helm repo update)", |  | ||||||
| 			Flags: []cli.Flag{ |  | ||||||
| 				cli.StringFlag{ |  | ||||||
| 					Name:  "args", |  | ||||||
| 					Value: "", |  | ||||||
| 					Usage: "pass args to helm exec", |  | ||||||
| 				}, |  | ||||||
| 			}, |  | ||||||
| 			Action: cmd.Action(func(a *app.App, c config.ConfigImpl) error { |  | ||||||
| 				return a.Repos(c) |  | ||||||
| 			}), |  | ||||||
| 		}, |  | ||||||
| 		{ | 		{ | ||||||
| 			Name:  "charts", | 			Name:  "charts", | ||||||
| 			Usage: "DEPRECATED: sync releases from state file (helm upgrade --install)", | 			Usage: "DEPRECATED: sync releases from state file (helm upgrade --install)", | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue