subcmd_remove,
subcmd_rename,
subcmd_seturl,
- subcmd_show,
+ subcmd_show
};
-struct opts {
+struct remote_opts {
enum subcmd cmd;
/* for command-specific args */
char **argv;
};
-static int cmd_add(git_repository *repo, struct opts *o);
-static int cmd_remove(git_repository *repo, struct opts *o);
-static int cmd_rename(git_repository *repo, struct opts *o);
-static int cmd_seturl(git_repository *repo, struct opts *o);
-static int cmd_show(git_repository *repo, struct opts *o);
+static int cmd_add(git_repository *repo, struct remote_opts *o);
+static int cmd_remove(git_repository *repo, struct remote_opts *o);
+static int cmd_rename(git_repository *repo, struct remote_opts *o);
+static int cmd_seturl(git_repository *repo, struct remote_opts *o);
+static int cmd_show(git_repository *repo, struct remote_opts *o);
static void parse_subcmd(
- struct opts *opt, int argc, char **argv);
+ struct remote_opts *opt, int argc, char **argv);
static void usage(const char *msg, const char *arg);
-int main(int argc, char *argv[])
+int lg2_remote(git_repository *repo, int argc, char *argv[])
{
int retval = 0;
- struct opts opt = {0};
- git_buf buf = GIT_BUF_INIT_CONST(NULL, 0);
- git_repository *repo = NULL;
+ struct remote_opts opt = {0};
parse_subcmd(&opt, argc, argv);
- git_libgit2_init();
-
- check_lg2(git_repository_discover(&buf, ".", 0, NULL),
- "Could not find repository", NULL);
-
- check_lg2(git_repository_open(&repo, buf.ptr),
- "Could not open repository", NULL);
- git_buf_free(&buf);
-
switch (opt.cmd)
{
case subcmd_add:
break;
}
- git_libgit2_shutdown();
-
return retval;
}
-static int cmd_add(git_repository *repo, struct opts *o)
+static int cmd_add(git_repository *repo, struct remote_opts *o)
{
char *name, *url;
git_remote *remote = {0};
return 0;
}
-static int cmd_remove(git_repository *repo, struct opts *o)
+static int cmd_remove(git_repository *repo, struct remote_opts *o)
{
char *name;
return 0;
}
-static int cmd_rename(git_repository *repo, struct opts *o)
+static int cmd_rename(git_repository *repo, struct remote_opts *o)
{
int i, retval;
char *old, *new;
puts(problems.strings[0]);
}
- git_strarray_free(&problems);
+ git_strarray_dispose(&problems);
return retval;
}
-static int cmd_seturl(git_repository *repo, struct opts *o)
+static int cmd_seturl(git_repository *repo, struct remote_opts *o)
{
int i, retval, push = 0;
char *name = NULL, *url = NULL;
return 0;
}
-static int cmd_show(git_repository *repo, struct opts *o)
+static int cmd_show(git_repository *repo, struct remote_opts *o)
{
int i;
const char *arg, *name, *fetch, *push;
git_remote_free(remote);
}
- git_strarray_free(&remotes);
+ git_strarray_dispose(&remotes);
return 0;
}
static void parse_subcmd(
- struct opts *opt, int argc, char **argv)
+ struct remote_opts *opt, int argc, char **argv)
{
char *arg = argv[1];
enum subcmd cmd = 0;