@@ -29,7 +29,7 @@ func (p *Plural) bundleCommands() []cli.Command {
2929 Usage : "re-enter the configuration for this bundle" ,
3030 },
3131 },
32- Action : tracked (latestVersion (rooted (requireArgs ( p .bundleInstall , [] string { "repo" , "bundle-name" }) )), "bundle.install" ),
32+ Action : tracked (latestVersion (rooted (p .bundleInstall )), "bundle.install" ),
3333 },
3434 }
3535}
@@ -63,15 +63,9 @@ func (p *Plural) stackCommands() []cli.Command {
6363}
6464
6565func (p * Plural ) bundleList (c * cli.Context ) error {
66- man , err := manifest .FetchProject ()
6766 repo := c .Args ().Get (0 )
68- prov := ""
69- if err == nil {
70- prov = strings .ToUpper (man .Provider )
71- }
72-
7367 p .InitPluralClient ()
74- recipes , err := p .ListRecipes (repo , prov )
68+ recipes , err := p .listRecipes (repo )
7569 if err != nil {
7670 return api .GetErrorResponse (err , "ListRecipes" )
7771 }
@@ -85,7 +79,26 @@ func (p *Plural) bundleList(c *cli.Context) error {
8579func (p * Plural ) bundleInstall (c * cli.Context ) (err error ) {
8680 args := c .Args ()
8781 p .InitPluralClient ()
88- err = bundle .Install (p .Client , args .Get (0 ), args .Get (1 ), c .Bool ("refresh" ))
82+ repo := args .Get (0 )
83+ if repo == "" {
84+ return fmt .Errorf ("REPO argument required, try running `plural bundle install REPO` for the app you want to install" )
85+ }
86+
87+ bdl := args .Get (1 )
88+ if bdl == "" {
89+ recipes , err := p .listRecipes (args .Get (0 ))
90+ if err != nil {
91+ return err
92+ }
93+ for _ , recipe := range recipes {
94+ if recipe .Primary {
95+ bdl = recipe .Name
96+ break
97+ }
98+ }
99+ }
100+
101+ err = bundle .Install (p .Client , repo , bdl , c .Bool ("refresh" ))
89102 utils .Note ("To edit the configuration you've just entered, edit the context.yaml file at the root of your repo, or run with the --refresh flag\n " )
90103 return
91104}
@@ -115,3 +128,14 @@ func (p *Plural) stackList(c *cli.Context) (err error) {
115128 return []string {s .Name , s .Description , fmt .Sprintf ("%v" , s .Featured )}, nil
116129 })
117130}
131+
132+ func (p * Plural ) listRecipes (repo string ) (res []* api.Recipe , err error ) {
133+ man , err := manifest .FetchProject ()
134+ prov := ""
135+ if err == nil {
136+ prov = strings .ToUpper (man .Provider )
137+ }
138+
139+ res , err = p .ListRecipes (repo , prov )
140+ return
141+ }
0 commit comments