• brie@beehaw.org
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    For fun, a shell script for the same functionality:

    #!/bin/sh
    br="$(printf "\n")" # Obtain a line-break
    
    # If RM_CMD is unset, use trash-cli
    if [ -z ${RM_CMD+y} ]; then RM_CMD="trash"; fi
    
    # List of apps. The leading br is necessary for later pattern matching
    apps="$br$(flatpak list --columns=application)" || exit 1
    
    cd ~/.var/app || exit 1
    
    for app in *; do
    	case "$apps" in
    		*"$br$app$br"*) ;; # Matches if $app is in the list (installed)
    		*)
    			printf 'Removing app data %s\n' "${app}"
    			"$RM_CMD" "./${app}"
    			;;
    	esac
    done
    

    (May eat your files)