diff --git a/README.md b/README.md index 8bc534b..e3eea20 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ Options are optionally set in `options`, which is a semicolon-delimited list of - `js` JavaScript (Node 11.11.0) - `harmony` enables harmony features (`--harmony` on node) - `e` prints the result of evaluating the code +- `julia` Julia (Julia 1.1.0) + - `e` prints the result of evaluating the code - `pas` Pascal (FPC 3.0.4) - `php` PHP (PHP 7.3.3) - `pl` Perl (Perl 5.28.1) diff --git a/docker/julia/Dockerfile b/docker/julia/Dockerfile new file mode 100644 index 0000000..b81a6c8 --- /dev/null +++ b/docker/julia/Dockerfile @@ -0,0 +1,4 @@ +FROM julia +LABEL author="1Computer1" + +COPY run.sh /var/run/ diff --git a/docker/julia/run.sh b/docker/julia/run.sh new file mode 100644 index 0000000..5b134b1 --- /dev/null +++ b/docker/julia/run.sh @@ -0,0 +1,5 @@ +if [ "$EVAL_EXPR" = "true" ]; then + julia -E "$1" +else + julia -e "$1" +fi diff --git a/src/languages/julia.js b/src/languages/julia.js new file mode 100644 index 0000000..fc26a1d --- /dev/null +++ b/src/languages/julia.js @@ -0,0 +1,22 @@ +const Language = require('../struct/Language'); + +class Julia extends Language { + constructor() { + super('julia', { + aliases: ['julia'], + options: { + e: () => '' + } + }); + } + + runWith(options) { + if (options.has('e')) { + return { id: this.id, env: { EVAL_EXPR: 'true' } }; + } + + return super.runWith(options); + } +} + +module.exports = Julia;