gboolean flatpak_complete_build_commit_from (FlatpakCompletion *completion) { g_autoptr(GOptionContext) context = NULL; g_autoptr(GFile) dst_repofile = NULL; g_autoptr(OstreeRepo) dst_repo = NULL; g_autoptr(GFile) src_repofile = NULL; g_autoptr(OstreeRepo) src_repo = 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: /* DST-REPO */ flatpak_complete_options (completion, global_entries); flatpak_complete_options (completion, options); flatpak_complete_dir (completion); break; case 2: /* DST-REF */ dst_repofile = g_file_new_for_commandline_arg (completion->argv[1]); dst_repo = ostree_repo_new (dst_repofile); if (ostree_repo_open (dst_repo, NULL, NULL)) flatpak_complete_ref (completion, dst_repo); if (opt_src_repo) { src_repofile = g_file_new_for_commandline_arg (opt_src_repo); src_repo = ostree_repo_new (src_repofile); if (ostree_repo_open (src_repo, NULL, NULL)) flatpak_complete_ref (completion, src_repo); } break; } return TRUE; }
gboolean flatpak_complete_build (FlatpakCompletion *completion) { g_autoptr(GOptionContext) context = 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: /* DIR */ flatpak_complete_options (completion, global_entries); flatpak_complete_options (completion, options); flatpak_complete_dir (completion); break; } return TRUE; }
gboolean flatpak_complete_build_init (FlatpakCompletion *completion) { g_autoptr(GOptionContext) context = NULL; g_autoptr(FlatpakDir) user_dir = NULL; g_autoptr(FlatpakDir) system_dir = NULL; g_autoptr(GError) error = NULL; int i; 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: /* DIR */ flatpak_complete_options (completion, global_entries); flatpak_complete_options (completion, options); flatpak_complete_dir (completion); break; case 2: /* APP */ break; case 3: /* RUNTIME */ case 4: /* SDK */ user_dir = flatpak_dir_get_user (); { g_auto(GStrv) refs = flatpak_dir_find_installed_refs (user_dir, NULL, NULL, opt_arch, FLATPAK_KINDS_RUNTIME, &error); if (refs == NULL) flatpak_completion_debug ("find local refs error: %s", error->message); for (i = 0; refs != NULL && refs[i] != NULL; i++) { g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL); if (parts) flatpak_complete_word (completion, "%s ", parts[1]); } } system_dir = flatpak_dir_get_system_default (); { g_auto(GStrv) refs = flatpak_dir_find_installed_refs (system_dir, NULL, NULL, opt_arch, FLATPAK_KINDS_RUNTIME, &error); if (refs == NULL) flatpak_completion_debug ("find local refs error: %s", error->message); for (i = 0; refs != NULL && refs[i] != NULL; i++) { g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL); if (parts) flatpak_complete_word (completion, "%s ", parts[1]); } } break; case 5: /* BRANCH */ user_dir = flatpak_dir_get_user (); { g_auto(GStrv) refs = flatpak_dir_find_installed_refs (user_dir, completion->argv[3], NULL, opt_arch, FLATPAK_KINDS_RUNTIME, &error); if (refs == NULL) flatpak_completion_debug ("find local refs error: %s", error->message); for (i = 0; refs != NULL && refs[i] != NULL; i++) { g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL); if (parts) flatpak_complete_word (completion, "%s ", parts[3]); } } system_dir = flatpak_dir_get_system_default (); { g_auto(GStrv) refs = flatpak_dir_find_installed_refs (system_dir, completion->argv[3], NULL, opt_arch, FLATPAK_KINDS_RUNTIME, &error); if (refs == NULL) flatpak_completion_debug ("find local refs error: %s", error->message); for (i = 0; refs != NULL && refs[i] != NULL; i++) { g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], NULL); if (parts) flatpak_complete_word (completion, "%s ", parts[3]); } } break; } return TRUE; }