File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import (
10
10
"github.com/pkg/errors"
11
11
"github.com/spf13/cobra"
12
12
"github.com/spf13/cobra/doc"
13
+
14
+ "go.jetpack.io/devbox/internal/fileutil"
13
15
)
14
16
15
17
func genDocsCmd () * cobra.Command {
@@ -30,15 +32,8 @@ func genDocsCmd() *cobra.Command {
30
32
// We clear out the existing directory so that the doc-pages for
31
33
// commands that have been deleted in the CLI will also be removed
32
34
// after we re-generate the docs below
33
- err = os .RemoveAll (docsPath )
34
- if err != nil {
35
- return errors .WithStack (err )
36
- }
37
-
38
- // Ensure the directory exists
39
- err = os .MkdirAll (docsPath , 0755 )
40
- if err != nil {
41
- return errors .WithStack (err )
35
+ if err := fileutil .ClearDir (docsPath ); err != nil {
36
+ return err
42
37
}
43
38
44
39
rootCmd := cmd
Original file line number Diff line number Diff line change 8
8
"path/filepath"
9
9
10
10
"github.com/pkg/errors"
11
+
11
12
"go.jetpack.io/devbox/internal/cmdutil"
12
13
)
13
14
@@ -26,8 +27,14 @@ func CopyAll(src, dst string) error {
26
27
}
27
28
28
29
func ClearDir (dir string ) error {
30
+ f , err := os .Stat (dir )
31
+ if err != nil {
32
+ return errors .WithStack (err )
33
+ }
34
+ mode := f .Mode ()
35
+
29
36
if err := os .RemoveAll (dir ); err != nil {
30
37
return errors .WithStack (err )
31
38
}
32
- return errors .WithStack (os .MkdirAll (dir , 0755 ))
39
+ return errors .WithStack (os .MkdirAll (dir , mode ))
33
40
}
Original file line number Diff line number Diff line change 8
8
"path/filepath"
9
9
10
10
"github.com/pkg/errors"
11
+
11
12
"go.jetpack.io/devbox/internal/boxcli/usererr"
12
13
"go.jetpack.io/devbox/internal/pullbox/git"
13
14
)
You can’t perform that action at this time.
0 commit comments