{"id":20784695,"url":"https://github.com/omakoto/compromise","last_synced_at":"2025-05-04T07:43:23.948Z","repository":{"id":77687973,"uuid":"137015493","full_name":"omakoto/compromise","owner":"omakoto","description":"Go Framework for Writing Shell Completion for Bash / Zsh (with Go/ADB completion)","archived":false,"fork":false,"pushed_at":"2023-08-24T03:56:42.000Z","size":294,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-04T07:43:20.978Z","etag":null,"topics":["bash","bash-completion","go","golang","zsh","zsh-completion"],"latest_commit_sha":null,"homepage":"","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/omakoto.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":"2018-06-12T04:08:02.000Z","updated_at":"2025-04-30T01:08:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab2c7660-cefc-42da-b41d-25813012e1f7","html_url":"https://github.com/omakoto/compromise","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omakoto%2Fcompromise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omakoto%2Fcompromise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omakoto%2Fcompromise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omakoto%2Fcompromise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omakoto","download_url":"https://codeload.github.com/omakoto/compromise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252305196,"owners_count":21726616,"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":["bash","bash-completion","go","golang","zsh","zsh-completion"],"created_at":"2024-11-17T14:32:15.501Z","updated_at":"2025-05-04T07:43:23.921Z","avatar_url":"https://github.com/omakoto.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/omakoto/compromise.svg?branch=master)](https://travis-ci.org/omakoto/compromise)\n# Compromise (and Bash/Zsh completion for ADB and Go)\n\nCompromise is a Go framework for writing shell completion for Bash / Zsh.\n\nCurrently it comes with the following two sets of completions:\n\n - ADB (Android Debug Bridge, including several shell commands), fastboot, atest, m/mm/mmm, etc\n    - Examples:\n        - Most `adb` subcommands, major subcommands for `adb shell [am|pm|settings]`\n         (e.g. `am start-activity [flags] INTENT`), and service name for `adb shell [dumpsys|cmd]`\n        - Flags for `fastboot` \n        - Build modules and some pseudo build targets for `m` (`m MODULE`, `m installclean`, etc)\n        - `atest MODULE`, `atest FILENAME#method1,method2,...`\n          (* _Method name completion doesn't seem work well on Zsh_)  \n        - Other commands such as `runahat PROCESSNAME|PID` and `stacks PROCESSNAME|PID`\n - Go\n\n## Features\n\n - Define completion in [an obvious-ish language](src/cmds/compromise-go/go.go) that supports both Bash and Zsh.\n - Generate dynamic candidates with [custom Go functions](src/cmds/compromise-adb/adb.go).\n - Show candidate description not only on Zsh but on Bash too.\n   - On Bash, completion candidates look like this (type `adb[SPACE][TAB]`):\n \u003cimg src=\"https://raw.githubusercontent.com/omakoto/compromise/master/img/compromise-adb.png\" width=600\u003e\n\n - Interactive selection (searching candidates with a query) on Bash using [fzf](https://github.com/junegunn/fzf).\n   See the next section for how to enable it.\n\n### Enabling Interactive Item Selection with [fzf](https://github.com/junegunn/fzf) on Bash (and maybe on Zsh too)\n\nIf [fzf](https://github.com/junegunn/fzf) is installed, Compromise can invoke it\nto let you interactively search for a candidate (which is the default behavior on Bash).\n\nTry pressing `[TAB]` twice to invoke fzf. (e.g. try `adb[SPACE][TAB][TAB]`)\n\n - If you want to disable it, add `export COMPROMISE_USE_FZF=0` to your `~/.bashrc`.\n - You can enable it on Zsh too by adding `export COMPROMISE_USE_FZF=1` to your `~/.zshrc`,\n   but Zsh won't redraw the current line after fzf finishes, so it's a bit awkward.\n   (For now, just refresh the command line by pressing `[ALT]+[Shift]+R`)\n \n  \n## Installing ADB and/or Go Completion\n\nAssuming you have the `go` command installed, just run the following commands in your shell.\n```bash\n# Get and install the binaries.\ngo get -v -u github.com/omakoto/compromise/src/cmds/...\n\n# Also install fzf, if you haven't already.\ngo get -v -u github.com/junegunn/fzf\n\n# Then to install completion, run them on your shell.\n# Add them to your shell's RC file (.bashrc or .zshrc) to make them persistent.\n. \u003c(compromise-adb) # Install ADB / fastboot / atest / m* completion\n. \u003c(compromise-go)  # Install Go completion\n\n# If you get \"command not found\", add ~/go/bin/ to your PATH, which is the default install\n# location.\n\n```\n \n *NOTE `go run` won't work; you need to actually compile them.*\n \n### Creating Aliases to ADB Subcommands\n - `compromise-adb` also installs completion for some \"shorthand\" commands,\nso if you have following aliases, completion will work for them too.\n\n```bash\nalias logcat=\"adb logcat\"\nalias dumpsys=\"adb shell dumpsys\"\nalias cmd=\"adb shell cmd\"\nalias am=\"adb shell am\"\nalias pm=\"adb shell pm\"\nalias settings=\"adb shell settings\"\nalias akill=\"adb shell kill\"\nalias akillall=\"adb shell killall\"\n  :\n```  \nFor the full supported command name list, see [the source code](src/cmds/compromise-adb/adb.go).\n \n - If you do not want to install completion for all the listed commands\n   in the source file, pass the command name you want to use as arguments. Example: \n\n```bash\n. \u003c(compromise-adb adb dumpsys) # Only install competion for the adb and dumpsys commands.  \n\n# or, disable selectively.\n\n. \u003c(compromise-adb - atest) # Install everything except for the atest completion.  \n```\n\n## Customization\n\nSome parameters are tunable via environmental variables.\nSee [this file](src/compromise/compenv/compenv.go).\n\n\n## Caveat\n\n It's still in an alpha stage. Details are subject to change, but feedback is welcome.\n\n## Known Issues\n\n - Not heavily tested on Zsh yet.\n\n## TODOs\n - Write tests for compromise-adb/go.\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomakoto%2Fcompromise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomakoto%2Fcompromise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomakoto%2Fcompromise/lists"}