# Command line: Flatpak

Date: 2021-06-04 07:39:11 +08:00Date modified: 2021-11-08 20:12:02 +08:00

Flatpak is a cross-Linux-distro deployment system commonly used for packaging desktop applications.

# Options

Flatpak has a similar interface to Git being composed of subcommands with specific options.

- `-v, --verbose` - just print more information

Most of the query-related subcommands (e.g., `search`, `list`) has the following options.

- `--columns=${COLUMNS}` - print the columns listed; useful for extracting the information you want you can find the related fields from the respective manual page

# Subcommands

- `info PACKAGE [BRANCH]` prints related information of the package.

  - `-M, --show-permissions` prints the permissions of the package in a INI-like format.

  - `-m, --show-metadata` prints the metadata in a INI-like format.

- `remote-ls [REMOTE]` lists all of the packages of the given remote.

  - `--app` only includes standalone applications.

  - `--runtime` only lists runtimes.

# Examples

Flatpak has a lot of stuff so we'll bring some examples to get started.

## Basic usage

Or at least how I think it would be for a starting user.

    flatpak search ferdi

    flatpak install ferdi

    flatpak uninstall ferdi

## Package installation interface

fzf is the star here.

    flatpak search ${QUERY} --columns=application \
        | fzf --multi --prompt "Choose Flatpak package(s) to install > " \
        | xargs --replace="{}" flatpak install --noninteractive {}

## Package uninstallation interface

If there's one for installing packages, there's also one for removing them.

    flatpak list ${QUERY} --columns=application \
        | fzf --multi --prompt "Choose Flatpak package(s) to remove > " \
        | xargs --replace="{}" flatpak uninstall --noninteractive {}