Rename the "metadata regenerate" command to "regenerate metadata"
[lttng-tools.git] / src / bin / lttng / commands / metadata.c
index 0faf4172a370349fabb2e8a46e7283d634b4bab6..08d6e5894cdf8366b215329789e03616cd75d944 100644 (file)
@@ -55,23 +55,6 @@ static struct cmd_struct actions[] = {
        { NULL, NULL }  /* Array closure */
 };
 
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
-       fprintf(ofp, "usage: lttng metadata [OPTION] ACTION\n");
-       fprintf(ofp, "\n");
-       fprintf(ofp, "Actions:\n");
-       fprintf(ofp, "   regenerate\n");
-       fprintf(ofp, "      Regenerate and overwrite the metadata of the session.\n");
-       fprintf(ofp, "Options:\n");
-       fprintf(ofp, "  -h, --help               Show this help.\n");
-       fprintf(ofp, "      --list-options       Simple listing of options.\n");
-       fprintf(ofp, "  -s, --session NAME       Apply to session name.\n");
-       fprintf(ofp, "\n");
-}
-
 /*
  * Count and return the number of arguments in argv.
  */
@@ -92,10 +75,16 @@ static int metadata_regenerate(int argc, const char **argv)
 {
        int ret;
 
-       ret = lttng_metadata_regenerate(session_name);
+       if (argc > 1) {
+               ret = -LTTNG_ERR_INVALID;
+               goto end;
+       }
+       ret = lttng_regenerate_metadata(session_name);
        if (ret == 0) {
                MSG("Metadata successfully regenerated for session %s", session_name);
        }
+
+end:
        return ret;
 }
 
@@ -105,7 +94,7 @@ static int handle_command(const char **argv)
        int ret = CMD_SUCCESS, i = 0, argc, command_ret = CMD_SUCCESS;
 
        if (argv == NULL) {
-               usage(stderr);
+               ERR("argv is null");
                command_ret = CMD_ERROR;
                goto end;
        }
@@ -165,7 +154,7 @@ int cmd_metadata(int argc, const char **argv)
        static poptContext pc;
 
        if (argc < 1) {
-               usage(stderr);
+               SHOW_HELP();
                ret = CMD_ERROR;
                goto end;
        }
@@ -199,7 +188,7 @@ int cmd_metadata(int argc, const char **argv)
        while ((opt = poptGetNextOpt(pc)) != -1) {
                switch (opt) {
                case OPT_HELP:
-                       usage(stdout);
+                       SHOW_HELP();
                        goto end;
                case OPT_LIST_OPTIONS:
                        list_cmd_options(stdout, long_options);
@@ -208,7 +197,7 @@ int cmd_metadata(int argc, const char **argv)
                        list_commands(actions, stdout);
                        goto end;
                default:
-                       usage(stderr);
+                       SHOW_HELP();
                        ret = CMD_UNDEFINED;
                        goto end;
                }
This page took 0.025166 seconds and 4 git commands to generate.