mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-12-23 08:46:25 +00:00
fix(cmd unlock): add force flag
This commit is contained in:
parent
ba51d1d062
commit
8b60120342
@ -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
|
||||
|
@ -24,3 +24,9 @@ root 39260 0.0 0.0 6976 2696 pts/11 S+ 19:41 0:00 grep autorest
|
||||
```bash
|
||||
autorestic unlock
|
||||
```
|
||||
|
||||
Use the `--force` to prevent the confirmation prompt if an instance is running.
|
||||
|
||||
```bash
|
||||
autorestic unlock --force
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user