Commit Graph

4505 Commits

Author SHA1 Message Date
Matthias Clasen
7aed19e73a info: Revise the output
Show a description and show the appstream version,
and tidy up the formatting.

This gets us closer to the design in
https://github.com/flatpak/flatpak/wiki/CLI-experimental-design

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
cca8355b72 search: Update the docs
Document the --columns option as we do everywhere.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
9dd70d3744 search: Add columns
Add the standard --columns argument handling to search.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
a0f577862f search: Revise the output
This gets us closer to the design in
https://github.com/flatpak/flatpak/wiki/CLI-experimental-design

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
64b2bb33b1 Export a column helper
Make the find_column function public so we can use
it in more places.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
e843f63804 Add some appstream utilities
Add utilities to load an AsStore for a deployed app,
to get an AsApp for a ref, and to get various pieces
of information from an AsApp.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
f0d4665901 Add ellipsizing to the table printer
Optionally mark a column as ellipsizing.

Currently, this won't work correctly if more
than one column is ellipsizing.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
8d2f76e96e Add a string ellipsizing utility
Add a function to ellipsize a string to a certain length.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
883de69c09 repo, info, remote-info: Share timestamp formatting
Make format_timestamp() a shared utility,
instead of having 3 almost identical copies.

Closes: #2409
Approved by: alexlarsson
2018-12-19 15:45:34 +00:00
Matthias Clasen
1bab520197 Document FLATPAK_ID
Mention this environment variable in flatpak-run(1).

Closes: #2447
Approved by: alexlarsson
2018-12-19 14:35:39 +00:00
Matthias Clasen
f9a73904bd Set a custom prompt
Differentiate sandbox shells by a custom prompt.
We set FLATPAK_ID to the app id, and PS1 to a prompt
using it. PS1 can be overridden by runtimes or --env.

Closes: #2447
Approved by: alexlarsson
2018-12-19 14:35:39 +00:00
Matthias Clasen
8669182716 Fix a remote-ls option clash
When the --app-runtime option was added, we inadvertently
added a conflict between the short options for --all and
this new option. To fix this, remove the short option for
--app-runtime.

Closes: #2441

Closes: #2442
Approved by: mwleeds
2018-12-18 20:03:10 +00:00
Alexander Larsson
d85068aeb3 cli-transaction: Better handle resizes
The terminal size can change between two redraws, and this will also
cause the cursor to move, so we read the window size and current
cursor position each time we redraw instead of at the end of last redraw.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Alexander Larsson
2255e7c73f table-printer: Don't print newlines for skipped rows
Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
9296f741bd update: Print a message if there were no updates
This seems nicer. We say we're looking for updates,
so we should give an update on what we found before
we return.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
e7871a03c6 transaction: Try harder to identify empty transactions
It turns out a transaction can contain operations, and still
nothing happened after it ran - when all operations are skipped.
We only know this when the transaction is fully resolved, but
we may call is_empty from the ready signal or after run returns,
and it seems nice to tell the truth then.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
b2fa8902fd install: Add a friendly message
The initial search for remotes and refs can take a while.
Provide a message similar to what we say for updates.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
3895eacab2 Implement a new commandline UX
Revamp the FlatpakCliTransaction output to be closer to this:
https://github.com/flatpak/flatpak/wiki/CLI-experimental-design

We only do this style of formatting when fancy output is possible.
For plain output, we don't redraw the table and only use '\r'
to rewrite the progress line in-place.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
908703d64a table printer: Add per-column expand api
When we are given a with that is larger than the content we have,
expand the space between columns, within reason. We only make the
table at most 1.5 times as wide as it would be unexpanded.

Add a new API for setting individual columns to expand (or not).
For an expanding column, we'll grow the space between it and its
preceding column. The expand flag of the first column is ignored.

By default, columns do not expand.

Make flatpak_table_printer_print_full return not just the table
height, but also the width.

Update all callers.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
3a3ec26ebf transaction: Add api to get the start time of progress
This lets us calculate the download speed, and estimated
time remaining.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
030eb4de3f transaction: Add api to get transferred size
Add a function to FlatpakTransactionProgress to get the
number of transferred bytes. This is useful information
to show during a long-running download.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
3fe15ef665 table printer: Add a decimal cell setter
The download column really hsold be decimal, and we want
to update it while the download is running.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
11532d3f5b Use the new utility function throughout
This gives us consistency and improved output.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
a5b9b59c7b Add a utility for formatting choices
This prints the common pattern of

Choices:

  1) bla
  2) bla

