#codingame #game #cli #coding-game

app cg-local

Rust对原始CG local应用程序的移植

2个版本

0.1.1 2024年2月15日
0.1.0 2024年2月11日

#147 in 游戏

MIT许可证

18KB
283

cg-local

Rust实现的本地CG Local。Java应用程序的替代品,并兼容原始的扩展

安装

二进制文件

下载最新版本并运行

# linux
./path/to/cg-local [options] --target <TARGET>
# windows
.\path\to\cg-local.exe [options] --target <TARGET>

Cargo

cargo install cg-local

从源代码

git clone https://codeberg.org/Vulpesx/cg-local.git && cd cg-local
cargo install --path .

用法

Usage: cg-local [OPTIONS] --target <TARGET>

Options:
  -b, --bind <BIND>
          Address to bind to, DO NOT CHANGE

          this is the port the original extensions connect to changing this will mean the original extions wont work this is to support other extensions if they exist

          [default: 127.0.0.1:53135]

  -t, --target <TARGET>
          Path to target file, doesnt have to exist

          cg-local will watch this file for changes and upload them to the extension and download from the extension if twoway or download

  -d, --download
          downloads the file immediately

          download the file on connection to extension

  -p, --play
          auto play on file upload

          sets the extension to when it receives new code to play the test cases

      --two-way
          two way synchronizing, you can use the IDE too

          when the extension detects changes in the browser side ide it will send them to cg-local, this will set cg-local to accept the changes and write them to the file, you may have to reload editor to see them locally

      --timeout <TIMEOUT>
          time to wait for browser extension (ms)

          the time cg-local waits for the extension to send something this cannot be zero, if zero it would wait forever but dont worry cg-local wont accept a zero

          [default: 500]

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

示例

# Synchronize main.rs with the IDE, enable auto-play by default
cg-local -p -t main.rs

状态

完成,除非有人开发新的扩展,否则我可能会更新它

感谢

jmerle提供的原始应用程序和扩展,以及vtavernier对原始应用程序的Rust移植,这使我能够在极度困倦的情况下制作出我的第一个版本。

您可能会很高兴地知道,我的移植版本比vtavernier的版本少一半的代码,并且没有那么多异步操作。请检查是否使用异步或库进行某些操作是否过度,您不需要另一个线程来监视文件,也不需要那么多的异步操作。

许可证

MIT文件

依赖项

~2.4–3.5MB
~66K SLoC