{"id":16768014,"url":"https://github.com/bouk/babelfish","last_synced_at":"2025-04-12T20:45:07.092Z","repository":{"id":39764638,"uuid":"270437476","full_name":"bouk/babelfish","owner":"bouk","description":"Translate bash scripts to fish","archived":false,"fork":false,"pushed_at":"2025-01-27T19:25:11.000Z","size":96,"stargazers_count":202,"open_issues_count":13,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T14:20:28.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bouk.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":"2020-06-07T21:27:58.000Z","updated_at":"2025-04-07T20:58:59.000Z","dependencies_parsed_at":"2025-01-26T03:00:58.769Z","dependency_job_id":"954585d5-3328-4ed7-be8e-6d6f95028185","html_url":"https://github.com/bouk/babelfish","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bouk%2Fbabelfish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bouk%2Fbabelfish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bouk%2Fbabelfish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bouk%2Fbabelfish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bouk","download_url":"https://codeload.github.com/bouk/babelfish/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631687,"owners_count":21136556,"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-13T06:10:33.985Z","updated_at":"2025-04-12T20:45:07.072Z","avatar_url":"https://github.com/bouk.png","language":"Go","funding_links":[],"categories":["shell"],"sub_categories":[],"readme":"# babelfish\n\nTranslate bash scripts to [fish](https://fishshell.com).\n\n## Why?\n\nBecause I got annoyed by having to use [fish-foreign-env](https://github.com/oh-my-fish/plugin-foreign-env) or [bass](https://github.com/edc/bass), which are slow, since they create multiple bash processes. With this program I can translate bash scripts to fish, and run them directly in fish.\n\n## But how?\n\n`babelfish` parses the script using [mvdan.cc/sh](https://github.com/mvdan/sh), and then translates bash expressions to the equivalent fish code. That's it! You can find the code that walks the AST and emits fish code [here](https://github.com/bouk/babelfish/blob/master/translate/translate.go).\n\n## Install\n\nIf you have Homebrew, just run:\n\n```shell\nbrew install babelfish\n```\n\nElse:\n\n```shell\ngo install bou.ke/babelfish@latest\n```\n\n## Example\n\n```sh\n# Pass some code on stdin to translate it\n$ echo 'f() { export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket); local cool=yep; }' | babelfish\nfunction f\n  set -gx SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket | string collect; or echo)\n  set -l cool 'yep'\nend\n# Pass the result to source to load it into fish\n$ echo 'echo Nice to meet you user $UID' | babelfish | source\nNice to meet you user 502\n# Or install the shell hook!\n$ source babel.fish\n$ source chruby.sh\n$ chruby\n   ruby-2.5\n   ruby-2.6\n   ruby-2.7\n```\n\n## To do\n\nProbably still a lot. There's a couple variables like `$BASH_SOURCE` that aren't translated, and not all arithmetic expressions are implemented either. Pull requests and issues welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbouk%2Fbabelfish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbouk%2Fbabelfish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbouk%2Fbabelfish/lists"}