✨ (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:
parent
921aa2e033
commit
47cf7333b6
1 changed files with 28 additions and 1 deletions
|
@ -38,4 +38,31 @@ function sync() {
|
|||
done
|
||||
}
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue