piston-cli icon indicating copy to clipboard operation
piston-cli copied to clipboard

Dynamically Updated Languages

Open Shivansh-007 opened this issue 4 years ago • 0 comments

Description

Currently, we need to update languages manually, and can sometimes get tiring. A better alternative to this is to dynamically run this every 48 hours(say), for example:

if it runs today (Monday) at 5am, it would store this time in a cached file called last_language_fetch, on every run it would check whether there has been a 48 hour gap, now the user again runs it on Wednesday 7am, which is a 50hour gap, more than the default run gap. Then it would run again and follow the same process.

Now we have talked about running the function of getting the languages, here the question comes, how will we store these languages, well of-course we cannot store them as objects, since on every run they would change so we would again be using some help of file caches, a file called languages.yml, which would store all this data, I am writing this issue talking piston v3 into picture.

The file would look something like this:

language:
  - aliases:
    - 1
    - 2
  - versions:
    - 10.1
    - 11.3

On every run, we would load this yml file and do the normal checks of version, language present or not, etc. For lexers it would look up and see if there are any lexers available for that language, if not it would find any available lexers for that language, then it would take up the text lexer and warn the user, they could either create a issue on this repository or the pygments, and get that lexer added.

Additional Details

I know this will increase the time of running, and the speed would decrease, but we could give this a try and see how does it go, if the speed is really less, we could try squash some of the features down and add flags to skip some fetches. Anyone can implement this for now, I am a bit busy, if no one takes this eventually me or @SuperMaZingCoder would do the honors. If there are any questions, you can join the Piston CLI server or dm me.

Shivansh-007 avatar May 17 '21 01:05 Shivansh-007