(flatpak-sync) Add add/install command

The add/install command takes a application id as a second parameter
and appends it to the apps list. Afterwards the sync method is called.

Refs: #1
This commit is contained in:
Marcel Kapfer 2023-07-20 21:39:43 +02:00
parent 921aa2e033
commit 47cf7333b6
Signed by: mmk2410
GPG Key ID: CADE6F0C09F21B09
1 changed files with 28 additions and 1 deletions

View File

@ -38,4 +38,31 @@ function sync() {
done
}
sync
function add() {
local appId="${2:-}"
if [[ -z "$appId" ]]; then
echo "No application ID given."
exit 1
fi
if grep "$appId" "$APPS_LIST_PATH"; then
echo "App already in apps list. Run with sync command to install."
exit 2
fi
local appsListFile
appsListFile="$(realpath "$APPS_LIST_PATH")"
echo "$appId" >> "$appsListFile"
}
cmd="${1:-}"
case "$cmd" in
a|add|i|install )
add "$@"
sync
;;
* )
sync
esac