{"id":17151935,"url":"https://github.com/dancardin/corg","last_synced_at":"2025-03-24T12:40:39.128Z","repository":{"id":151814700,"uuid":"448456533","full_name":"DanCardin/corg","owner":"DanCardin","description":"A cog-like tool, written in Rust.","archived":false,"fork":false,"pushed_at":"2022-01-23T13:42:01.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-29T17:44:40.635Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanCardin.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-16T04:26:27.000Z","updated_at":"2022-01-19T23:07:19.000Z","dependencies_parsed_at":"2023-05-10T20:45:41.079Z","dependency_job_id":null,"html_url":"https://github.com/DanCardin/corg","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanCardin%2Fcorg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanCardin%2Fcorg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanCardin%2Fcorg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanCardin%2Fcorg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanCardin","download_url":"https://codeload.github.com/DanCardin/corg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245273146,"owners_count":20588531,"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":[],"created_at":"2024-10-14T21:42:25.342Z","updated_at":"2025-03-24T12:40:39.106Z","avatar_url":"https://github.com/DanCardin.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Corg\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://img.shields.io/crates/l/corg.svg\" alt=\"license\"\u003e\n\u003ca href=\"https://crates.io/crates/corg\"\u003e\n\u003cimg src=\"https://img.shields.io/crates/v/corg.svg?colorB=319e8c\" alt=\"Version info\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/DanCardin/corg/actions?query=workflow%3ATest\"\u003e\n\u003cimg src=\"https://github.com/DanCardin/corg/workflows/Test/badge.svg\" alt=\"Build Status\"\u003e\n\u003c/a\u003e \u003ca href=\"https://codecov.io/gh/DanCardin/corg\"\u003e\n\u003cimg src=\"https://codecov.io/gh/DanCardin/corg/branch/main/graph/badge.svg?token=U7NQIWXWKW\"/\u003e\n\u003c/a\u003e\u003cbr\u003e\n\u003c/p\u003e\n\nA [cog](https://nedbatchelder.com/code/cog)-like tool, written in Rust.\n\nStraight from Ned:\n\n\u003e Cog is a file generation tool. It lets you use pieces of Python code as generators in your source files to generate whatever text you need.\n\nInstead, Corg allows one to choose any executable (python, bash, etc) which\naccepts piped input. Shown below, Corg uses a shebang-looking mechanism instead.\n\n## Example\n\nThe most obvious motivating example which comes to mind for this tool is for\nkeeping documentation up-to-date with their sources of truth. Be that, verifying\nCLI help text, or executing code examples.\n\nThis document is a great example. Embedded below at the [CLI](#CLI) section\nis the following block.\n\n\u003c!-- [[[#!bash\necho\ncat example.md\necho\n]]] --\u003e\n\n```md\n\u003c!-- [[[#!/usr/bin/env bash\ncargo run --features cli -- --help\n]]] --\u003e\n```\n\n\u003c!-- [[[end]]] (checksum: 9503506b397b9716def5152b41695181) --\u003e\n\nAnd as you can see below, it outputs the help text. See the raw README source,\nand you'll notice the invisible, commented out sections which are used to produce\nthe output!\n\nThe CI for this repo then runs: `cargo run --features cli -- README.md -r --check --checksum`\nto verify that it remains in sync.\n\n### Installation\n\n#### With Cargo\n\n```bash\ncargo install corg --features=cli\n```\n\n#### Download Release\n\n- Download a pre-built binary from [Releases](https://github.com/DanCardin/corg/releases)\n\n## CLI\n\nThe CLI maintains CLI compatibility with `cog` to the extent which makes sense.\nCog exposes a number of options which are only applicable for to its python\nimplementation, which `corg` does not currently implement.\n\nAs mentioned above, `corg` itself, is used to produce output below!\n\n\u003c!-- [[[#!/usr/bin/env bash\necho\necho '```'\ncargo run --features cli -- --help\necho '```'\necho\n]]] --\u003e\n\n```\ncorg 0.1.0\nA cog-like tool\n\nUSAGE:\n    corg [OPTIONS] \u003cINPUT\u003e\n\nARGS:\n    \u003cINPUT\u003e    The input file\n\nOPTIONS:\n    -c, --checksum             Checksum the output to protect it against accidental change\n        --check                Check that the files would not change if run again\n    -d, --delete-blocks        Delete the generator code from the output file\n    -e                         Warn if a file has no cog code in it\n    -h, --help                 Print help information\n        --markers \u003cMARKERS\u003e    The patterns surrounding cog inline instructions. Should include\n                               three values separated by spaces, the start, end, and end-output\n                               markers\n    -o, --output \u003cOUTPUT\u003e      Write the output to a file instead of stdout\n    -r, --replace              Write the output to the original input file, supercedes `--output`\n    -V, --version              Print version information\n    -x, --omit-output          Omit all the generated output without running the generators\n```\n\n\u003c!-- [[[end]]] (checksum: 22deee7b210466aedf32e7eb677409d3) --\u003e\n\n## Library\n\nThe above CLI is a thin wrapper over the corg internal structures. It's not entirely\nobvious whether this is useful or not, but it's available!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdancardin%2Fcorg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdancardin%2Fcorg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdancardin%2Fcorg/lists"}