{"id":13602918,"url":"https://github.com/DannyBen/opcode","last_synced_at":"2025-04-11T13:31:47.905Z","repository":{"id":33416304,"uuid":"139987512","full_name":"DannyBen/opcode","owner":"DannyBen","description":"Local Command Shortcuts","archived":false,"fork":false,"pushed_at":"2024-07-08T16:19:26.000Z","size":594,"stargazers_count":20,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-01T13:23:02.294Z","etag":null,"topics":["aliases","bash","shortcuts"],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/DannyBen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-07-06T13:17:48.000Z","updated_at":"2024-10-21T15:44:26.000Z","dependencies_parsed_at":"2024-01-13T19:42:46.004Z","dependency_job_id":"53fc2b67-214e-4c09-974e-cd2545b73d9e","html_url":"https://github.com/DannyBen/opcode","commit_stats":{"total_commits":137,"total_committers":2,"mean_commits":68.5,"dds":0.04379562043795615,"last_synced_commit":"a22b0e5b7638d54412d66b29e94155f0ea68d2f1"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fopcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fopcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fopcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Fopcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DannyBen","download_url":"https://codeload.github.com/DannyBen/opcode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223470321,"owners_count":17150535,"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":["aliases","bash","shortcuts"],"created_at":"2024-08-01T18:01:42.883Z","updated_at":"2024-11-07T06:30:38.650Z","avatar_url":"https://github.com/DannyBen.png","language":"Shell","funding_links":[],"categories":["bash","Shell"],"sub_categories":[],"readme":"\u003cdiv align='center'\u003e\n\u003cimg src='opcode-logo.svg' width=300\u003e\n\n# Opcode - Local Command Shortcuts\n\n![Version](https://img.shields.io/badge/version-1.1.1-blue.svg)\n![Test](https://github.com/DannyBen/opcode/workflows/Test/badge.svg)\n\n\u003c/div\u003e\n\n---\n\nOpcode lets you define a simple configuration file in any directory.\nThis file includes shortcuts to other commands.\n\n![Demo](/demo/cast.gif)\n\nFor a similar project, but for globally accessible aliases, see [alf][alf].\n\n\n## Install\n\nThe simplest way to install, is to run the installation script:\n\n```shell\n$ curl -Ls get.dannyb.co/opcode/setup | bash\n```\n\nIf you prefer to install manually, simply download the [op](/op) file,\nplace it somewhere in your path, and make it executable.\n\n## Usage\n\nWhen you execute `op`, Opcode will look for a file named `op.conf` (or opcode)\nin the current directory. See the [example/op.conf](example/op.conf) file\nfor reference.\n\nThe syntax of `op.conf` is simple:\n\nEach line should contain a code and the command to run:\n\n```shell\ncode: command to run\n```\n\nFor example:\n\n```shell\ncommit: git commit -am \"quick commit\"\n```\n\nWith this configuration, you can now simply run:\n\n```shell\n$ op commit\n```\n\nAny argument provided to the CLI will be forwarded to the command, so with \nthis configuration:\n\n```shell\ncommit: git commit -am\n```\n\nYou can supply a commit message:\n\n```shell\n$ op commit \"my commit message\"\n```\n\n## Additional Usage Utilities\n\n```\n$ op --help\n\nUsage:\n  op CODE [ARGS]\n    Execute a command from the config file (op.conf)\n    Arguments will be passed to the command (use with \"$@\")\n\n  op ?, -i, --info\n    Show all codes and their usage comments (#?)\n\n  op -l, --list\n    List command codes\n\n  op -s, --show\n    Show the config file (op.conf)\n\n  op -w, --what [CODE]\n    Show the command for a given code\n\n  op -e, --edit\n    Open the config file for editing\n\n  op -a, --add CODE COMMAND...\n    Append a command to the config file\n\n  op -h, --help\n    Show this message\n\n  op -v, --version\n    Show version number\n```\n\n## Multiline Commands\n\nIn order to specify multiple commands for a single code, provide the commands\nindented with one or more spaces immediately under the command code:\n\n```shell\nup:\n  docker compose build\n  docker compose up web\n```\n\nThe commands will be joined together using a newline, as they appear in your\nfile.\n\n## Positional Arguments\n\nAny excess argument provided when running `op CODE` will be available to you\nas they normally would in a bash script. You can access all of them by using\n`$@`, or the individual arguments at `$1`, `$2` etc.\n\nGiven this configuration:\n\n```shell\ndeploy: git commit -am \"$1\" \u0026\u0026 git push\n```\n\nYou can now run:\n\n```shell\n$ op deploy \"version 1.1.1\"\n```\n\nand it will be translated to this command\n\n```shell\ngit commit -am \"version 1.1.1\" \u0026\u0026 git push\n```\n\n## Usage Comments\n\nYou may add special usage comments in your `op.conf` file. These will be\ndisplayed alongside their command code when running `op ?`.  The usage comments\nmust start with `#?` and be placed underneath their associated command. \n\nFor example, this configuration file:\n\n```shell\n# op.conf\ndeploy: git commit -am \"$1\" \u0026\u0026 git push\n#? perform git commit and push.\n#? usage: op deploy COMMIT_MESSAGE\n\npull: git pull\n#? perform git pull\n```\n\nwill result in this output:\n\n```\n$ op ?\nUsage: op COMMAND [ARGS]\n  deploy\n    perform git commit and push.\n    usage: op deploy COMMIT_MESSAGE\n\n  pull\n    perform git pull\n```\n\n## Section Comments\n\nAny comment that starts with `##` will be considered a section header, and will\nbe displayed as such when running `op ?`.\n\nFor example, this configuration file:\n\n```shell\n# op.conf\n\n## Testing Commands\n\ntest: rspec \"$@\"\n#? Run tests\n\n## Git Commands\n\npull: git pull\n#? Perform git pull\n```\n\nwill result in this output:\n\n```shell\n$ op ?\nUsage: op COMMAND [ARGS]\n\nTesting Commands\n\n  test\n    Run tests\n\nGit Commands\n\n  pull\n    Perform git pull\n```\n\n\n## Private Commands\n\nUsing the keyword `private` in a separate line anywhere in your `op.conf` file\nwill hide all subsequent commands from `op ?` and `op --list`. The private\ncommands can still be executed.\n\n```shell\ndeploy: op clean \u0026\u0026 op build\ntest: docker compose run test\n\nprivate\n\nclean: rm tmp/*\nbuild: docker build\n```\n\n## Partial Command Matching\n\nWhen running a command, opcode will first try to find an exact match. If none\nis found, it will try to find a command that starts with the code you typed.\n\nIn other words, if you have this in your `op.conf` file:\n\n```shell\nserver: echo \"Running Server\" \u0026\u0026 rackup\n```\n\nYou can run it with `op server`, `op s` and anything in between. The first \nmatched command will be executed.\n\n## Bash Completion\n\nOpcode comes with bash completion. If you install opcode using the setup script,\nbash completion will be installed automatically.\n\nIf you install opcode manually, and would like to enable bash completion, \nsimply add this to your `~/.bashrc`:\n\n```shell\ncomplete -C 'op --completion' op\n```\n\n## Uninstalling\n\n```shell\n$ curl -Ls get.dannyb.co/opcode/uninstall | bash\n```\n\n## Contributing / Support\n\nIf you experience any issue, have a question or a suggestion, or if you wish\nto contribute, feel free to [open an issue][issues].\n\n---\n\n[issues]: https://github.com/DannyBen/opcode/issues\n[alf]: https://github.com/dannyben/alf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDannyBen%2Fopcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDannyBen%2Fopcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDannyBen%2Fopcode/lists"}