{"id":21771424,"url":"https://github.com/alejandrogallo/rooki","last_synced_at":"2025-04-13T16:41:26.907Z","repository":{"id":96335912,"uuid":"200688769","full_name":"alejandrogallo/rooki","owner":"alejandrogallo","description":"A stupid simple script runner supporting c, c++, rust, haskell and virtually anything","archived":false,"fork":false,"pushed_at":"2020-01-07T13:23:11.000Z","size":206,"stargazers_count":27,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T07:35:52.509Z","etag":null,"topics":["c","clang","compiler","cpp","fortran","gcc","rust","scripting","tcc"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alejandrogallo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-08-05T16:10:29.000Z","updated_at":"2024-03-20T21:53:31.000Z","dependencies_parsed_at":"2023-09-25T00:59:02.786Z","dependency_job_id":null,"html_url":"https://github.com/alejandrogallo/rooki","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"19d7789862a472666c23d20ca7f4f9ea3d3c9d6a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejandrogallo%2Frooki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejandrogallo%2Frooki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejandrogallo%2Frooki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alejandrogallo%2Frooki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alejandrogallo","download_url":"https://codeload.github.com/alejandrogallo/rooki/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248747089,"owners_count":21155391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","clang","compiler","cpp","fortran","gcc","rust","scripting","tcc"],"created_at":"2024-11-26T14:16:23.570Z","updated_at":"2025-04-13T16:41:26.857Z","avatar_url":"https://github.com/alejandrogallo.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rooki\nA stupid simple script runner supporting c, c++, rust, haskell and virtually anything\n\n`Rooki` is written in 20 lines of `bash`, and has a very flexible\nfunctionality.\n\n# How does it work?\n\nYou just write comments as `rooki` instructions, the only instruction that\nyou have to define is the `rooki:spell`, which will be run in the shell.\nOtherwise you can define any flag you want with the name you want for instance\nin a `c` file, the following\n```c\n// rooki:someflag -I$(pwd)\n// rooki:someflag -I$HOME\n```\nwill define a shell variable `someflag` with the value\n```\nsomeflag=\"-I$(pwd) -I$HOME\"\n```\nwhich later can be used in the `rooki:spell` section as\n```c\n// rooki:someflag -I$(pwd)\n// rooki:someflag -I$HOME\n// rooki:spell cc $someflag $f -o $bin\n```\n\nThere are some general variables already defined:\n\n| Variable | Explanation | Example |\n| --- | --- | :---: |\n| `bin` | Path to the created binary | `rooki:spell gcc $f -o $bin` |\n| `f` | Path to the temporary source file that will be compiled | `// rooki:spell gcc $f -o $bin` |\n| `src` | Path to the source file, the caller | `rooki:include -I$(dirname $src)/include`|\n| `config_folder` | Path to rooki config folder ||\n\nWhat `rooki` does when you do `rooki yourscript` is the following\n- Create a temporal file and save the path in the variable `f`.\n- Create a `bin` path out of the `md5` hash of the source script, the bin\n  will be stored in `$XDG_CONFIG_HOME/rooki/`. In the case that your\n  `XDG_CONFIG_HOME` is not defined, it will be stored in\n  `~/.config/rooki/`.\n- Remove the shbang (`#!/usr/bin/env rooki`) on top of your script (if there is\n  any) and copy the script to `$f` without the shbang.\n- Read the `rooki:` flags stored in text in your script.\n- Expand shell constructs within these flags, environment variables and\n  general shell commands within.\n- Run the `rooki:spell` construct, which should be creating a binary\n  in the path `$bin`.\n\n# Quick start\n\nFor instance to write a `c++` script called `hello.cxx`\njust create an executable file `hello.cxx` and write\n\n\n```c++\n#!/usr/bin/env rooki\n// rooki:flags -pedantic -std=c++11\n// rooki:flags -x c++\n// rooki:include -I/usr/include\n// rooki:include -I$HOME/.local/include\n// rooki:spell g++ $flags $include $f -o $bin\n\n#include \u003ciostream\u003e\n\nint main(int argc, char *argv[])\n{\n  std::cout \u003c\u003c \"Hello world\" \u003c\u003c std::endl;\n  return 0;\n}\n```\n\nthen do\n\n```\n./test.cxx\n# or\nrooki test.cxx\n```\n\nif you want to see exactly what rooki is doing then set the environment variable\n`ROOKI_DEBUG` like this\n\n```\nROOKI_DEBUG=1 ./test.cxx\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejandrogallo%2Frooki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falejandrogallo%2Frooki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejandrogallo%2Frooki/lists"}