online-judge-tools / api-client

API client to develop tools for competitive programming
MIT License
64 stars 18 forks source link

Import the feature to guess language ids for code from oj command #62

Closed kmyk closed 4 years ago

kmyk commented 4 years ago

Description

Most online judges provides identifiers for programming languages and they are informally described. For example, in the current Codeforces, ID = 59 is displayed as Microsoft Visual C++ 2017 and ID = 61 is displayed as GNU G++17 9.2.0 (64 bit, msys 2) and ID = 52 is displayed as Clang++17 Diagnostics. Such mappings is different for each online judges and varies on time (i.e. this means it's difficult to embed the correct IDs).

Now oj command has the feature to guess the correct language id from list of descriptions of language ids and user's source code. We should import the feature to guess into oj-api command and provide users of oj-api command.

kmyk commented 4 years ago

I added it as a new subcommand guess-language-id and not as an option of new option of submit subcommand, becuase:

  1. It's not essential to submit subcommand. It' just a utility.
  2. It's a pure feature. I don't want to mix it with an impure feature, submit. It's not implemented yet, but basically the guessing is possible without any network access when the list of languages is given.
  3. It's a heavy feature. That is, it requires too many options (e.g. --use-gcc, --use-clang, --use-msvc, ...).