| 184 | } |
| 185 | |
| 186 | int main(int raw_argc, char ** raw_argv) { |
| 187 | const std::vector<std::string> argv = ingest_args(raw_argc, raw_argv); |
| 188 | const int argc = argv.size(); |
| 189 | |
| 190 | if (argc <= 1) { |
| 191 | print_usage_information(argv[0].c_str()); |
| 192 | return 1; |
| 193 | } |
| 194 | |
| 195 | ////// |
| 196 | // Read out all the command line arguments. |
| 197 | ////// |
| 198 | |
| 199 | // variables where to put any arguments we see. |
| 200 | bool printing_ids = false; |
| 201 | bool no_bos = false; |
| 202 | bool no_escape = false; |
| 203 | bool no_parse_special = false; |
| 204 | bool disable_logging = false; |
| 205 | bool show_token_count = false; |
| 206 | const char * model_path = NULL; |
| 207 | const char * prompt_path = NULL; |
| 208 | const char * prompt_arg = NULL; |
| 209 | |
| 210 | // track which arguments were explicitly given |
| 211 | // used for sanity checking down the line |
| 212 | bool model_path_set = false; |
| 213 | bool prompt_path_set = false; |
| 214 | bool prompt_set = false; |
| 215 | bool stdin_set = false; |
| 216 | |
| 217 | int iarg = 1; |
| 218 | for (; iarg < argc; ++iarg) { |
| 219 | std::string arg{argv[iarg]}; |
| 220 | if (arg == "-h" || arg == "--help") { |
| 221 | print_usage_information(argv[0].c_str()); |
| 222 | return 0; |
| 223 | } |
| 224 | else if (arg == "--ids") { |
| 225 | printing_ids = true; |
| 226 | } |
| 227 | else if (arg == "-m" || arg == "--model") { |
| 228 | if (model_path_set) { |
| 229 | fprintf(stderr, "Error: -m or --model specified multiple times.\n"); |
| 230 | return 1; |
| 231 | } |
| 232 | model_path = argv[++iarg].c_str(); |
| 233 | model_path_set = true; |
| 234 | } |
| 235 | else if (arg == "--no-bos") { |
| 236 | no_bos = true; |
| 237 | } |
| 238 | else if (arg == "--no-escape") { |
| 239 | no_escape = true; |
| 240 | } |
| 241 | else if (arg == "--no-parse-special") { |
| 242 | no_parse_special = true; |
| 243 | } |
nothing calls this directly
no test coverage detected