✨ (flatpak-sync) Add remove/uninstall command
The remove/uninstall command takes a application id as a second parameter and removes it from the apps list. Afterwards the sync method is called. Refs: #1
This commit is contained in:
parent
47cf7333b6
commit
38fe45f724
1 changed files with 24 additions and 0 deletions
|
@ -56,6 +56,26 @@ function add() {
|
||||||
echo "$appId" >> "$appsListFile"
|
echo "$appId" >> "$appsListFile"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remove() {
|
||||||
|
local appId="${2:-}"
|
||||||
|
|
||||||
|
if [[ -z "$appId" ]]; then
|
||||||
|
echo "No application ID given."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep "$appId" "$APPS_LIST_PATH"; then
|
||||||
|
echo "App not in apps list."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
local appsListFile
|
||||||
|
appsListFile="$(realpath "$APPS_LIST_PATH")"
|
||||||
|
appsListTmpFile="$(mktemp)"
|
||||||
|
grep -v "$appId" "$APPS_LIST_PATH" >> "$appsListTmpFile"
|
||||||
|
mv "$appsListTmpFile" "$appsListFile"
|
||||||
|
}
|
||||||
|
|
||||||
cmd="${1:-}"
|
cmd="${1:-}"
|
||||||
|
|
||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
|
@ -63,6 +83,10 @@ case "$cmd" in
|
||||||
add "$@"
|
add "$@"
|
||||||
sync
|
sync
|
||||||
;;
|
;;
|
||||||
|
r|remove|u|uninstall )
|
||||||
|
remove "$@"
|
||||||
|
sync
|
||||||
|
;;
|
||||||
* )
|
* )
|
||||||
sync
|
sync
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue