refactor: make mask/unmask more intuitive

This commit is contained in:
Mark Bailey 2024-09-14 15:35:54 -04:00
parent 2fd5aa3082
commit c7c02a6718

View File

@ -43,24 +43,27 @@ var rootCmd = &cobra.Command{
func downgrade() error {
fmt.Println("Downgrading ", PkgName, "to ", Version)
if Mask && Unmask {
return errors.New("please choose either --mask or --unmask, not both")
}
cmd := exec.Command("flatpak", "update", "--commit="+Version, PkgName)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if Unmask {
unmask()
}
err := cmd.Run()
if err != nil {
return err
}
if Mask && Unmask {
return errors.New("please choose either --mask or --unmask, not both")
}
if Mask {
mask()
} else if Unmask {
unmask()
}
return nil