27 Commits

Author SHA1 Message Date
Adian Kozlica
4f8b935567 feat: json support for table printer 2025-10-13 13:53:15 +00:00
Chris Williams
cf76cb61ba ps: Add gnome to background portal backend list
This is used for the active and background columns.
2024-03-20 19:42:33 +00:00
Simon McVittie
522a933bc9 app: Use g_info() for messages that will be shown by flatpak -v
This brings us one step closer to being able to stop using the flatpak2
log domain for messages that are exclusive to `flatpak -v -v`.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-15 16:45:35 +00:00
Phaedrus Leeds
600e18567c Add a vim modeline and .editorconfig
To make indentation work with less effort. The modeline was copied from
libostree with minor modification and the .editorconfig from GLib.

The advantage of having both a modeline and an editorconfig is we can
work out of the box on more editor setups, and the modeline allows us to
specify the style with a lot more fine grained control.
2022-08-22 19:48:10 -07:00
Simon McVittie
c68f31d86a build: Consistently include libglnx header as "libglnx.h"
Recent Meson versions have warnings if you add the subprojects
directory as an include path, because the way Meson wants to consume
subprojects is by the subproject's build system producing a Meson
dependency object that encapsulates its include directory. Flatpak
doesn't have a Meson build system yet, but I'm working on that.

libglnx seems to be set up to have the libglnx directory be its include
path instead: for example, ostree (by the author of libglnx) already
uses "libglnx.h" or <libglnx.h> everywhere. Do the same here.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-11 10:32:34 +02:00
Simon McVittie
c2490aad12 app: Use autocleanup for FlatpakTablePrinter
Fixes: https://github.com/flatpak/flatpak/issues/4223
Fixes: https://github.com/flatpak/flatpak/issues/4224
2021-04-16 14:51:47 +02:00
Phaedrus Leeds
91223477d4 app: Handle NULL flatpak_instance_get_app()
Gracefully handle flatpak_instance_get_app() returning NULL, which
happens for example when there is a shell in a runtime, e.g. flatpak run
--command=sh org.gnome.Platform
2020-12-21 09:11:08 +01:00
Alexander Larsson
e633fe0d81 Remove last uses of flatpak_decompose_ref() 2020-11-10 14:32:13 +01:00
Matthias Clasen
5ec73b9a9a ps: Allow showing compositor info
Show active and background state, based on information obtained
from the background portal backend about which apps have (active) windows.

This currently tries all known portal backends in turn. It might
be nicer to have a portal frontend api to query this, or to find
out which backend to talk to.
2019-12-04 13:33:52 +01:00
Matthias Clasen
90c2d24127 ps: Don't hardcode instance column
We were unconditionally adding the instance column,
which causes table headers to be off-by-one when
instance is not among the requested columns.

Change things to only add the instance column
when requested.
2019-12-01 09:39:46 -05:00
Alexander Larsson
05ac7f4833 CLI: Add skip_unique_if_default to Column
Additionally flatpak_table_printer_set_columns now takes a boolean
to say whether the arguments in use are the default.

Closes: #2850
Approved by: matthiasclasen
2019-04-23 13:05:14 +00:00
Matthew Leeds
8d962a686f Run uncrustify
I had to make a few manual edits but other than those the changes look
reasonable.

Closes: #2715
Approved by: matthiasclasen
2019-02-25 18:12:30 +00:00
Matthias Clasen
d1b4719ab8 table printer: Redo column handling
Move expand and ellipsize to the Column struct,
and change flatpak_table_printer_set_column_titles
to flatpak_table_printer_set_columns that sets up
not just the title, but also expand and ellipsize.

Update all callers.

Closes: #2460
Approved by: alexlarsson
2019-01-14 13:35:56 +00:00
Matthias Clasen
dd63d39da2 ps: Simplify completion
There are no non-option arguments here, so need
to parse. We can just complete from the available
options.

Closes: #2585
Approved by: alexlarsson
2019-01-14 11:10:17 +00:00
Matthias Clasen
77bfe8493e Add column completion to all commands
Call flatpak_complete_columns for every command
that understands --columns.

Closes: #2445
Approved by: alexlarsson
2019-01-11 14:00:59 +00:00
Alexander Larsson
17a2174644 CLI: Rename Architecture => Arch in list headers
Its really wasteful to have headers much wider than the
items in the column.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:35 +00:00
Matthias Clasen
dd546ad365 Make FlatpakInstance api public
This can be of use in frontends like GNOME Software.

Closes: #2201
Approved by: alexlarsson
2018-10-08 08:36:23 +00:00
Matthias Clasen
6a199ddeb4 ps: Port to column helpers
Closes: #2090
Approved by: alexlarsson
2018-10-05 15:19:43 +00:00
Matthias Clasen
ef30ef4e88 flatpak ps: port to FlatpakInstance
FlatpakInstance is a new api for representing running instances,
its made just for cases like flatpak ps, so lets use it.
2018-09-03 11:54:19 -04:00
Matthias Clasen
07deb95c6a flatpak ps: Support child pid
The current pid column reports the pid of the bwrap
wrapper process running outside the sandbox. Add a
child-pid column that reports the pid of the main
sandbox process ("PID 1" on the inside).

Closes: #2039
Approved by: alexlarsson
2018-08-29 14:46:47 +00:00
AsciiWolf
29f7393e43 flatpak ps: Fix typo in error message
Closes: #2034
Approved by: alexlarsson
2018-08-28 12:53:06 +00:00
Matthias Clasen
3548932c92 Cosmetic formatting fixes
Closes: #2027
Approved by: alexlarsson
2018-08-28 07:51:12 +00:00
Matthias Clasen
9e0f5dd79e Don't throw an error if there's nothing to show
When the .flatpak directory doesn't exist,
there are no running instances.

Closes: #2027
Approved by: alexlarsson
2018-08-28 07:51:12 +00:00
Matthias Clasen
03bb003f0f flatpak ps: Match uniqe prefixes of column names
So much more convenient to say 'app' than 'application'.

Closes: #2027
Approved by: alexlarsson
2018-08-28 07:51:12 +00:00
Matthias Clasen
ad49ca758c flatpak ps: Support commit as field
Add support for commit and runtime-commit.
We shorten these to 12 characters, as we do
elsewhere.

Closes: #2027
Approved by: alexlarsson
2018-08-28 07:51:12 +00:00
Matthias Clasen
e6f8b564cb Add a --column option
Allow the user to specify what fields to show.
This is ps, after all :)

Closes: #2023
Approved by: alexlarsson
2018-08-27 14:25:15 +00:00
Matthias Clasen
a9d4cc5838 Add a flatpak ps command
This enumerates running Flatpak instances.
For now, we just print the app ID and the PID.
More details can be added in the future.

Closes: #2023
Approved by: alexlarsson
2018-08-27 14:25:15 +00:00