ot_remote_builtin_show_url (int argc, char **argv, OstreeCommandInvocation *invocation,
GCancellable *cancellable, GError **error)
{
- g_autoptr (GOptionContext) context = NULL;
+ g_autoptr (GOptionContext) context = g_option_context_new ("NAME");
g_autoptr (OstreeRepo) repo = NULL;
- const char *remote_name;
- g_autofree char *remote_url = NULL;
- gboolean ret = FALSE;
-
- context = g_option_context_new ("NAME");
-
if (!ostree_option_context_parse (context, option_entries, &argc, &argv, invocation, &repo,
cancellable, error))
- goto out;
+ return FALSE;
if (argc < 2)
{
ot_util_usage_error (context, "NAME must be specified", error);
- goto out;
+ return FALSE;
}
- remote_name = argv[1];
+ const char *remote_name = argv[1];
- if (ostree_repo_remote_get_url (repo, remote_name, &remote_url, error))
- {
- g_print ("%s\n", remote_url);
- ret = TRUE;
- }
+ g_autofree char *remote_url = NULL;
+ if (!ostree_repo_remote_get_url (repo, remote_name, &remote_url, error))
+ return FALSE;
-out:
- return ret;
+ g_print ("%s\n", remote_url);
+ return TRUE;
}