revanced-cli icon indicating copy to clipboard operation
revanced-cli copied to clipboard

feat: Improve unmount validation

Open laur89 opened this issue 8 months ago • 0 comments

Feature description

Improve utility uninstall output & argument validation. Current exit code & stdout messages always imply the operation was successful (and that anything was done at all).

  1. Example one: phone not connected to PC:
$ java -jar revanced-cli-5.0.1-all.jar utility uninstall --package-name com.no.such.pkg --unmount
SEVERE: app.revanced.library.installation.installer.DeviceNotFoundException: No ADB device found 
INFO: Uninstalled the patched APK file
  1. Example two: adb link exists, but unmounting a nonexisting package:
$ java -jar revanced-cli-5.0.1-all.jar utility uninstall --package-name com.no.such.pkg --unmount
WARNING: No device serial supplied. Using device with serial b7a7a89a 
INFO: Uninstalling com.no.such.pkg by unmounting 
INFO: Uninstalled the patched APK file

Same happens with existing packages that were not mounted to begin with. Also it's not limited to --unmount option - uninstall operation without it always appear to succeed the same.


It would be useful if there were validation done whether the package:

  1. we're operating on is installed;
  2. is even mounted - if not, --unmount operation should error out;

Basically, process should exit with 0 only if the requested operation was actually performed & successful.

Motivation

Appropriate exit code & stdout/stderr messages make it easier too detect user error. Easy to make typos with longer package names, and if exit code & messaging is always successful, it's hard to tell whether intended action was completed.

Arguably it's also a bug if it always prints INFO: Uninstalled the patched APK file, even if package isn't installed.

Acknowledgements

  • [x] I have checked all open and closed feature requests and this is not a duplicate.
  • [x] I have chosen an appropriate title.
  • [x] All requested information has been provided properly.

laur89 avatar Apr 19 '25 02:04 laur89