Skip to content

Commit 09c303e

Browse files
davemooreuwstjholm
authored andcommitted
fix: find files relative to ctx and collect functions relative to ctx
1 parent 6ac37fb commit 09c303e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pkg/cmd/stack/root.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,17 @@ var stackDescribeCmd = &cobra.Command{
117117
Short: "describe stack dependencies",
118118
Long: `Describes stack dependencies`,
119119
Run: func(cmd *cobra.Command, args []string) {
120-
files, err := filepath.Glob(args[0])
120+
// Run collection on each of the files
121+
ctx, _ := filepath.Abs(".")
122+
123+
files, err := filepath.Glob(filepath.Join(ctx, args[0]))
121124

122125
if err != nil {
123126
panic(err)
124127
}
125128

126129
fmt.Printf("found files: %v\n", files)
127-
128-
// Run collection on each of the files
129-
ctx, _ := filepath.Abs(".")
130-
130+
131131
// Create a new stack
132132
stack := codeconfig.NewStack()
133133

@@ -137,7 +137,9 @@ var stackDescribeCmd = &cobra.Command{
137137
}
138138

139139
for _, f := range files {
140-
if err := codeconfig.Collect(ctx, f, stack); err != nil {
140+
rel, _ := filepath.Rel(ctx, f)
141+
142+
if err := codeconfig.Collect(ctx, rel, stack); err != nil {
141143
fmt.Println(err)
142144
}
143145
}

0 commit comments

Comments
 (0)