int cmd_commit_graph(int argc, const char **argv, const char *prefix) { static struct option builtin_commit_graph_options[] = { OPT_STRING(0, "object-dir", &opts.obj_dir, N_("dir"), N_("The object directory to store the graph")), OPT_END(), }; if (argc == 2 && !strcmp(argv[1], "-h")) usage_with_options(builtin_commit_graph_usage, builtin_commit_graph_options); git_config(git_default_config, NULL); argc = parse_options(argc, argv, prefix, builtin_commit_graph_options, builtin_commit_graph_usage, PARSE_OPT_STOP_AT_NON_OPTION); if (argc > 0) { if (!strcmp(argv[0], "read")) return graph_read(argc, argv); if (!strcmp(argv[0], "verify")) return graph_verify(argc, argv); if (!strcmp(argv[0], "write")) return graph_write(argc, argv); } usage_with_options(builtin_commit_graph_usage, builtin_commit_graph_options); }
bool graph_save(graph_t *self, char *path) { FILE *f; if ((f = fopen(path, "wb")) == NULL) { return false; } bool status = graph_write(self, f); fclose(f); return status; }
void analysis_export(gchar *name) { struct model_pak *model; model = sysenv.active_model; g_assert(model != NULL); dialog_destroy_type(FILE_SELECT); if (model->graph_active) { graph_write(name, model->graph_active); gui_text_show(STANDARD, "Successfully exported graph.\n"); } else gui_text_show(WARNING, "Current model is not a graph.\n"); }