diff options
Diffstat (limited to 'app/flatpak-builtins-enter.c')
-rw-r--r-- | app/flatpak-builtins-enter.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/app/flatpak-builtins-enter.c b/app/flatpak-builtins-enter.c index 3b3aa64a..89c1b1cf 100644 --- a/app/flatpak-builtins-enter.c +++ b/app/flatpak-builtins-enter.c @@ -124,7 +124,6 @@ flatpak_builtin_enter (int argc, { g_autoptr(GOptionContext) context = NULL; int rest_argv_start, rest_argc; - g_autoptr(FlatpakContext) arg_context = NULL; const char *ns_name[5] = { "user", "ipc", "net", "pid", "mnt" }; int ns_fd[G_N_ELEMENTS (ns_name)]; char pid_ns[256]; @@ -162,9 +161,6 @@ flatpak_builtin_enter (int argc, } } - arg_context = flatpak_context_new (); - g_option_context_add_group (context, flatpak_context_get_options (arg_context)); - if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error)) return FALSE; @@ -275,3 +271,28 @@ flatpak_builtin_enter (int argc, exit (status); } + +gboolean +flatpak_complete_enter (FlatpakCompletion *completion) +{ + g_autoptr(GOptionContext) context = NULL; + g_autoptr(GError) error = NULL; + + context = g_option_context_new (""); + if (!flatpak_option_context_parse (context, options, &completion->argc, &completion->argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, NULL, NULL)) + return FALSE; + + switch (completion->argc) + { + case 0: + case 1: + flatpak_complete_options (completion, global_entries); + flatpak_complete_options (completion, options); + break; + + default: + break; + } + + return TRUE; +} |