File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,21 +4,31 @@ import (
44 "fmt"
55
66 "github.com/RohitRavindra-dev/devlocal/internal/filesystem"
7+ "github.com/RohitRavindra-dev/devlocal/internal/service/revert"
78 "github.com/spf13/cobra"
89)
910
1011var cleanupCmd = & cobra.Command {
1112 Use : "cleanup" ,
1213 Short : "Cleanup devlocal setup" ,
14+ PreRunE : func (cmd * cobra.Command , args []string ) error {
15+ fmt .Println ("[Started] to revert devlocal changes" )
16+ // check for setup
17+ return filesystem .ValidateDevLocalFilesystem ()
18+ },
1319 RunE : func (cmd * cobra.Command , args []string ) error {
1420 fmt .Println ("Cleaning up setup" )
1521 //call revert
22+ if err := revert .Run (); err != nil {
23+ fmt .Println ("[Errored] while trying to cleanup devlocal setup" )
24+ return err
25+ }
1626 // remove devlocal files
1727 fileTeardownError := filesystem .TearDownDevLocalFilesystem ()
1828 if fileTeardownError != nil {
1929 return fileTeardownError
2030 }
21- fmt .Println ("Cleanup completed , ciao!" )
31+ fmt .Println ("[Completed] Cleanup , ciao!" )
2232 return nil
2333 },
2434}
Original file line number Diff line number Diff line change 11package cmd
22
33import (
4+ "fmt"
5+
46 "github.com/RohitRavindra-dev/devlocal/internal/filesystem"
57 "github.com/spf13/cobra"
68)
79
810var initCmd = & cobra.Command {
911 Use : "init" ,
1012 Short : "Initialize devlocal in this project workspace" ,
13+ PreRun : func (cmd * cobra.Command , args []string ) {
14+ fmt .Println ("[Started] to init devlocal for you, dw!" )
15+ },
1116 RunE : func (cmd * cobra.Command , args []string ) error {
1217 return filesystem .InitilizeDevLocalFilesystem ()
1318 },
Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ func InitilizeDevLocalFilesystem() error {
6868 if err := seedYamlConfigFile (); err != nil {
6969 return err
7070 }
71+
72+ fmt .Println ("[Completed] initializing devlocal setup for your repo" )
7173 return nil
7274}
7375
Original file line number Diff line number Diff line change 88)
99
1010func TearDownDevLocalFilesystem () error {
11- fmt .Printf ("Removing %s and all underlying evidence\n " , config .PROJECT_ROOT )
11+ fmt .Printf ("[Running] teardown of %s and all underlying evidence\n " , config .PROJECT_ROOT )
1212 return os .RemoveAll (config .PROJECT_ROOT )
1313}
You can’t perform that action at this time.
0 commit comments