{"id":33014734,"url":"https://github.com/mbhynes/fzf-gcloud","last_synced_at":"2026-01-16T11:35:05.860Z","repository":{"id":46613745,"uuid":"370385783","full_name":"mbhynes/fzf-gcloud","owner":"mbhynes","description":"Preview the gcloud api with fzf.","archived":false,"fork":false,"pushed_at":"2024-08-17T17:41:31.000Z","size":600,"stargazers_count":24,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-17T18:49:55.998Z","etag":null,"topics":[],"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/mbhynes.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}},"created_at":"2021-05-24T14:44:53.000Z","updated_at":"2024-08-17T17:41:35.000Z","dependencies_parsed_at":"2022-07-19T14:38:45.332Z","dependency_job_id":null,"html_url":"https://github.com/mbhynes/fzf-gcloud","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mbhynes/fzf-gcloud","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbhynes%2Ffzf-gcloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbhynes%2Ffzf-gcloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbhynes%2Ffzf-gcloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbhynes%2Ffzf-gcloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbhynes","download_url":"https://codeload.github.com/mbhynes/fzf-gcloud/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbhynes%2Ffzf-gcloud/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478349,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-11-13T18:00:20.535Z","updated_at":"2026-01-16T11:35:05.855Z","avatar_url":"https://github.com/mbhynes.png","language":"Shell","readme":"# fzf-gcloud\n\n## Summary\n`fzf-gcloud` is a [`zsh`](https://en.wikipedia.org/wiki/Z_shell) script lets you browse the [`gcloud`](https://cloud.google.com/sdk/gcloud/) CLI api with [`fzf`](https://github.com/junegunn/fzf).\n\nIt adds a keybinding on `CTRL-K` (like *cloud* ... meh) to browse the currently installed `gcloud` CLI API with `fzf`, to help navigate the many commands quickly:\n![Usage preview](usage_preview.gif)\n\n## Requirements\n- `fzf` (Please see the instructions [upstream for fzf](https://github.com/junegunn/fzf), but generally: `brew install fzf` \u0026 `$(brew --prefix)/opt/fzf/install`)\n- `gcloud` (`brew install --cask google-cloud-sdk`)\n- `sqlite3` (`brew install sqlite`)\n\n## Installation\n\n### Manual Installation\n1. Download the shell functions from this repo:\n```zsh\ncurl https://raw.githubusercontent.com/mbhynes/fzf-gcloud/main/fzf-gcloud.plugin.zsh \u003e $HOME/.fzf-gcloud.plugin.zsh\n```\n2. Add the following lines in your `~/.zshrc` to source the functions to source them:\n```zsh\n[ -f ~/.fzf-gcloud.plugin.zsh ] \u0026\u0026 source ~/.fzf-gcloud.plugin.zsh\n```\n### Antigen\nPlease note that the branch to checkout is `main`, which must be specified in the `antigen` invocation (see [antigen bundle](https://github.com/zsh-users/antigen/wiki/Commands#antigen-bundle) for more details):\n```\nantigen bundle 'mbhynes/fzf-gcloud' --branch=main\n```\nThe first time you use `CTRL-K`, the `gcloud` command cache will be populated. \n\nDon't panic. \n\nYou will be greeted by a wall of logging messages like those below for about a minute, after which you may use `fzf-gcloud` without having to repopulate the cache.\n```\nAdding invocation for 'gcloud beta sql import bak' (build from /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/surface/sql/import/bak.py)\nAdding invocation for 'gcloud beta sql import csv' (build from /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/surface/sql/import/csv.py)\nAdding invocation for 'gcloud beta sql import sql' (build from /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/surface/sql/import/sql.py)\nAdding invocation for 'gcloud beta sql backups delete' (build from /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/surface/sql/backups/delete.py)\nAdding invocation for 'gcloud beta sql backups describe' (build from /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/surface/sql/backups/describe.py)\n```\n\n### Other Packge Manager Installation\nPlease note that since there is no `master` branch for this repository (we use `main`), the some default load commands for popular zsh package managers will fail. Antigen supports providing an optional branch to `antigen bundle` and has good documentation, so it's the recommended package manager for installing `fzf-gcloud`.\n\nSomething like the below may work? ... YMMV.\n```zsh\nzgen load 'mbhynes/fzf-gcloud' 'main'\n```\n\n### Usage\n- The widget is by default bound to the keybinding `CTRL-K` (`'^K'`)\n- You can alter this by changing the `bindkey` line in the `.fzf-gcloud.plugin.zsh` or `~/.antigen/bundles/mbhynes/fzf-gcloud-main/fzf-gcloud.plugin.zsh` (or wherever you've placed it in your system), as noted below:\n\n```zsh\nfzf-gcloud-widget() {\n  # ==========================================================================\n  # Bind the gcloud fzf helper to CTRL-K\n  # ==========================================================================\n  LBUFFER=\"$(__gcloud_sel)\"\n  local ret=$?\n  zle reset-prompt\n  return $ret\n}\nzle     -N   fzf-gcloud-widget\nbindkey '^K' fzf-gcloud-widget # \u003c--- change if you prefer a different keybinding\n```\n\n## Implementation Details\n\n### Implementation Summary\nThe `fzf-gcloud` completion mechanism works in the following way:\n- we create a local cache (`sqlite` database) of `gcloud` commands for use with `fzf`\n- when the keybinding is invoked, the commands in this cache are piped into `fzf` with a `--preview` option to display each command's `--help` docs\n\n### Caching the `gcloud` signature\nThe local `sqlite` database is populated is a notably not-fancy way:\n- we determine the `google-cloud-sdk` root directory from the `gcloud` path (for `brew` users this will be: `\"$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk`\n- the signature of each `gcloud` command is inferred from the python filenames and directory structure in the `lib/surface` of the `google-cloud-sdk`\n- we detect whether the `alpha` or `beta` release track flags are required in each file, and use this to update the `gcloud` invocation, as appropriate\n- the cache is saved to `\"$HOME/.gcloud_cmd_cache.db\"`, which database contains only 1 simple table with schema:\n```sql\n    create table GCLOUD_CMD_CACHE(\n      api_source_file         text\n    , gcloud_cmd_invocation   text\n    );\n```\n- If you're interested, you may browse/update the contents of this cache:\n```bash\nsqlite3 $HOME/.gcloud_cmd_cache.db \"select * from gcloud_cmd_cache where gcloud_cmd_invocation like '%alpha%' order by api_source_file limit 5;\"\n```\n```\n/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/surface/access_approval/__init__.py|gcloud alpha access-approval\n/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/surface/access_context_manager/cloud_bindings/__init__.py|gcloud alpha access-context-manager cloud-bindings\n/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/surface/access_context_manager/cloud_bindings/create.py|gcloud alpha access-context-manager cloud-bindings create\n/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/surface/access_context_manager/cloud_bindings/update.py|gcloud alpha access-context-manager cloud-bindings update\n/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/surface/admin_service_cluster/__init__.py|gcloud alpha admin-service-cluster\n```\n\nPlease note: there's probably a better way to do this. But this works, is very directly understandable, and only takes about a minute to populate `¯\\_(ツ)_/¯`.\n\n### Updating the Cache\nThere's no magic here. After sourcing the functions, just re-run:\n```zsh\n__gcloud_cmd_cache\n```\n\n## Uninstalling `fzf-gcloud`\n\n### Manual Uninstallation\nIf you installed this plugin manually, please use the following steps:\n- Remove the command cache database\n```bash\n[ -r \"$GCLOUD_CMD_CACHE_DB\" ] \u0026\u0026 rm -i \"$GCLOUD_CMD_CACHE_DB\"\n```\n- Remove the `source ~/.fzf-gcloud.plugin.zsh` lines from your `zshrc`\n\n### Antigen Uninstallation\n- Remove the command cache database\n```bash\n[ -r \"$GCLOUD_CMD_CACHE_DB\" ] \u0026\u0026 rm -i \"$GCLOUD_CMD_CACHE_DB\"\n```\n- Purge the antigen bundle\n```zsh\nantigen purge mbhynes/fzf-gcloud\n```\n\n","funding_links":[],"categories":["Completions"],"sub_categories":["ZSH on Windows"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbhynes%2Ffzf-gcloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbhynes%2Ffzf-gcloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbhynes%2Ffzf-gcloud/lists"}