Commit Graph

1058 Commits

Author SHA1 Message Date
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
Matthias Clasen
ff118dfbc6 completion: Add an api to complete columns
The new function, flatpak_compete_columns, takes an array
of Column structs and completes a --columns= option.

Unfortunately, bash completion does not let us do better
than repeating the entire list of columns for every
possible completion. This is not ideal, but at least
it gives good results for the first column.

Closes: #2445
Approved by: alexlarsson
2019-01-11 14:00:59 +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
4041bf5ac5 info: Minor cleanup
Use existing defines for metadata fields.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Matthias Clasen
5a60f69587 remote-info: Fix unicode formatting issues
printf(), and by extension, g_print() interprets
field width in terms of bytes, not characters.
Therefore, using %*s for padding strings with
non-ASCII characters does not work. Instead, use
the new utility function for aligned lines.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Matthias Clasen
b37a640aea info: Fix unicode formatting issues
printf(), and by extension, g_print() interprets
field width in terms of bytes, not characters.
Therefore, using %*s for padding strings with
non-ASCII characters does not work. Instead, use
the new utility function for aligned lines.

While we are doing this, also fix up the alignment of
the extension sections in the output.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Matthias Clasen
90ade7ad96 Add a utility for printing aligned
Add a new utility for printing

  TITLE: value

while properly handling Unicode wrt to alignment.

This will be shared between info and remote-info.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Matthias Clasen
d3447eb3fa table printer: Properly handle title width
Another case of printf field width not being Unicode
safe.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Matthias Clasen
b3ea2248c7 Fix a few utf8 oversights
We are allowing Unicode output, so we need to
use g_utf8_strlen whenever we want to count the
number of columns occupied by a string.

Closes: #2502
Approved by: alexlarsson
2019-01-11 13:31:10 +00:00
Ryan Gonzalez
f9c9c14a5c Expose whether or not devel was used in .flatpak-info
Closes: #2515
Approved by: alexlarsson
2019-01-11 13:20:35 +00:00
Matthias Clasen
eb950c6502 update: Use ALL_DIRS for completion
It does not change the outcome, but it is nicer
to use the same value in coomplete as for the
main function.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:36 +00:00
Matthias Clasen
c58e21f30d repair: use ONE_DIR for completion
Since we only accept one dir here.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:36 +00:00
Matthias Clasen
75e809bb1a install: Use ONE_DIR flag
Since you can't really install in more than
one location at a time.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:36 +00:00
Matthias Clasen
207419b168 override: Fix completion for --system/--user
These options were not showing up in completion,
despite being accepted by the override command.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
ddd73c98e5 run: Fix completion for --system/--user
These options were not showing up in completion,
and, if present in the commandline, would prevent
further completion, despite being accepted by
the run command.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
d07e85d8ad info: Fix the --installation arg name
The info command has its own --system/--user/--installation
options, but it was not setting a name for the argument
of --installation. This was showing up in the completion
missing a '=' after --installation.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
d7d317dfe1 history: Complete --user/--system
This was missing from the completion function.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
3f717cfb83 Move the typedef for FlatpakCompletion
Move this typedef to flatpak-complete.h, where it
belongs. Also add a autoptr definition for it and use
it to avoid leaking the completion in flatpak-main.c.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +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
e1a68f9e8b repair: Use a quiet transaction
When reinstalling refs during repair, the formatted
output of FlatpakCliTransaction is not appropriate.
Use a FlatpakQuietTransaction instead.

Closes: #2556
Approved by: alexlarsson
2019-01-11 11:42:13 +00:00
Matthias Clasen
7fc4c5f93f install, uninstall, update: Add a --noninteractive option
When --noninteractive is given, use the new FlatpakQuietTransaction.

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
b070b3ccd7 Add FlatpakQuietTransaction
This is FlatpakTransaction subclass that doesn't ask questions
only talks the bare minimum.

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
1dff114e1d info: Add a missing check
Don't consider 'Version:' for indentation when we
don't have version information to show.

Closes: #2521
Approved by: mwleeds
2019-01-09 05:20:13 +00:00
Matthias Clasen
894d61a363 info: Show license information
This seems the right thing to do.

Closes: #2521
Approved by: mwleeds
2019-01-09 05:20:13 +00:00
Matthias Clasen
d57ead8acd remote-info: Show license information
Keep in sync with the info command.

Closes: #2521
Approved by: mwleeds
2019-01-09 05:20:13 +00:00
Matthew Leeds
d157d9ea18 list: Reserve -a to mean --all
When the --app-runtime option was added to the list command, -a was made
its shortcut, but this already belongs to --all, so return it to the
latter.

