{"id":13822414,"url":"https://github.com/nakabonne/rhack","last_synced_at":"2025-04-06T15:13:32.256Z","repository":{"id":43078667,"uuid":"342773863","full_name":"nakabonne/rhack","owner":"nakabonne","description":"Temporary edit external crates that your project depends on","archived":false,"fork":false,"pushed_at":"2024-03-17T08:37:52.000Z","size":78,"stargazers_count":145,"open_issues_count":7,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-04T18:50:14.691Z","etag":null,"topics":["cargo","developer-tools","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nakabonne.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":"2021-02-27T04:53:25.000Z","updated_at":"2025-02-17T01:53:32.000Z","dependencies_parsed_at":"2024-07-17T06:30:58.479Z","dependency_job_id":"007e61ae-c3ad-4cca-85aa-d43d42a0cad3","html_url":"https://github.com/nakabonne/rhack","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/nakabonne%2Frhack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nakabonne%2Frhack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nakabonne%2Frhack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nakabonne%2Frhack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nakabonne","download_url":"https://codeload.github.com/nakabonne/rhack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247500469,"owners_count":20948880,"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":["cargo","developer-tools","rust"],"created_at":"2024-08-04T08:01:59.417Z","updated_at":"2025-04-06T15:13:32.233Z","avatar_url":"https://github.com/nakabonne.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# rhack\n[![Version info](https://img.shields.io/crates/v/rhack.svg)](https://crates.io/crates/rhack)\n\nYou want to quickly put a sneaky macro kind of like `dbg!` into external crates to find out how some internal data structure works? If so `rhack` is for you!\n\n`rhack` makes it easier to edit external crates code that your project depends on.\n\n## Usage\nLet's say you want to modify the `reqwest` crate.\n\n```toml\n[dependencies]\nreqwest = \"0.11\"\n```\n\nRun the following:\n\n```\n$ rhack edit reqwest\n```\n\nThis will make a copy of the crate into `$HOME/.rhack/reqwest-0.11.1` and add its path to the [[patch] section](https://doc.rust-lang.org/edition-guide/rust-2018/cargo-and-crates-io/replacing-dependencies-with-patch.html) in your Cargo.toml whose path is automatically detected:\n\n```toml\n[patch.crates-io]\nreqwest = { path = \"/home/you/.rhack/reqwest-0.11.1\" }\n```\n\nNow your package uses the locally checked out copy instead of one from crates.io. You can now open the files (typically by leveraging the \"Jump to Definition\" feature) and then feel free to modify the source code.\n\n### Undoing\nSimply run the `undo` command then you can undo all of the changes to your Cargo.toml:\n\n```\n$ rhack undo\n```\n\nKeep in mind that this command doesn't remove any copy of crates.\n\n\n### Settings\nIt uses `$HOME/.rhack` as the destination to copy the source code of the external crates by default. You can change it by setting and exposing the `$RHACK_DIR` environment variable.\n\n## Installation\nFor MacOS, Linux, and Windows, prebuilt binaries are available through [here](https://github.com/nakabonne/rhack/releases).\n\n### Debian/Ubuntu\n\n```\nwget https://github.com/nakabonne/rhack/releases/download/v0.1.0/rhack_linux_amd64.deb\napt install ./rhack_linux_amd64.deb\n```\n\n### Arch Linux\nAn [AUR package](https://aur.archlinux.org/packages/rhack/) is available.\n\n```\nyay rhack\n```\n\n### Cargo\n\n```\ncargo install rhack\n```\n\n### From source\n\n```\ngit clone https://github.com/nakabonne/rhack.git\ncargo build --release\nsudo install -m755 target/release/rhack /usr/local/bin/rhack\n```\n\nIf you want to generate the man page, you can install it with `scdoc`.\n\n```\nsudo mkdir -p /usr/local/share/man/man1\nscdoc \u003c rhack.1.scd \u003e rhack.1\nsudo install -m644 rhack.1 /usr/local/share/man/man1/rhack.1\n```\n\n\n## Acknowledgements\nThis tool is highly inspired by [gohack](https://github.com/rogpeppe/gohack). It clearly stimulated an incentive to creation. A big \"thank you!\" goes out to them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnakabonne%2Frhack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnakabonne%2Frhack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnakabonne%2Frhack/lists"}