Andriamanitra / coctus

Command line tool for playing clashes and I/O puzzles from CodinGame locally
MIT License
4 stars 2 forks source link

Add default overridable config for running solutions in particular language #19

Open ellnix opened 8 months ago

ellnix commented 8 months ago

It would be great if there was a lookup table with language names and the build & run commands that the tool automatically searches for. Some ideas:

# changes the default language to C
clash language c
clash run 
# runs `sol.{language_file_ext}` with default language
clash run --language rust
clash run -l rust
# runs sol.rs with rust

Ideally there would be a config file in $XDG_CONFIG_HOME/clash for Linux and %Appdata%/whatever for Windows like:

# languages.yml
ruby:
  run: ruby sol.rb
c:
  build: gcc sol.c
  run: ./sol
rust:
  run: cargo run --release
  workspace: rust
  code_origin: sol.rs
  code_destination: src/main.rs
- workspaces/
  - rust/
    - src/
    - Cargo.toml

The workspace feature would allow for supporting non standard libraries in languages like Rust. The workflow would be: