The green_copper_cmd project is a commandline JavaScript interpreter which uses the GreenCopperRuntime which is in turn based on quickjs.
For a list of features that work in script here you should check out the GreenCopperRuntime project.
Supports typescript, you can run .ts files or use .ts modules
You can use ifdef and env vars like this
#ifdef $GRECO_TEST
console.log("test mode active")
#endif
#ifdef $GRECO_RELEASE
console.log("release mode active")
#endif
console.log("path = $PATH");
Loading modules from https locations and the fetch api are enabled by default.
I use this project a lot for GPIO stuff on my Raspberry Pi powered robots, if you connect a Led to GPIO pin 20 this little test should make it blink twice
NB: This project only works on a 64 bit OS!
git clone https://github.com/HiRoFa/GreenCopperCmd
cd GreenCopperCmd
cargo run -- -f scripts/test_led.ts -i
running with a script
greco test.ts
continue running after script has completed (interactive mode)
greco -i test.ts
or without using a file
greco -i'
verbose mode
greco -v'