with consistent formatting, so we don't have
to worry about matching newlines and spaces
all over the codebase.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
bc652bee99 Disable fancy output for --verbose
The spew of verbose messages makes a mess of any
attempt at formatted output, so lets not try.
Just disable fancy output when --verbose or
--ostree-verbose is used.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
ba92cb7126 Add a way to disable fancy output
We disable fancy output when we can detect it,
but it is a good idea to have a way to explicitly
opt out too.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
19368bd00b transaction: Add api for sizes
Add api to get the download and installed size
of resolved operations. This is useful information
to present to the user before running the transaction.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
03d197f302 p2p resolve: Return sizes as well
Make flatpak_dir_resolve_p2p_refs return the
download and installed sizes as well. This is
useful information to present to the user before
doing an install or update.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
8fa0f73067 table printer: Add cell and row apis
Add a way to change individual cells and  a getter for the
current row. Also add a variation of the print() method that
returns the number of terminal rows that was generated
when formatting to given width, while skipping a number
of rows at the beginning. This method will be used in the
following commit to print a part of the table into a terminal
window of a given size.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
732ee49fee Add some tty handling utilities
Add a function to query the window size and cursor position,
and definitions for some more ANSI escape sequences that we
will use in the following commits.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
970697f21c transaction: Add useful details to the docs
The guaranteed sequence of signals is useful information
for any user this api.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
5d068ab7f8 Fix another small memory leak
g_variant_iter_loop is tricky - if you exit the loop via
break or return, you have to clean up.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthias Clasen
ce8d976af2 system-helper: Plug a small memory leak
g_variant_loop only takes care of memory handling if
you don't jump out of the loop.

Closes: #2371
Approved by: alexlarsson
2018-12-18 14:50:26 +00:00
Matthew Leeds
a092c0784c README: Fix some punctuation
Use an em dash instead of two hyphens, so the Markdown isn't rendered as
a bullet point in the middle of a paragraph.
2018-12-17 13:42:11 -08:00
Matthias Clasen
0666e9fc25 Some tweaks to README wording
This reads a bit smoother in a few places.

Closes: #2438
Approved by: alexlarsson
2018-12-17 08:39:33 +00:00
Matthias Clasen
dc5a451389 Add docs for flatpak-spawn
Add a flatpak-spawn(1) man page. While it is not ideal
to have the docs live separately from the code, having
it here ensures that it will be available everywhere
all the other flatpak documentation is.

Closes: #2437
Approved by: alexlarsson
2018-12-17 08:29:52 +00:00
Matthias Clasen
62332f9389 portal: Improve docs
I could not work out at all how exposing files works,
until I looked at the code. Put enough details in the
docs to spare the next person this fate.

Closes: #2437
Approved by: alexlarsson
2018-12-17 08:29:52 +00:00
Matthias Clasen
9a1febd981 portal: Suport a watch-bus flag
This behaves just the same as the watch-bus flag that
was reently added to HostCommand.

Closes: #2439
Approved by: alexlarsson
2018-12-17 08:16:42 +00:00
Matthias Clasen
f53ef41032 portal: validate arguments better
Portals need to validate all their arguments.
We were not validating flags at all, and were not
very careful with some of the other arguments
either.

Closes: #2439
Approved by: alexlarsson
2018-12-17 08:16:42 +00:00
Matthias Clasen
07a0fd2811 Document the new env vars
Closes: #2440
Approved by: alexlarsson
2018-12-17 08:14:43 +00:00
Matthias Clasen
2a8a0ec69a Pass host xdg dirs into the sandbox
There are some use cases where apps might legitimately need
to know the host values of xdg variables. Since we use them
for our own purposes, we can't just propagate them as-is.
Instead, set HOST_XDG_{DATA,CONFIG,CACHE}_HOME if the corresponding
xdg variables are set on the host.

Closes: #2424

Closes: #2440
Approved by: alexlarsson
2018-12-17 08:14:43 +00:00
Matthias Clasen
d13211f5e6 Merge pull request #2434 from matthiasclasen/compiler-warning
Silence compiler warnings
2018-12-15 09:12:00 -05:00
Matthias Clasen
0261fb5d38 Silence compiler warnings
clang was complaining about a number of unused
variables in testlibrary.c. Drop them
2018-12-14 20:56:52 -05:00
Matthias Clasen
11a9bef97e Merge pull request #2432 from aleixpol/clangbuild
Fix build with clang
2018-12-14 15:55:51 -05:00
Matthias Clasen
041c99d834 Merge pull request #2431 from aleixpol/master
Don't use the last percentage if the total size changed
2018-12-14 13:35:59 -05:00
Aleix Pol
192066517c Fix build with clang
Fixes #2430
2018-12-14 18:50:05 +01:00
Aleix Pol
b6eddbccff Don't use the last percentage if the total size changed
It happens sometimes that the first processed total is 1, when this gets
downloaded we have 100% already and then the total changes making this
percentage faulty.
This makes the progress regress sometimes, but I'd say it's better than
a permanent, ficticious number.

Fixes #2428
2018-12-14 18:27:17 +01:00
Matthias Clasen
06019e357d Merge pull request #2427 from matthiasclasen/wording-tweak
Revise some strings slightly
2018-12-13 00:28:59 -05:00
Matthias Clasen
0a7fc79647 Revise some strings slightly
This reads better when seen in action.
2018-12-12 23:53:45 -05:00
Matthew Leeds
fa9225344e app: Make single-choice prompts friendlier
When we're prompting the user to choose between a list of items but
there's only one item, use a yes/no prompt and different wording.

Closes: #2426
Approved by: matthiasclasen
2018-12-13 04:30:48 +00:00