MCPcopy Create free account
hub / github.com/apple/foundationdb / processArg

Method processArg

fdbcli/fdbcli.actor.cpp:925–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

923 }
924
925 int processArg(CSimpleOpt& args) {
926 if (args.LastError() != SO_SUCCESS) {
927 printProgramUsage(program_name.c_str());
928 return 1;
929 }
930
931 switch (args.OptionId()) {
932 case OPT_CONNFILE:
933 clusterFile = args.OptionArg();
934 break;
935 case OPT_API_VERSION: {
936 char* endptr;
937 apiVersion = strtoul((char*)args.OptionArg(), &endptr, 10);
938 if (*endptr != '\0') {
939 fprintf(stderr, "ERROR: invalid client version %s\n", args.OptionArg());
940 return 1;
941 } else if (apiVersion < 700 || apiVersion > ApiVersion::LATEST_VERSION) {
942 // multi-version fdbcli only available after 7.0
943 fprintf(stderr,
944 "ERROR: api version %s is not supported. (Min: 700, Max: %d)\n",
945 args.OptionArg(),
946 ApiVersion::LATEST_VERSION);
947 return 1;
948 }
949 break;
950 }
951 case OPT_MEMORY: {
952 std::string memoryArg(args.OptionArg());
953 memLimit = parse_with_suffix(memoryArg, "MiB").orDefault(8uLL << 30);
954 break;
955 }
956 case OPT_TRACE:
957 trace = true;
958 break;
959 case OPT_TRACE_DIR:
960 traceDir = args.OptionArg();
961 break;
962 case OPT_LOGGROUP:
963 logGroup = args.OptionArg();
964 break;
965 case OPT_TIMEOUT: {
966 char* endptr;
967 exit_timeout = strtoul((char*)args.OptionArg(), &endptr, 10);
968 if (*endptr != '\0') {
969 fprintf(stderr, "ERROR: invalid timeout %s\n", args.OptionArg());
970 return 1;
971 }
972 break;
973 }
974 case OPT_EXEC:
975 exec = args.OptionArg();
976 break;
977 case OPT_NO_STATUS:
978 initialStatusCheck = false;
979 break;
980 case OPT_NO_HINTS:
981 cliHints = false;
982 break;

Callers

nothing calls this directly

Calls 15

fprintfFunction · 0.85
parse_with_suffixFunction · 0.85
printStatusFromJSONFunction · 0.85
LastErrorMethod · 0.80
OptionIdMethod · 0.80
OptionArgMethod · 0.80
OptionSyntaxMethod · 0.80
emplace_backMethod · 0.80
printProgramUsageFunction · 0.70
printVersionFunction · 0.70
printBuildInformationFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected