{"id":20784883,"url":"https://github.com/emad-elsaid/hydra","last_synced_at":"2025-06-26T06:35:35.961Z","repository":{"id":188310290,"uuid":"678506097","full_name":"emad-elsaid/hydra","owner":"emad-elsaid","description":"𓆚 C implementation of the famous Emacs Hydra package to be used in terminal. Groups commands and assign each command a key binding","archived":false,"fork":false,"pushed_at":"2024-06-18T21:05:34.000Z","size":173,"stargazers_count":21,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-05T14:53:59.854Z","etag":null,"topics":["cli","linux","shell"],"latest_commit_sha":null,"homepage":"https://hydra.emadelsaid.com/","language":"C","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/emad-elsaid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-14T17:55:21.000Z","updated_at":"2025-03-04T12:34:33.000Z","dependencies_parsed_at":"2024-06-19T03:12:11.462Z","dependency_job_id":"59286689-5cb1-4633-ba22-995fae44dd9f","html_url":"https://github.com/emad-elsaid/hydra","commit_stats":null,"previous_names":["emad-elsaid/hydra"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/emad-elsaid/hydra","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Fhydra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Fhydra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Fhydra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Fhydra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emad-elsaid","download_url":"https://codeload.github.com/emad-elsaid/hydra/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Fhydra/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262016541,"owners_count":23245527,"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":["cli","linux","shell"],"created_at":"2024-11-17T14:34:15.253Z","updated_at":"2025-06-26T06:35:35.933Z","avatar_url":"https://github.com/emad-elsaid.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 𓆚 Hydra\n\na C implementation of [Emacs Hydra](https://github.com/abo-abo/hydra) package to be used in terminal.\n\n\u003cp align=\"center\"\u003e\u003cimg width=\"256\" src=\"public/logo.png\" /\u003e\u003c/p\u003e\n\n[![asciicast](https://asciinema.org/a/603564.svg)](https://asciinema.org/a/603564)\n\n# What is 𓆚 Hydra?\n\n* An implementation of Emacs 𓆚 Hydra functionality to be used in the terminal\n* a terminal program that groups your commands and bind them to common key on your keyboard.\n* Commands can also be grouped in a tree like structure each node in the tree has a name and key bound to it.\n* It reads CSV files of `key,name,command` lines then shows Terminal UI similar to Emacs 𓆚 Hydra and prints the command to stdout.\n\n[Spacemacs](https://www.spacemacs.org/) for example is an emacs configuration centered around 𓆚 Hydra commands, with all user commands grouped as trees bound in a mnemonic way. for example:\n\n- opening a file is bound to `space f f`\n- deleting current file is bound to `space f D`\n- Git status `space g s`\n\nBinding 𓆚 Hydra to `space` key in your terminal means pressing `space` will make your terminal behave similar to spacemacs if you executed the output with `eval`. this repo has a bash script `hydra-completion.bash` which achieve this binding.\n\n# Other usages\n\n* `hydra` doesn't execute the command by default.\n* The program prints the choosen command to standard output.\n* What to do with this output is up to you. you can for example append it to a file. or open the browser with the output or whatever. just like `fzf` and `dmenu`.\n* Which means you can use 𓆚 Hydra as part of your scripts to allow the user to navigate a tree of choices and get the final choice piped to another program, GNU coreutils style.\n\n# Install\n\n* Clone it from [github](https://github.com/emad-elsaid/hydra) to your machine\n```shell\ngit clone git@github.com:emad-elsaid/hydra.git\ncd hydra\n```\n* Build\n```shell\nmake\n```\n* Install\n```shell\nsudo make install\n```\n\n* Export `HYDRA` variable to your `.bashrc`. it should have a list of hydras files. 𓆚 Hydra example files are installed under `/usr/share/hydra/hydras`.\n* Loading `/usr/share/hydra-completion.bash` will bind `hydra` to `Space` key in your keyboard and will invoke `hydra` when the line is empty.\n* For example to use the `git` 𓆚 Hydra:\n```shell\nexport HYDRA=\"/usr/share/hydra/hydras/git\"\nsource /usr/share/hydra/hydra-completion.bash\n```\n\n# 𓆚 Hydra file\n\n* 𓆚 Hydra files are simple CSV files that define the commands 𓆚 hydra can load.\n* The file has 3 columns without header. an example is under `hydras` directory in this repo.\n\na simple example can be as follow\n```csv\ng,Git,\ngs,Status,git status\n```\n\n* It defines `Git` command that doesn't execute a command under the key `g`\n* and defines a command named `Status` under key `s` inside `g` that will execute the command `git status`\n\n# Running\n\n* You can run `hydra` binary with a list of 𓆚 hydra files\n* 𓆚 Hydra will load the files in the order passed.\n* it will display the list of top level commands\n* When the program reaches a choosen command that doesn't have children it will print the command to standard output\n```shell\nhydra hydras/git hydras/systemd hydras/github\n```\n\n# Tests\n\nTo run tests execute\n\n```shell\nmake run-test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femad-elsaid%2Fhydra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femad-elsaid%2Fhydra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femad-elsaid%2Fhydra/lists"}