@@ -30,14 +30,17 @@ var samplesLanguageFlag string
3030
3131func NewSamplesCommand (clients * shared.ClientFactory ) * cobra.Command {
3232 cmd := & cobra.Command {
33- Use : "samples" ,
33+ Use : "samples [name] " ,
3434 Aliases : []string {"sample" },
3535 Short : "List available sample apps" ,
3636 Long : "List and create an app from the available samples" ,
3737 Example : style .ExampleCommandsf ([]style.ExampleCommand {
38- {Command : "samples" , Meaning : "Select a sample app to create" },
38+ {
39+ Meaning : "Select a sample app to create" ,
40+ Command : "samples my-project" ,
41+ },
3942 }),
40- Args : cobra .MaximumNArgs (0 ),
43+ Args : cobra .MaximumNArgs (1 ),
4144 RunE : func (cmd * cobra.Command , args []string ) error {
4245 clients .Config .SetFlags (cmd )
4346 return runSamplesCommand (clients , cmd , args )
@@ -77,9 +80,7 @@ func runSamplesCommand(clients *shared.ClientFactory, cmd *cobra.Command, args [
7780
7881 // If preferred directory name is passed in as an argument to the `create`
7982 // command first, honor that preference and use it to create the project
80- if len (args ) > 0 {
81- createCmd .SetArgs ([]string {args [0 ]})
82- }
83+ createCmd .SetArgs (args )
8384
8485 // Execute the `create` command with the set flag
8586 return createCmd .ExecuteContext (ctx )
0 commit comments