59 Commits

Author SHA1 Message Date
Alexander Larsson
8b3966ecd0 Revert "cli transaction: Make the checks green"
This reverts commit e209ac9e10.

We're counting thee escape sequences as width, until we fix
this we disable this.

Closes: #2686
Approved by: alexlarsson

(cherry picked from commit 2ea428a541)
2019-02-06 11:25:35 +01:00
Alexander Larsson
06a2f4d82d Actually always return non-null from flatpak_dir_get_display_name()
This also changes this to a non-const as we need to generate it.

Closes: #2683
Approved by: alexlarsson
2019-02-05 11:45:54 +00:00
Matthias Clasen
e209ac9e10 cli transaction: Make the checks green
Success ought to be green.

Related: #2671

Closes: #2676
Approved by: mwleeds
2019-02-02 01:38:32 +00:00
Matthias Clasen
d5e2970725 cli transaction: Adapt to an api change
In f7a566e2ab, the flatpak_installation_get_display_name()
api was changed to (almost) always return a non-NULL string. Adapt
to this change, in order to use the preferred messages here.

Closes: #2655

Closes: #2668
Approved by: alexlarsson
2019-02-01 16:30:17 +00:00
Matthias Clasen
c9430b15f8 cli transaction: Use raw mode
We don't want line editing to interfere with our
formatting, so we turn on raw mode while we do
fancy progress reporting. We use raw mode at the
same times as we hide the cursor.

This should prevent partial Escape sequences from
showing up in the output.

Closes: #2638
Approved by: alexlarsson
2019-01-25 12:03:47 +00:00
Matthew Leeds
ec61e6aac6 cli-transaction: Fix a typo
Closes: #2575
Approved by: alexlarsson
2019-01-17 07:40:29 +00:00
Matthias Clasen
a9388c7801 cli transaction: Use the cursor utiltiies
Closes: #2570
Approved by: alexlarsson
2019-01-14 11:41:42 +00:00
Alexander Larsson
a3d109de8f cli-transaction: Use Op instead of Change for title
This uses less horizontal space, given that all the elements in the
column is one-character strings. Also, Op seems to better describe this
than Change.

Closes: #2560
Approved by: alexlarsson
2019-01-11 14:51:44 +00:00
Matthias Clasen
92b0ad5f7e Handle out-of-space errors nicer
Ostree just gives us a generic G_IO_ERROR_FAILED (boo!),
so we need to scrape the message to infer that this was
out-of-space. Translate this to an explicit error code
that we handle in the UI.

Closes: #2477
Approved by: alexlarsson
2019-01-11 13:46:31 +00:00
Matthias Clasen
0f2c45be4d Drop flatpak_cli_transaction_was_aborted
We can look at the error that is returned
by flatpak_transaction_run, no need for this
cli-transaction specific api.

Note that we need to be a little careful to
return the expected error: when there is
an operation error, we need to return that,
instead of an ABORTED error.

Update all users.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
a4ea1dc653 Fix a typo
I wonder how the compiler made sense of this.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
e1d634c0dd cli transaction: Drop flatpak_cli_transaction_run
We can just implement the run vfunc now, and chain up.

Update all callers to use flatpak_transaction_run.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
fd44da76e3 Drop flatpak_cli_transaction_install
Move this minor convenience api into its only user.
Using only generic FlatpakTransaction apis lets us
switch out transaction instances easily.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
6e11cf85b1 Make progress bar faint
The solid blocks are very prominent when used
at full intensity. Lets tone them down.

Closes: #2469
Approved by: mwleeds
2019-01-08 06:08:56 +00:00
Matthias Clasen
9884b056fd Fully translate a prompt
We were not translating the strings 'user' and 'system'
here, although we should.

Closes: #1984

Closes: #2520
Approved by: matthiasclasen
2019-01-08 01:56:25 +00:00
Matthias Clasen
2c794c5d82 Don't let g_warnings disrupt us
Some code paths deep inside flatpak-dir.c use
g_warning to report non-fatal errors. This disrupts
our table formatting without showing up visibly
in the output (since it gets wiped out by the next
redraw). Improve things by installing our own
message handler and showing these messages properly
inside our table, like other errors.

Closes: #2472
Approved by: matthiasclasen
2019-01-08 00:40:57 +00:00
Matthias Clasen
a2e2068f67 Fix a copy-paste error
There was a copy-paste error causing us to show
system bus ownership wrongly in the permission
table, and causing the footnote numbering to be
out of sync.