Closes: #2543
Approved by: matthiasclasen
2019-01-08 12:29:14 +00:00
Matthias Clasen
f2c5747849 Simplify flatpak_option_context_parse
Express more directly what we want to ensure here:
Exactly one of these flags must be set.

Closes: #2510
Approved by: mwleeds
2019-01-08 07:04:54 +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
084b518c4e Add completion for --installation=
Complete all the things.
2019-01-07 21:49:13 -05: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
bb17ea5786 remote-ls: Ellipsize the same columns as list
The columns show the same content, so we should
treat them the same for sizing.

Closes: #2497
Approved by: matthiasclasen
2019-01-08 01:40:54 +00:00
Matthias Clasen
1214390c8a list: Ellipsize options too
The options column shows eol messages, which are long.

Closes: #2497
Approved by: matthiasclasen
2019-01-08 01:40:54 +00:00
Matthias Clasen
cefbbd6e59 table printer: Report actual width
When we can't shrink all the way to the desired
number of columns, report the actual width we've
achieved.

Closes: #2496
Approved by: matthiasclasen
2019-01-08 01:11:49 +00:00
Matthias Clasen
f4e42ec071 table printer: Be more careful with shrink
Ensure that 0 <= shrink[i] <= widths[i],
to avoid bad situations.

Closes: #2496
Approved by: matthiasclasen
2019-01-08 01:11:49 +00:00
Matthias Clasen
a133041bdd table printer: Don't loop forever
After ellipsizing nicely, we try to spread the extra
shortfall around, but we need to stop when we've
exhausted the available shrinkage and give up.

Some tables are just too wide.

This was showing up as an infinite loop with

flatpak remote-ls --columns=app,opt flathub

Closes: #2496
Approved by: matthiasclasen
2019-01-08 01:11:49 +00:00
Matthias Clasen
ee072c24a4 Improve warning handling a bit
We were printing the full program name as prefix for warnings,
which does not really help with readability. Lets just use
the single-char 'F:' prefix for all messages, regardless of
log level.

Closes: #2472
Approved by: matthiasclasen
2019-01-08 00:40:57 +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
Bastien Nocera
b3c785ee09 Add a --installations option
Similar to the --gl-drivers option, print the installation
paths for all system installations, including custom
installations defined in ${sysconfdir}/flatpak/installations.d/

Closes: #2122
Approved by: matthiasclasen
2019-01-08 00:26:17 +00:00
Matthias Clasen
3853ee49bd Add some internal docs
It helps for clarity to write down the expected behavior
of these flags, even if they are not public api.

Closes: #2512
Approved by: matthiasclasen
2019-01-08 00:11:41 +00:00
Matthias Clasen
835b311b61 uninstall: Present the choices clearly
A choice of 1) system 2) system 3) system is not
very useful. Show the refs.

Closes: #2492
Approved by: matthiasclasen
2019-01-07 23:57:09 +00:00
Matthias Clasen
e273bfec5f list, remote-ls: Avoid a stray newline
If we have nothing to print, don't print a stray newline.

Closes: #2461
Approved by: matthiasclasen
2019-01-07 23:10:51 +00:00
Matthias Clasen
8b3bac05f8 info: Don't format size when poking at details
When the -s option is used, it is likely that
the result is getting screenscraped and reparsed.

Make that easier by producing a plain number in
this case.

Closes: #2536
Approved by: mwleeds
2019-01-04 05:50:23 +00:00
Matthias Clasen
4efef1cebd info: Rename a variable for clarity
Closes: #2536
Approved by: mwleeds
2019-01-04 05:50:23 +00:00
Matthias Clasen
d9982d8550 Improve handling of FLATPAK_BUILTIN_FLAG_ONE_DIR
Error out for all combinations of options that specify
more than one installations.

This was showing up e.g. with

flatpak config --installation=extra --system --get languages

Closes: #2511
Approved by: mwleeds
2019-01-03 23:05:31 +00:00
Matthias Clasen
c39ceac02e build-commit-from: Make docs match reality
Move the -s short option from --src-repo to --subject,
as the docs say. This makes more sense, to go with -b
for --body.

Closes: #2527
Approved by: mwleeds
2019-01-03 22:52:51 +00:00
Matthias Clasen
85789dd4ac Tweak the docs for --user/system/--installation
Take out the plurals, and tweak the wording to make
it less misleading.

See: #2509

Closes: #2513
Approved by: mwleeds
2019-01-03 22:38:55 +00:00
Matthias Clasen
d3488af5c7 build-bundle: Reorder options
This is purely cosmetic, but it just does not make
sense to have the --oci option show up in the middle
of gpg-related options.

Closes: #2528
Approved by: mwleeds
2019-01-03 22:22:48 +00:00