fix(cmd unlock): add force flag

This commit is contained in:
rwxd
2023-10-10 21:23:17 +02:00
parent ba51d1d062
commit 8b60120342
2 changed files with 10 additions and 1 deletions

View File

@@ -20,7 +20,9 @@ To check you can run "ps aux | grep autorestic".`,
Run: func(cmd *cobra.Command, args []string) {
internal.GetConfig()
if isAutoresticRunning() {
force, _ := cmd.Flags().GetBool("force")
if !force && isAutoresticRunning() {
colors.Error.Print("Another autorestic instance is running. Are you sure you want to unlock? (yes/no): ")
var response string
fmt.Scanln(&response)
@@ -42,6 +44,7 @@ To check you can run "ps aux | grep autorestic".`,
func init() {
rootCmd.AddCommand(unlockCmd)
unlockCmd.Flags().Bool("force", false, "force unlock")
}
// isAutoresticRunning checks if autorestic is running