Closes: #2535
Approved by: mwleeds
2019-01-03 20:51:13 +00:00
Matthias Clasen
a5154d610f Cleaner progress display
With the new solid Unicode progress bar, we no
longer need the [] around it.  Drop it.

Closes: #2453
Approved by: alexlarsson
2018-12-21 08:29:33 +00:00
Matthias Clasen
6b59406e80 Consistently use Unicode ellipsis
Now that we're moving away from a pure ASCII esthetic,
it looks odd to me to have a mixture of 3 dots and
proper ellipsis, so switch everything over to use
U+2026 instead of 3 dots.

Some minor other formatting and string changes
are included here as well.

Closes: #2454
Approved by: alexlarsson
2018-12-21 08:07:25 +00:00
Matthias Clasen
c2e9dc2832 Hide the cursor while displaying progress
The cursor interferes with our fancy redraw
and progress, so hide it while we are doing that.

Closes: #2455
Approved by: alexlarsson
2018-12-21 08:06:49 +00:00
Alexander Larsson
54d3ceb9b8 cli-transaction: Fix up sizing of download column
We need to take the "< " part into consideration when even when counting
the size of string without it, because they align the same. Otherwise
we cause the column to resize and wrap.

Closes: #2449
Approved by: alexlarsson
2018-12-20 12:51:32 +00:00
Alexander Larsson
830a750d20 cli: Limit length of progress bar
This limits the witdh of the progress bar, because it looked really
weird on a wide terminal and kept changing width as the text at the
end (speed, time left, etc) changed.

It is now never more than 20 chars wide, which is fine with the
new increase in fidelity using unicode blocks.

Closes: #2449
Approved by: alexlarsson
2018-12-20 12:51:32 +00:00
Alexander Larsson
4514286596 CLI: Use unicode chars in progress reporting
There are unicode full blocks and 1/8ths horizontal parts of a block, so
we can use this for the progress bar to get a lot more fidelity.

Closes: #2449
Approved by: alexlarsson
2018-12-20 12:51:32 +00:00
Alexander Larsson
0a825c298b Use unicode chars for in-table progress.
We use unicode chars like ✓, ⍻ and ✗ for the checkmark area in the table.
Also use an em-dash instead of minus in the spinner.

Closes: #2449
Approved by: alexlarsson
2018-12-20 12:51:32 +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
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
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
efa901ff39 Disable PolicyKit dialogs for --assumeyes
The flag is really meant to disable all interaction,
and this includes PolicyKit dialogs.

Closes: #2389
Approved by: alexlarsson
2018-12-06 15:24:35 +00:00
Matthias Clasen
6d95383050 cli transaction: Improve progress handling
Arrange for progress to be done before we
ask for polkit auth, so we don't end up with
the text prompt mushed into the progress display.

Closes: #2379
Approved by: alexlarsson
2018-12-06 15:01:14 +00:00
Matthew Leeds
a22dfbd7c1 Default to only choice in multiple choice prompts
This commit implements a feature in the multiple choice prompt that
mirrors the behavior in the yes/no prompt where it can default to "yes"
when the user only presses Enter. In the case of the multiple choice
prompt, it only defaults to the first choice on Enter if there's only
one option (e.g. you're asked if you want to install from the "flathub"
remote as opposed to being asked to choose between the "flathub" and
"eos-apps" remotes).

This feature can be turned off on a per-prompt basis if we want explicit
user input for something but I didn't find that necessary for any of the
existing prompts.

Also note that as with the yes/no prompt defaulting to yes on Enter,
this only applies for interactive terminals. If Flatpak is being run by
a script no choice will be made automatically.

This should save users unnecessary keystrokes, such as when they use
"flatpak install devhelp" and are asked to confirm that the Flathub
remote is the one to use (now they can just press Enter).

Closes: #2288
Approved by: matthiasclasen
2018-11-06 02:48:06 +00:00
Matthew Leeds
7b1a5c4fb9 Allow yes/no prompt to default to yes
Currently when the Flatpak command line prompts the user with a yes or
no question, the user must type "y" or "n" to respond. This commit
changes it so that the prompt can assume "yes" if the user just presses
Enter. In that case the prompt ends in "[Y/n]" rather than "[y/n]". If
there are some operations that are considered dangerous, we can still
require explicit user input on those, but as far as I can tell those
criteria don't apply to any existing prompts.

This behavior of allowing the user to just press Enter is consistent
with how apt works for example.

