File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,14 @@ func createTemplateCommand() *cobra.Command {
1919}
2020
2121func createTemplateListCommand () * cobra.Command {
22+ isDevcontainerFolder := func (parentPath string , fi os.FileInfo ) bool {
23+ if ! fi .IsDir () {
24+ return false
25+ }
26+ devcontainerJsonPath := fmt .Sprintf ("%s/%s/.devcontainer/devcontainer.json" , parentPath , fi .Name ())
27+ devContainerJsonInfo , err := os .Stat (devcontainerJsonPath )
28+ return err == nil && ! devContainerJsonInfo .IsDir ()
29+ }
2230 cmd := & cobra.Command {
2331 Use : "list" ,
2432 Short : "list templates" ,
@@ -33,9 +41,8 @@ func createTemplateListCommand() *cobra.Command {
3341 os .Exit (1 )
3442 }
3543
36- fmt .Println ("Listing subdir/parent" )
3744 for _ , entry := range c {
38- if entry . IsDir ( ) {
45+ if isDevcontainerFolder ( folder , entry ) {
3946 fmt .Println (entry .Name ())
4047 }
4148 }
You can’t perform that action at this time.
0 commit comments