-
-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cleanup sub-command that remove local bugs and identities
- Loading branch information
Showing
6 changed files
with
130 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package commands | ||
|
||
import ( | ||
"fmt" | ||
"github.com/MichaelMure/git-bug/entities/bug" | ||
"github.com/MichaelMure/git-bug/entities/identity" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/MichaelMure/git-bug/commands/execenv" | ||
) | ||
|
||
func newCleanUpCommand() *cobra.Command { | ||
env := execenv.NewEnv() | ||
|
||
cmd := &cobra.Command{ | ||
Use: "cleanup", | ||
Short: "Cleanup git-bug from git repository", | ||
Long: "Cleanup git-bug from git repository", | ||
PreRunE: execenv.LoadRepo(env), | ||
RunE: execenv.CloseBackend(env, func(cmd *cobra.Command, args []string) error { | ||
return runCleanup(env) | ||
}), | ||
} | ||
|
||
return cmd | ||
} | ||
|
||
func runCleanup(env *execenv.Env) error { | ||
|
||
fmt.Println("cleaning bug items..") | ||
err := bug.RemoveAll(env.Repo) | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Println("cleaning identities..") | ||
err = identity.RemoveAll(env.Repo) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters