Skip to content

Commit 2f35720

Browse files
Merge pull request #4 from RohitRavindra-dev/feature/v2/apply
feat: improved structring and err
2 parents a50f3de + 3ddb05e commit 2f35720

4 files changed

Lines changed: 44 additions & 25 deletions

File tree

cmd/apply.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import (
66
"github.com/RohitRavindra-dev/devlocal/internal/filesystem"
77
"github.com/spf13/cobra"
88

9-
"github.com/RohitRavindra-dev/devlocal/internal/orchestration/apply"
9+
"github.com/RohitRavindra-dev/devlocal/internal/service/apply"
1010
)
1111

1212
var applyCmd = &cobra.Command{
1313
Use: "apply",
1414
Short: "Apply .devlocal changes that makes the project ready for local developement",
1515
PreRunE: func(cmd *cobra.Command, args []string) error {
16-
fmt.Println("Attempting to apply devlocal changes")
16+
fmt.Println("[Started] to apply devlocal changes")
1717
// check for setup
1818
return filesystem.ValidateDevLocalFilesystem()
1919
},

internal/orchestration/apply/mastermind.go

Lines changed: 0 additions & 18 deletions
This file was deleted.

internal/orchestration/apply/overlooking.go

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package apply
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/RohitRavindra-dev/devlocal/internal/filesystem"
7+
"github.com/RohitRavindra-dev/devlocal/internal/git"
8+
)
9+
10+
func applyOverlook(overlookFiles []string) error {
11+
fmt.Println("[Running] git skip worktree for files: ", overlookFiles)
12+
if len(overlookFiles) == 0 {
13+
fmt.Println("[Warn] No files found in overlook section of devlocal config, skipping")
14+
return nil
15+
}
16+
17+
if err := git.SkipWorkTree(overlookFiles); err != nil {
18+
return err
19+
}
20+
21+
fmt.Println("[Completed] git skip worktree")
22+
23+
return nil
24+
25+
}
26+
27+
func Run() error {
28+
config, err := filesystem.LoadDevlocalConfig()
29+
30+
if err != nil {
31+
return err
32+
}
33+
34+
// overlook files
35+
if overlookErr := applyOverlook(config.Overlook); overlookErr != nil {
36+
return overlookErr
37+
}
38+
39+
// TODO: apply patches
40+
41+
return nil
42+
}

0 commit comments

Comments
 (0)