Note that this is distinct from the "--assume-yes" option we have, since
that won't prompt the user at all when a decision needs to be made.

Closes: #2113
Approved by: matthiasclasen
2018-10-31 22:48:56 +00:00
Matthias Clasen
3f0eb7e481 transaction: Fix up a signal signature
We were emitting the ::operation-done signal with
different arguments than declared for the signal.
This showed up as test failure when comparing
the result argument.

Closes: #2187
Approved by: alexlarsson
2018-10-05 13:34:49 +00:00
Patrick Griffis
8f924de730 transaction: Print tags on install
This is specifically useful for the `properietary` tag that is
used on flathub.

Closes: #1992
Approved by: alexlarsson
2018-08-27 10:47:10 +00:00
Matthew Leeds
792a5c0606 transaction: Print newline character after error messages
Closes: #1979
Approved by: alexlarsson
2018-08-17 09:34:34 +00:00
Alexander Larsson
3f4518b15c Run uncrustify
Closes: #1870
Approved by: alexlarsson
2018-07-08 10:05:37 +00:00
Alexander Larsson
c0ebd3a121 transaction: Move flatpakref installation to transaction code
This adds the flatpak_transaction_add_install_flatpakref method
to easily install from flatpakref files. It additionally
adds a new signal called add-new-remote which is called in two
cases:

 To ask if the user wants to add a "normal" remote for the url
 specified by a flatpakref file.

 When a new remote is required for the runtimes the application
 depends on.

Closes: #1868
Approved by: alexlarsson
2018-07-07 15:38:46 +00:00
Alexander Larsson
f504656890 transaction: Mark error const in operation-error signal
Closes: #1841
Approved by: alexlarsson
2018-06-29 12:56:15 +00:00
Alexander Larsson
80a33e6a1b CliTransaction: Print permissions in ready callback
This is a pretty lowlevel version of the permissions, and there
is no nice API for the library to produce these. However its got
the basics of permission tracking.

Closes: #1799
Approved by: alexlarsson
2018-06-19 14:54:22 +00:00
Alexander Larsson
0515e49140 transaction: Add APIs to set dependency sources
Closes: #1797
Approved by: alexlarsson
2018-06-19 08:30:21 +00:00
Alexander Larsson
5e8b5e5319 Transaction: Use flatpakTransactionOperation in signals
This changes the signals to use a FlatpakTransactionOperation
argument instead of a bunch of arguments in the signal, making
this easier to extend in the future.

This is an API break, but nobody is using this API yet, and it
was only available in one unstable release.

Closes: #1797
Approved by: alexlarsson
2018-06-19 08:30:21 +00:00
Alexander Larsson
ffaf2d5386 Cli transaction: Print the full uninstall/install/update lists in ready
This lets you see what operations will happen and you can confirm
it before starting the heavy operations.

Closes: #1797
Approved by: alexlarsson
2018-06-19 08:30:21 +00:00
Alexander Larsson
3367938432 update: Don't update appdata if transaction was aborted by user
Closes: #1797
Approved by: alexlarsson
2018-06-19 08:30:21 +00:00
Alexander Larsson
715cc173ef Transactions: Add uninstall operation and handle no-pull correctly
In the no-pull case and when uninstalling, we never want to do any network
i/o for e.g. detecting depenedencies.

Closes: #1744
Approved by: alexlarsson
2018-06-01 10:59:14 +00:00
Alexander Larsson
91957b5c61 transaction: strdup progress status in getter
This way we're safe from reentrant use of the progress
2018-05-29 16:37:21 +02:00
Alexander Larsson
9fe81aaf90 Transaction: Add (and use) vfuncs for signals 2018-05-29 16:37:21 +02:00
Alexander Larsson
75ba77712a transaction: Derive FlatpakCliTransaction from FlatpakTransaction 2018-05-29 16:37:21 +02:00
Alexander Larsson
d2e419418b transaction: Change from installation_create_transaction() to transaction_new_for_installation()
This way is nicer because then the user can derive from FlatpakTransaction
2018-05-29 16:37:21 +02:00
Alexander Larsson
89e673ff70 Rename FlatpakTransactionError to FlatpakTransactionErrorDetails
This makes it more obvious that this is not a GError enum
2018-05-29 16:37:21 +02:00
Alexander Larsson
bb62296785 Transaction: Move progress to FlatpakTransactionProgress object 2018-05-29 16:37:21 +02:00
Alexander Larsson
74114d947b Transaction: Move operation done to signal 2018-05-29 16:37:21 +02:00