Compare commits

..
Author SHA1 Message Date
Robby RussellandClaude Opus 5.5 8ee263a828 fix(alias-finder): suggest aliases when the command starts with an alias
The automatic hook searched the command exactly as typed, so `k get pods`
never matched `kgp='kubectl get pods'`. It now searches the alias-expanded
command zsh passes to preexec ($3). When the command started with an alias,
only aliases that cover more of the command are suggested, so typing `gst`
alone still prints nothing.

Closes #12040

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 19:29:14 -08:00
Calion 44a5decbc4 docs(thefuck): put the plugins line in a code block (#13272)
Added copybox for plugin code
2026-11-27 19:23:33 -08:00
Abdullah Ahmed 90f9fbc532 feat(terraform): add terraform-docs completion (#14185)
Generate completions from the installed terraform-docs CLI in the background and preserve a valid cache when generation fails or returns no output.

Fixes #12138

AI-assisted with OpenAI Codex.
2026-11-27 19:01:52 -08:00
Tien Nguyen Minh 801782e8a6 fix(spectrum): fall back to a loop on zsh older than 5.0.6 (#14278) 2026-11-27 18:54:18 -08:00
Markus Hofbauer e7a67d2e80 ci: add alias collision check (#10859)
* first draft alias collision

* add collision check to github actions

* run python unit tests in CI

* update actions to latest major version

* rename test to tests

* improve error message

* print all collisions found before failing

* disable failing of collision checker temporarily

* fix CI

* refactor to pytest

* add filter for known collisions

* read known collisions from file

* removed resolved collision

* remove known collisions

* better use checkout

* explicitly use master

* fix plugin path

* move tool to .github workflows

* review comments

* pin actions
2026-11-27 18:34:48 -08:00
Jans Rautenbach 4ec1d17074 feat(kubectl): add kcgetns alias to show the current namespace (#13215)
* rebase and review changes

* full command in readme

* space
2026-11-27 18:33:03 -08:00
180909 71679f351d feat(golang): add goge alias for go generate (#11528)
* feat(golang): add `goge` alias for `go generate`

* feat(golang):update  sequence
2026-11-27 18:32:08 -08:00
Sri Harsha Ponukumati 5c7cd91615 fix(uninstall): prompt before restoring pre-OMZ zshrc backup (#13849)
Fixes #13156
Fixes #13328
2026-11-27 18:30:43 -08:00
Jakub Boukal 5873e1cfec docs(python): add PYTHON_AUTO_VRUN to settings (#14233) 2026-11-27 16:20:27 -08:00
alexanderxc 03ba23c9f6 chore(brew): use bu instead of bubo in bubu (#14229) 2026-11-27 16:19:51 -08:00
PerryLink 597dff9477 fix(extract): untar .tar.Z and .taz archives (#14223) 2026-11-27 16:19:46 -08:00
Marco Trevisan 80ec81e340 feat(clipboard): add OSC 52 fallback (#14251)
OSC 52 makes the terminal emulator set the clipboard of the machine the
user is connected from, which is the only way to copy to it when running
over SSH or inside a container with no access to the local display
server.

Use it when no other clipboard tool is available, or when
ZSH_CLIPBOARD_OSC52 is set to "always"; set it to "never" to disable the
fallback. OSC 52 is write-only in practice, so clippaste keeps failing
unless a real clipboard tool is available.

Closes #13459
2026-11-27 16:19:24 -08:00
Sam Thomas 22c883efa4 fix(dotenv): bypass aliases when checking .env syntax (#14179) 2026-11-27 15:33:11 -08:00
Sam Thomas da85047297 fix(updater): bypass aliases when calling zsh in update check (#14178) 2026-11-27 15:33:06 -08:00
Jay Pokale 113f9b2475 fix(cli): remove adjacent plugins in omz plugin disable (#14303) 2026-11-27 15:19:41 -08:00
Martin Darmüntzel 507561c236 fix(macos): set shuffle with Music's shuffle property in music shuffle (#13365) 2026-11-27 14:58:20 -08:00
Hobeom Jeon d419792761 feat(conda): add environment completion for cna and cnrn (#13632) 2026-11-27 14:54:10 -08:00
Hobeom Jeon 90e5779f1f feat(zellij): add zellij plugin (#13624) 2026-11-27 14:54:06 -08:00
gbaian10 1dc43bfe53 fix(pre-commit): use autoupdate for prek (#14295)
Closes #14294
2026-11-27 14:46:13 -08:00
Rasmus Skovgaard Lauritsen 387dfe0bfb feat(fizzy): add completion plugin (#14297) 2026-11-27 14:46:09 -08:00
Sanjay Doppalapudi 32726ad0a5 fix(extract): unpack .tar.lzma archives (#14298) 2026-11-27 14:46:04 -08:00
Hegui Dai 2cd4cc21fc feat(jj): add jjgpb alias for jj git push --bookmark (#14302) 2026-11-27 14:45:52 -08:00
anacletoTM aa9ca00520 refactor(laravel): consolidate versioned plugins (#14282)
* refactor(laravel): consolidate versioned plugins

* fix(laravel): scope legacy aliases and defer command discovery
2026-11-27 13:31:49 -08:00
Alexander Schaber 924db8c81b refactor(plugins): use cached background completion generation (#13662)
Move invoke, istioctl, kn, kompose, kops, oc, operator-sdk, please and
svcat off sourcing `<($cmd completion ...)` on every startup. The
completion script is now cached under $ZSH_CACHE_DIR/completions and
regenerated in the background, following the pattern used by the helm
plugin.

Writes go through a temp file (prefixed with a dot to keep it out of
$fpath) that is moved into place atomically with `zf_mv`, so a
half-written file is never sourced.
2026-11-27 13:23:29 -08:00
원영 53f0790157 feat(git): add gsms alias for git submodule status (#13586) 2026-11-27 13:22:57 -08:00
Jim Weller abfce729ab feat(terragrunt): add terragrunt plugin (#13261) 2026-11-26 07:29:16 -08:00
Shahab Ahmed 070831e592 fix(extract): extract .deb members without double nesting (#14199)
Closes #14200
2026-11-26 07:29:06 -08:00
Federico Tensi e333686c2a feat(git-commit): support optional commit body (#14169) 2026-11-26 07:28:56 -08:00
Nuri Jung b1d468701a fix(git): remove unnecessary git rm from gwip (#13410) 2026-11-26 07:28:45 -08:00
kang 12a6ce7e42 feat(python): add recursive parent directory search for auto_vrun (#13523) 2026-11-26 07:20:36 -08:00
Kennan LeJeune f5a74e0347 feat(fnox): add plugin (#13593) 2026-11-26 07:20:27 -08:00
Randommisha13 0876f10264 feat(systemd): support other privilege elevation tools (#13695) 2026-11-26 07:20:17 -08:00
Thejesh 4d643a3c86 fix(web-search): escape reserved characters like + and & (#14275) 2026-11-26 07:20:09 -08:00
Thejesh 1a05a1091b fix(cli): add plugins to an empty plugins=() list (#14276) 2026-11-26 06:51:15 -08:00
Jonathan Stacks ad66117d08 feat(talosctl): add completions for talosctl (#13682) 2026-11-26 06:50:09 -08:00
Morningstar202604 964e5b65c6 fix(vi-mode): fix stale clipboard retry after failed push (#14141) 2026-11-26 06:45:29 -08:00
Ngonidzashe Mangudya 1eebae3a3f feat(laravel): add aliases for nWidart/laravel-modules (#14293) 2026-11-25 06:15:06 -08:00
mattmc3 ca5b808de8 feat(zsh-patina): add completions (#14296) 2026-11-25 06:11:57 -08:00
mattmc3 c8aea70a11 feat(zsh-patina): add completions (#14296) 2026-11-25 06:02:51 -08:00
Ininsico 799f9a8a8a fix(colorize): pass ZSH_COLORIZE_CHROMA_FORMATTER to cless (#13781)
Closes #12650
2026-11-24 21:22:08 -08:00
Mai-Lapyst 7140fedbfa docs(pre-commit): fix prek repository link (#13630) 2026-11-24 15:56:32 -08:00
Arbian Shkodra b5cb2fe952 feat(hcloud): add hcloud_prompt_info function (#13535) 2026-11-24 15:32:52 -08:00
Yu Xiang Z. 49766a713a perf(aws): read profiles and region from config files instead of the CLI (#13537)
* perf(aws): read profiles from config files before falling back to the CLI

`aws configure list-profiles` takes ~0.5s to start, and `asp`/`acp` tab
completion runs it every time. Read ~/.aws/config and ~/.aws/credentials
directly instead, and only call the CLI if neither file is readable.

* perf(aws): read the profile region from the config file in asp

`asp` ran `aws configure get region` on every switch, which takes ~0.5s,
and the saved-state restore ran it in every new shell. Read the region
from ~/.aws/config directly, and only call the CLI when the profile has
no region there.
2026-11-24 15:18:48 -08:00
Vincent Castelluci 570bd64a56 feat(mvn): add mvncpst and mvncpsto aliases (#13463) 2026-11-24 15:09:15 -08:00
Federico A. Corazza ad203cc9c4 fix(nicoulaj): remove executable bit from theme file (#13199) 2026-11-24 13:36:10 -08:00
danielwerg 89ec2b437b fix(man,tldr): move cursor to end of line after inserting the command (#13186) 2026-11-24 13:28:43 -08:00
mattmc3 3943d2f880 feat(zsh-patina): add zsh-patina plugin (#14225)
- eval `zsh-patina activate` when installed, else print install URL
- ZSH_PATINA_BINARY overrides the binary path, eg: ~/.cargo/bin
- skip with a warning when zsh-syntax-highlighting is enabled
- modeled on the zoxide plugin
2026-11-24 13:23:36 -08:00
Junpei Zhangandpei711 a449ed2c4e docs: fix grammar in uv plugin README (#14205)
Co-authored-by: pei711 <pei711@users.noreply.github.com>
2026-11-24 12:53:49 -08:00
JimMoen a32fc1d8ae feat(docker): add dvrm alias for docker volume rm (#11781) 2026-11-24 12:08:56 -08:00
Runrioter Wung 1195c3a15e fix(tmux): handle $EDITOR with options in tmuxconf alias (#14159)
* fix(tmux): handle `$EDITOR` with options in `tmuxconf` alias

* docs(tmux): update docs for `tmuxconf`
2026-11-24 11:39:45 -08:00
Srinivas Chippagiri f68e5ec392 fix(poetry): make psh and psync work with Poetry 2 (#14283) 2026-11-24 11:37:22 -08:00
27506acc8a fix(encode64): support BSD base64 and quote arguments (#14269)
* encode64: support BSD base64 and quote arguments

* chore: remove pr-body.md and pr-title.txt from branch

---------

Co-authored-by: pei711 <pei711@users.noreply.github.com>
Co-authored-by: pei711 <3922088406@qq.com>
2026-11-24 11:28:08 -08:00
Morningstar202604 109270911c feat(cli): add omz diagnose locale check (#14140)
* feat(core): add `omz diagnose` locale check

Reports whether the runtime locale is UTF-8, using the CODESET parameter
of the zsh/langinfo module that lib/functions.zsh already loads at startup,
with a `locale charmap` fallback when the module is unavailable. Non-UTF-8
charsets cause completion glitches such as duplicated characters at the
prompt.

This replaces the startup warning proposed in the earlier iteration: per
maintainer feedback the check belongs in `omz diagnose` so that no shell
startup cost is paid and it only surfaces when the user is already
debugging their setup.

I used AI to draft and rework this change.

* docs: document omz diagnose in README

Add a Diagnostics section below the update instructions describing
`omz diagnose` and pointing at `omz_diagnostic_dump` for full reports.

I used AI to draft this change.
2026-11-24 11:28:01 -08:00
Morningstar202604andMorningstar202604 49a6348eac fix(dirhistory): fix typo in push_future duplicate check (#14149)
`push_future` referenced `$dirhistory_futuret` (missing the 'e' - a
typo) in its duplicate check, so `$dirhistory_futuret[...]` was an
undefined variable and consecutive identical entries were never skipped.
ALT-RIGHT navigation then revisited the same directory repeatedly.
Match `push_past`, which uses `$dirhistory_past` correctly.

Co-authored-by: Morningstar202604 <morningstar202604@users.noreply.github.com>
2026-11-24 11:27:54 -08:00
anacletoTM 2aa7aed78b fix(ember-cli): correct version help completion (#14281) 2026-11-24 10:47:01 -08:00
dependabot[bot] 93b87c9c9a chore(deps): bump semver (#14271)
Signed-off-by: dependabot[bot] <support@github.com>
2026-11-24 10:49:33 +01:00
dependabot[bot] 8a85fa2243 chore(deps): bump the gha-minor group with 3 updates (#14272)
Signed-off-by: dependabot[bot] <support@github.com>
2026-11-24 10:49:18 +01:00
Faris Basha TM 6c31a91a3e docs(jj): fix dead link to the template syntax docs (#14259)
The jj documentation moved from martinvonz.github.io/jj to
docs.jj-vcs.dev, and the old templates page now returns 404.
2026-11-23 16:33:06 -08:00
TINGyu123644 c52efbc756 docs(dotenv): fix dead 1Password Environments doc link (#14257)
The link to the 1Password Environments docs used the old singular
`/docs/environment/` path which now returns 404. 1Password moved the
page to the plural `/docs/environments/` path. Updates the single link
in the dotenv plugin README so readers reach the current docs.
2026-11-23 16:16:49 -08:00
Rasmus Skovgaard Lauritsen e35c9b4b67 feat(bitwarden): add completions for bw and bws (#14261)
* feat(bws): add completion plugin

* feat(bitwarden): unify bw and bws completions
2026-11-23 15:56:41 -08:00
Divya 87aa1a9b89 fix(changelog): hide reverted commits again after the switch to 12-char hashes (#14262)
* fix(changelog): hide reverted commits again after the switch to 12-char hashes

Since #12096 the commit list is read with `--abbrev=12`, so the `types`
array is keyed by 12-character hashes, but `commit:is-revert` still
returned the first 7 characters of the reverted hash. The lookup in
`display-release` never matched, and both a reverted commit and its
`Revert "..."` commit were listed in the changelog.

* test(changelog): cover hiding reverted commits
2026-11-22 10:18:48 -08:00
Divya ca0a63f0ee fix(jsontools): print JSON, not YAML, in pp_json with the ruby method (#14263)
* fix(jsontools): print JSON, not YAML, in `pp_json` with the ruby method

The ruby implementation of `pp_json` converted the parsed input to YAML
(`to_yaml`), while the node and python3 implementations, and the README,
pretty-print JSON. Use `JSON.pretty_generate` with the same 4-space
indent as the other methods.

* test(jsontools): cover the ruby method
2026-11-22 10:16:39 -08:00
Martino Pulici a7f4e49946 fix(alias-finder): avoid echo escape evaluation and xargs errors (#14264) 2026-11-22 10:12:23 -08:00
Julian Oes 3ecde00d94 fix(mortalscumbag): compare against the tracked branch, not origin (#14265)
The ahead/behind markers compared HEAD with `origin/<branch>`, so in a
fork where the branch tracks a different remote they reported the
difference to `origin` instead of to the branch's own upstream. Use
`@{upstream}`, like `git_commits_ahead`/`git_commits_behind` in
lib/git.zsh do. A branch without an upstream shows no marker.
2026-11-22 10:09:30 -08:00
Sainnhe Park 902761f897 feat(gcloud): support FreeBSD (#14268)
FreeBSD installs zsh completion def into `/usr/local/google-cloud-sdk/completion.zsh.inc`. This commit adds `/usr/local/google-cloud-sdk` to `search_locations` so the gcloud plugin can discover this file.
2026-11-22 09:55:06 -08:00
Martino Pulici c0140703a5 fix(alias-finder): localize c and cmdLen variables (#14253) 2026-11-16 13:08:14 +01:00
Zain Qureshi ffe93241cc docs(drush): fix drdmp expansion (#14138) 2026-11-16 13:07:55 +01:00
dependabot[bot] ca82ba6831 chore(deps): bump semver from 3.1.0 to 3.1.1 in /.github/workflows/dependencies in the py-minor group (#14255)
Signed-off-by: dependabot[bot] <support@github.com>
2026-11-16 12:59:33 +01:00
dependabot[bot] e957b67eed chore(deps): bump step-security/harden-runner from 2.22.3 to 2.22.4 in the gha-minor group (#14254)
Signed-off-by: dependabot[bot] <support@github.com>
2026-11-16 12:59:30 +01:00
Paolo Valletta 6010fb6260 fix(mvn): complete with compsys instead of compctl (#14241) 2026-11-09 13:36:11 +01:00
Iain 044bcbf82d fix(npm): replace removed npm bin in npmE (#14250) 2026-11-09 13:34:47 +01:00
dependabot[bot] 2d03d8ac01 chore(deps): bump github/codeql-action/upload-sarif from 4.39.1 to 4.39.3 in the gha-minor group (#14249)
Signed-off-by: dependabot[bot] <support@github.com>
2026-11-09 13:33:18 +01:00
Robby Russell f5d571c66d feat(core): invite users to star the repo on github (#14248) 2026-11-09 13:32:35 +01:00
Iain cca3bdfbef fix(web-search)!: remove ask.com, which has shut down (#14244)
BREAKING CHANGE: the `ask` engine and alias are removed from the web-search plugin, because Ask.com has shut down.
2026-11-06 05:42:13 -08:00
Wei-Lun Li 59ff4d042e fix(timer): round duration before splitting off minutes (#14246) 2026-11-06 05:40:48 -08:00
dependabot[bot] b509b1c6ed chore(deps): bump certifi (#14237)
Bumps the py-minor group in /.github/workflows/dependencies with 1 update: [certifi](https://github.com/certifi/python-certifi).


Updates `certifi` from 2026.10.19 to 2026.10.23
- [Commits](https://github.com/certifi/python-certifi/compare/2026.10.19...2026.10.23)

---
updated-dependencies:
- dependency-name: certifi
  dependency-version: 2026.10.23
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: py-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-02 09:23:31 +01:00
dependabot[bot] c483ff288d chore(deps): bump step-security/harden-runner (#14238)
Bumps the gha-minor group with 1 update: [step-security/harden-runner](https://github.com/step-security/harden-runner).


Updates `step-security/harden-runner` from 2.22.2 to 2.22.3
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/dc2769abcc0fcfbadfc1df54081c1608579ef6b2...46b06cea07f9e64621fdf066ba77ac6915163d43)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.22.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gha-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-02 09:23:10 +01:00
BreakerandCarlo Sala 17a2b4c3a5 fix(clipboard): strip PowerShell carriage returns on WSL (#14216)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2026-10-27 12:37:49 +01:00
dependabot[bot] d2b7f557cc chore(deps): bump certifi (#14212)
Bumps the py-minor group in /.github/workflows/dependencies with 1 update: [certifi](https://github.com/certifi/python-certifi).


Updates `certifi` from 2026.7.22 to 2026.10.19
- [Commits](https://github.com/certifi/python-certifi/compare/2026.07.22...2026.10.19)

---
updated-dependencies:
- dependency-name: certifi
  dependency-version: 2026.10.19
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: py-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-25 15:39:31 +01:00
dependabot[bot] c61578a8d2 chore(deps): bump the gha-minor group with 3 updates (#14213)
Bumps the gha-minor group with 3 updates: [step-security/harden-runner](https://github.com/step-security/harden-runner), [actions/setup-python](https://github.com/actions/setup-python) and [github/codeql-action/upload-sarif](https://github.com/github/codeql-action).


Updates `step-security/harden-runner` from 2.22.1 to 2.22.2
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/ccd8616d44fd3846e67624a50d5aad6d37bf2d25...dc2769abcc0fcfbadfc1df54081c1608579ef6b2)

Updates `actions/setup-python` from 7.0.0 to 7.1.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/5fda3b95a4ea91299a34e894583c3862153e4b97...6d4fd22b20465ccc0f7354476588e8df7c9ca0e0)

Updates `github/codeql-action/upload-sarif` from 4.39.0 to 4.39.1
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee...9b3254085494b55a0f7c4c2b3d2d52cc712ce370)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.22.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gha-minor
- dependency-name: actions/setup-python
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gha-minor
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.39.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gha-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-25 15:38:34 +01:00
Robby Russell 2100c630ba feat(bridgetown)!: update aliases for current CLI (#14197)
BREAKING CHANGE: aliases updated for the latest bridgetown version (2.2.2). Check out the plugin README for the changes.
2026-10-21 12:31:14 +02:00
mattmc3andCarlo Sala 0eeaa529bb feat(git-commit): use git-dash commands (#12628)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2026-10-20 11:44:08 +02:00
dependabot[bot] f888be4bec chore(deps): bump the gha-minor group with 3 updates (#14193)
Signed-off-by: dependabot[bot] <support@github.com>
2026-10-20 11:26:42 +02:00
umutcagand 0650a25040 fix(jsontools): read Node.js input from stdin (#14190) 2026-10-19 17:21:44 -07:00
umutcagand 741642d7a9 fix(extract): preserve .lzma and .Z source files (#14191) 2026-10-19 17:21:39 -07:00
Aurantium🍊 84038f144d docs(uv): correct project initialization descriptions (#14184) 2026-10-19 17:21:08 -07:00
冰水泡枸杞andMarkus Towara a208c3a27a fix(docker): create completions cache dir if missing (#14188)
Closes #13679

Co-Authored-By: Markus Towara <mtowara@gmail.com>
2026-10-19 17:17:06 -07:00
Lichao Chen b056a436fe fix(sfdx): remove duplicated 'for' in completion description (#14195)
Signed-off-by: Lichao Chen <lichao_chen@outlook.com>
2026-10-19 17:13:28 -07:00
Robby RussellandCarlo Sala 964ddf789b feat(cli): add Shellsavers terminal animations (#14167)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2026-10-13 11:22:24 +02:00
John D Pell fab613bd93 fix(termsupport): improve Apple Terminal support (#14172) 2026-10-13 10:41:24 +02:00
Robby Russell 1e3960e6f9 feat(opencode): add completion and opc aliases (#14082) 2026-10-13 10:40:23 +02:00
dependabot[bot] cbf4a572ef chore(deps): bump the gha-minor group with 3 updates (#14176)
Bumps the gha-minor group with 3 updates: [step-security/harden-runner](https://github.com/step-security/harden-runner), [actions/upload-artifact](https://github.com/actions/upload-artifact) and [github/codeql-action/upload-sarif](https://github.com/github/codeql-action).


Updates `step-security/harden-runner` from 2.21.1 to 2.22.1
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/e14015d583714f6e62063499dc959a02595150a1...ccd8616d44fd3846e67624a50d5aad6d37bf2d25)

Updates `actions/upload-artifact` from 7.0.1 to 7.0.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/043fb46d1a93c77aae656e7c1c64a875d1fc6a0a...cf430e030ddbb5b0abf93d22962f4752f3646cd9)

Updates `github/codeql-action/upload-sarif` from 4.38.2 to 4.38.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2...24c54180a607b1449ed407dd24f251e4e9147c8d)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.22.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gha-minor
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gha-minor
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.38.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gha-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-13 10:38:57 +02:00
Piotr Minkina 55c9071ee7 feat(docker-compose): add aliases for --watch (#13203) 2026-10-13 10:36:54 +02:00
Rik Wanders 083c339e06 feat(git): add gshs alias for git show --stat (#13249) 2026-10-12 03:55:10 -07:00
Masafumi Koba 417c814e2e feat(rbenv): provide completion for rbenv command (#12891)
Ref https://github.com/rbenv/rbenv/#shell-completions
2026-10-12 03:47:39 -07:00
Pete Johns 7d34868725 perf(mise): regenerate completion only when stale (#13759) 2026-10-12 03:34:33 -07:00
Inkyu Oh 106f9874a2 fix(updater): accept Korean IME 'ㅛ' as yes in update prompt (#13791)
On the Korean Dubeolsik keyboard layout, the Y key position produces ㅛ
(U+315B) when a Korean IME is active. Since the update confirmation prompt
only matched [yY$'\n'], Korean users who pressed the Y key with the IME on
had their update silently cancelled. Accept ㅛ as an affirmative answer.
2026-10-11 16:39:36 -07:00
Kunpeng Xie eb29cdb33a fix(globalias): preserve quoted words and assignment values (#14092)
Only invoke alias completion when the complete shell word is an alias name. Completion otherwise treats assignment values and quoted text as standalone alias names, corrupting inputs such as DEBUG=1.

Add a real ZLE regression test covering the reported assignments, quotes, escaped aliases, filtering, and existing expansion behavior.

Assisted-by: OpenAI Codex
2026-10-11 15:58:22 -07:00
Martin MeyerandClaude Opus 5.5 535aaaf924 feat(gpg-agent): add ssh-support style to skip the gpgconf check (#14171)
The plugin runs `gpgconf --list-options gpg-agent` on every shell start
to learn whether `enable-ssh-support` is set. On macOS with GnuPG 2.5.24
that one command takes about 600 ms.

The `ssh-support` style lets the user state the answer instead. With
`no` the plugin sets `GPG_TTY` and stops. That also skips the preexec
hook, which runs `gpg-connect-agent updatestartuptty` before every
command and is only needed for ssh support. With `yes` the plugin sets
`SSH_AUTH_SOCK` without asking.

Left unset, the plugin detects as before, so existing setups do not
change.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 15:46:27 -07:00
Aryan 05c2cb0b2b fix(ruby): preserve special characters in rfind filenames (#14173) 2026-10-11 15:46:21 -07:00
Aryan bd9fb5231b docs(ruby): include -run in the rserver example (#14174) 2026-10-11 15:40:40 -07:00
ohmyzsh[bot] 48feb570f7 chore(zsh-syntax-highlighting): update to e6683f20 (#14175)
Co-authored-by: ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
2026-10-11 10:27:56 +02:00
Ken van der Eerden 42a4ccb1b1 feat(laravel): add setting to override the php command (#14146)
Aliases always ran `php artisan`, so users of Laravel Herd (`herd php`)
or a versioned binary (`php8.4`) couldn't use them. The new
`zstyle ':omz:plugins:laravel' php` setting replaces `php` in every
alias; without it the aliases are unchanged.
2026-10-09 07:11:17 -07:00
Minh Vu 2d833b453d fix(copyfile): stop on clipboard failure (#14154) 2026-10-09 07:03:29 -07:00
dhairya d7aca552b3 fix(extract): preserve bzip2 archives and honor extraction destination (#14152) 2026-10-09 07:01:26 -07:00
158 changed files with 3770 additions and 439 deletions

No files matched your search

+1 -1
View File
@@ -75,7 +75,7 @@ dependencies:
plugins/zsh-syntax-highlighting:
repo: zsh-users/zsh-syntax-highlighting
branch: master
version: 2fc57d63067c18b1100ecdbf684fa5baf49459d1
version: e6683f20e5c38d3e5447f45845d04ddda75d0f23
precopy: |
set -e
version=$(<.version)
@@ -0,0 +1,2 @@
# default known collisions file
known_collisions.json
@@ -0,0 +1,170 @@
"""Check for alias collisions within the codebase"""
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from pathlib import Path
from dataclasses import dataclass
import itertools
import re
import json
import sys
ERROR_MESSAGE_TEMPLATE = (
"Alias `%s` defined in `%s` already exists as alias `%s` in `%s`."
)
KNOWN_COLLISIONS_PATH = Path(__file__).resolve().parent / "known_collisions.json"
def dir_path(path_string: str) -> Path:
if Path(path_string).is_dir():
return Path(path_string)
else:
raise NotADirectoryError(path_string)
def parse_arguments():
parser = ArgumentParser(
description=__doc__,
formatter_class=ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
"folder",
type=dir_path,
help="Folder to check",
)
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(
"--known-collisions",
type=Path,
default=None,
help="Json-serialized list of known collision to compare to",
)
group.add_argument(
"--known-collisions-output-path",
type=Path,
default=KNOWN_COLLISIONS_PATH,
help="Output path for a json-serialized list of known collisions",
)
return parser.parse_args()
@dataclass(frozen=True)
class Alias:
alias: str
value: str
module: Path
def to_dict(self) -> dict:
return {
"alias": self.alias,
"value": self.value,
"module": str(self.module),
}
@dataclass(frozen=True)
class Collision:
existing_alias: Alias
new_alias: Alias
def is_new_collision(self, known_collision_aliases: list[str]) -> bool:
return self.new_alias.alias not in known_collision_aliases
@classmethod
def from_dict(cls, collision_dict: dict) -> "Collision":
return cls(
Alias(**collision_dict["existing_alias"]),
Alias(**collision_dict["new_alias"]),
)
def to_dict(self) -> dict:
return {
"existing_alias": self.existing_alias.to_dict(),
"new_alias": self.new_alias.to_dict(),
}
def find_aliases_in_file(file: Path) -> list[Alias]:
matches = re.findall(
r"^[ \t]*alias (?:-[gs] )?([^ =]+)=['\"]?(.*?)['\"]?$",
file.read_text(),
re.MULTILINE,
)
return [Alias(match[0], match[1], file) for match in matches]
def load_known_collisions(collision_file: Path) -> list[Collision]:
collision_list = json.loads(collision_file.read_text())
return [Collision.from_dict(collision_dict) for collision_dict in collision_list]
def find_all_aliases(path: Path) -> list:
aliases = [find_aliases_in_file(file) for file in path.rglob("*.zsh")]
return list(itertools.chain(*aliases))
def check_for_duplicates(aliases: list[Alias]) -> list[Collision]:
elements = {}
collisions = []
for alias in aliases:
if alias.alias in elements:
existing = elements[alias.alias]
collisions.append(Collision(existing, alias))
else:
elements[alias.alias] = alias
return collisions
def print_collisions(collisions: dict[Alias, Alias]) -> None:
if collisions:
print(f"Found {len(collisions)} alias collisions:\n")
for collision in collisions:
print(
ERROR_MESSAGE_TEMPLATE
% (
f"{collision.new_alias.alias}={collision.new_alias.value}",
collision.new_alias.module.name,
f"{collision.existing_alias.alias}={collision.existing_alias.value}",
collision.existing_alias.module.name,
)
)
print("\nConsider renaming your aliases.")
else:
print("Found no collisions")
def check_for_new_collisions(
known_collisions: Path, collisions: list[Collision]
) -> list[Collision]:
known_collisions = load_known_collisions(known_collisions)
known_collision_aliases = [
collision.new_alias.alias for collision in known_collisions
]
return [
collision
for collision in collisions
if collision.is_new_collision(known_collision_aliases)
]
def main() -> int:
"""main"""
args = parse_arguments()
aliases = find_all_aliases(args.folder)
collisions = check_for_duplicates(aliases)
if args.known_collisions is not None:
new_collisions = check_for_new_collisions(args.known_collisions, collisions)
print_collisions(new_collisions)
return -1 if new_collisions else 0
args.known_collisions_output_path.write_text(
json.dumps([collision.to_dict() for collision in collisions])
)
return 0
if __name__ == "__main__":
sys.exit(main())
@@ -0,0 +1,2 @@
pyfakefs
pytest
@@ -0,0 +1,166 @@
from pathlib import Path
from pyfakefs.fake_filesystem import FakeFilesystem
import pytest
from check_alias_collision import (
dir_path,
find_all_aliases,
find_aliases_in_file,
check_for_duplicates,
Alias,
Collision,
load_known_collisions,
)
THREE_ALIASES = """
alias g='git'
alias ga='git add'
alias gaa='git add --all'
"""
CONDITIONAL_ALIAS = """
is-at-least 2.8 "$git_version" \
&& alias gfa='git fetch --all --prune --jobs=10' \
|| alias gfa='git fetch --all --prune'
"""
ONE_KNOWN_COLLISION = """
[
{
"existing_alias": {
"alias": "gcd",
"value": "git checkout $(git_develop_branch)",
"module": "plugins/git/git.plugin.zsh"
},
"new_alias": {
"alias": "gcd",
"value": "git checkout $(git config gitflow.branch.develop)",
"module": "plugins/git-flow/git-flow.plugin.zsh"
}
}
]
"""
def test_dir_path__is_dir__input_path(fs: FakeFilesystem) -> None:
fs.create_dir("test")
assert Path("test") == dir_path("test")
def test_dir_path__is_file__raise_not_a_directory_error(fs: FakeFilesystem) -> None:
fs.create_file("test")
with pytest.raises(NotADirectoryError):
dir_path("test")
def test_dir_path__does_not_exist__raise_not_a_directory_error(
fs: FakeFilesystem,
) -> None:
with pytest.raises(NotADirectoryError):
dir_path("test")
def test_find_all_aliases__empty_folder_should_return_empty_list(
fs: FakeFilesystem,
) -> None:
fs.create_dir("test")
result = find_all_aliases(Path("test"))
assert [] == result
def test_find_aliases_in_file__empty_text_should_return_empty_list(
fs: FakeFilesystem,
) -> None:
fs.create_file("empty.zsh")
result = find_aliases_in_file(Path("empty.zsh"))
assert [] == result
def test_find_aliases_in_file__one_alias_should_find_one(fs: FakeFilesystem) -> None:
fs.create_file("one.zsh", contents="alias g='git'")
result = find_aliases_in_file(Path("one.zsh"))
assert [Alias("g", "git", Path("one.zsh"))] == result
def test_find_aliases_in_file__three_aliases_should_find_three(
fs: FakeFilesystem,
) -> None:
fs.create_file("three.zsh", contents=THREE_ALIASES)
result = find_aliases_in_file(Path("three.zsh"))
assert [
Alias("g", "git", Path("three.zsh")),
Alias("ga", "git add", Path("three.zsh")),
Alias("gaa", "git add --all", Path("three.zsh")),
] == result
def test_find_aliases_in_file__one_conditional_alias_should_find_none(
fs: FakeFilesystem,
) -> None:
fs.create_file("conditional.zsh", contents=CONDITIONAL_ALIAS)
result = find_aliases_in_file(Path("conditional.zsh"))
assert [] == result
def test_check_for_duplicates__no_duplicates_should_return_empty_dict() -> None:
result = check_for_duplicates(
[
Alias("g", "git", Path("git.zsh")),
Alias("ga", "git add", Path("git.zsh")),
Alias("gaa", "git add --all", Path("git.zsh")),
]
)
assert result == []
def test_check_for_duplicates__duplicates_should_have_one_collision() -> None:
result = check_for_duplicates(
[
Alias("gc", "git commit", Path("git.zsh")),
Alias("gc", "git clone", Path("git.zsh")),
]
)
assert result == [
Collision(
Alias("gc", "git commit", Path("git.zsh")),
Alias("gc", "git clone", Path("git.zsh")),
)
]
def test_is_new_collision__new_alias_not_in_known_collisions__should_return_true() -> (
None
):
known_collisions = ["gc", "gd"]
new_alias = Alias("ga", "git add", Path("git.zsh"))
collision = Collision(Alias("gd", "git diff", Path("git.zsh")), new_alias)
assert collision.is_new_collision(known_collisions) is True
def test_is_new_collision__new_alias_in_known_collisions__should_return_false() -> None:
known_collisions = ["gc", "gd", "ga"]
new_alias = Alias("ga", "git add", Path("git.zsh"))
collision = Collision(Alias("gd", "git diff", Path("git.zsh")), new_alias)
assert collision.is_new_collision(known_collisions) is False
def test_load_known_collisions__empty_file__should_return_empty_list(
fs: FakeFilesystem,
) -> None:
empty_list = Path("empty.json")
fs.create_file(empty_list, contents="[]")
result = load_known_collisions(empty_list)
assert [] == result
def test_load_known_collisions__one_collision__should_return_one_collision(
fs: FakeFilesystem,
) -> None:
known_collisions_file = Path("known_collisions.json")
fs.create_file(known_collisions_file, contents=ONE_KNOWN_COLLISION)
result = load_known_collisions(known_collisions_file)
assert 1 == len(result)
assert "gcd" == result[0].existing_alias.alias
+3 -3
View File
@@ -16,7 +16,7 @@ jobs:
contents: write # this is needed to push commits and branches
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
@@ -26,12 +26,12 @@ jobs:
fetch-depth: 0
- name: Authenticate as @ohmyzsh
id: generate-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with:
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.12"
cache: "pip"
@@ -1,7 +1,7 @@
certifi==2026.7.22
certifi==2026.10.23
charset-normalizer==3.5.2
idna==3.20
PyYAML==6.0.3
requests==2.34.2
semver==3.1.0
semver==3.1.2
urllib3==2.8.0
+2 -2
View File
@@ -26,7 +26,7 @@ jobs:
- macos-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
@@ -47,7 +47,7 @@ jobs:
- test
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
+29 -1
View File
@@ -24,7 +24,7 @@ jobs:
if: github.repository == 'ohmyzsh/ohmyzsh'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
@@ -41,3 +41,31 @@ jobs:
./themes/*.zsh-theme; do
zsh -n "$file" || return 1
done
collisions:
name: Check alias collisions
runs-on: ubuntu-latest
steps:
- name: Set up git repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.14'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r .github/workflows/alias_collision/requirements.txt
- name: Run unit tests
run: |
cd .github/workflows/alias_collision/
python -m pytest
- name: Checkout target branch
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: ohmyzsh-target-branch
ref: master
- name: Check for alias collisions on target branch
run: python .github/workflows/alias_collision/check_alias_collision.py ohmyzsh-target-branch/plugins --known-collisions-output-path known_alias_collisions.json
- name: Compare known collisions to new collisions on source branch
run: python .github/workflows/alias_collision/check_alias_collision.py plugins --known-collisions known_alias_collisions.json
+2 -2
View File
@@ -17,12 +17,12 @@ jobs:
if: github.repository == 'ohmyzsh/ohmyzsh'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
- name: Authenticate as @ohmyzsh
id: generate-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with:
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
+4 -4
View File
@@ -36,7 +36,7 @@ jobs:
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
@@ -46,20 +46,20 @@ jobs:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc # v2.4.4
uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0
with:
results_file: results.sarif
results_format: sarif
publish_results: true
- name: "Upload artifact"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: SARIF file
path: results.sarif
retention-days: 5
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
sarif_file: results.sarif
+42
View File
@@ -45,6 +45,7 @@ Twitter), and join us on [Discord](https://discord.gg/ohmyzsh).
- [Using Plugins](#using-plugins)
- [Themes](#themes)
- [Selecting A Theme](#selecting-a-theme)
- [Shellsavers](#shellsavers)
- [FAQ](#faq)
- [Advanced Topics](#advanced-topics)
- [Advanced Installation](#advanced-installation)
@@ -241,6 +242,33 @@ If you only know which themes you don't like, you can add them similarly to an i
ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod)
```
### Shellsavers
Give your terminal a little downtime with `omz shellsaver`—our playful name for
terminal screensavers. The aquarium is the default; choose another scene to change the mood:
```zsh
omz shellsaver # A quiet aquarium full of sea shells
omz shellsaver logo # The updater's rainbow logo, bouncing around
omz shellsaver hermit # A slightly lost hermit crab
omz shellsaver party # A rainbow stage and a dancing crowd
```
Press any key or Ctrl-C to return to your shell. Screensavers run only when invoked
and restore the terminal when they exit. No plugin or configuration change is needed.
Use `omz help` to discover the command, and Tab to complete scene names and options.
```zsh
omz shellsaver aquarium --seconds 30 # Stop automatically after 30 seconds
omz shellsaver logo --mono # Use the terminal's foreground color
omz shellsaver --list # List scenes (aquarium is the default)
omz shellsaver --help # Show all scenes and options
```
Requires Zsh 5.8 or newer, `stty`, and an xterm-compatible terminal with alternate-screen
support. No additional animation package is required. `NO_COLOR` is respected.
A window of at least 49 columns by 18 rows is recommended.
### FAQ
If you have some more questions or issues, you might find a solution in our
@@ -524,6 +552,20 @@ omz update
Magic! 🎉
## Diagnostics
If something looks off (glitched characters, completions misbehaving), run:
```sh
omz diagnose
```
It runs a few quick checks and tells you what to fix — for example, it will warn you when
your locale is not UTF-8, which is a common cause of duplicated characters at the prompt
(see the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#i-see-duplicate-typed-characters-after-i-complete-a-command)).
For a full report suitable for attaching to a bug report, use `omz_diagnostic_dump`.
## Uninstalling Oh My Zsh
Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy breakup.
+64 -10
View File
@@ -24,16 +24,30 @@ function _omz {
local -a cmds subcmds
cmds=(
'changelog:Print the changelog'
'diagnose:Run configuration diagnostics'
'help:Usage information'
'plugin:Manage plugins'
'pr:Manage Oh My Zsh Pull Requests'
'reload:Reload the current zsh session'
'shellsaver:Launch a whimsical terminal screensaver'
'shop:Open the Oh My Zsh shop'
'theme:Manage themes'
'update:Update Oh My Zsh'
'version:Show the version'
)
if [[ "$words[2]" == (screensaver|shellsaver) ]] && (( CURRENT > 2 )); then
_arguments \
'1:command:' \
'2::scene:(aquarium logo hermit party)' \
'--list[List available scenes]' \
'--mono[Use the default foreground color]' \
'--seconds[Exit after a number of seconds]:seconds:' \
'--snapshot[Print a plain-text still]::frame:' \
'--help[Show Shellsaver help]'
return
fi
if (( CURRENT == 2 )); then
_describe 'command' cmds
elif (( CURRENT == 3 )); then
@@ -163,17 +177,42 @@ function _omz::log {
## User-facing commands
function _omz::diagnose {
# Check the runtime locale: non-UTF-8 charsets are known to cause glitches
# such as duplicated characters at the prompt after completions.
# https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#i-see-duplicate-typed-characters-after-i-complete-a-command
#
# `lib/functions.zsh` loads the zsh/langinfo module at startup, so the
# CODESET parameter is already available without any subprocess; only fall
# back to `locale charmap` when that module is unavailable (zsh built without it).
local codeset="${langinfo[CODESET]:-}"
if [[ -z "$codeset" ]] && (( $+commands[locale] )); then
codeset="$(locale charmap 2>/dev/null)"
fi
if [[ "${codeset:l}" = (utf-8|utf8) ]]; then
_omz::log info "locale charmap is UTF-8"
else
_omz::log warn "your locale is not UTF-8 (charmap: ${codeset:-unknown})"
_omz::log info "non-UTF-8 locales may cause glitches in completions and international characters"
_omz::log info "consider setting a UTF-8 locale, e.g.: export LANG=C.UTF-8"
return 1
fi
}
function _omz::help {
cat >&2 <<EOF
Usage: omz <command> [options]
Available commands:
diagnose Run configuration diagnostics
help Print this help message
changelog Print the changelog
plugin <command> Manage plugins
pr <command> Manage Oh My Zsh Pull Requests
reload Reload the current zsh session
shellsaver [scene] Launch a Shellsaver (aquarium by default)
shop Open the Oh My Zsh shop
theme <command> Manage themes
update Update Oh My Zsh
@@ -182,6 +221,15 @@ Available commands:
EOF
}
function _omz::shellsaver {
command zsh -f "$ZSH/tools/shellsaver.zsh" "$@"
}
# Hidden alias; only shellsaver is advertised in help and command completion.
function _omz::screensaver {
_omz::shellsaver "$@"
}
function _omz::changelog {
local version=${1:-HEAD} format=${3:-"--text"}
@@ -247,17 +295,23 @@ function _omz::plugin::disable {
fi
# Remove plugins substitution awk script
# A match consumes the whitespace around the plugin, so adjacent plugins
# can't match in the same pass: repeat until the line stops changing.
local awk_subst_plugins="\
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
do {
prev = \$0
gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after
gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL
gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after
gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL
} while (\$0 != prev)
"
# Disable plugins awk script
@@ -344,8 +398,8 @@ function _omz::plugin::enable {
# Enable plugins awk script
local awk_script="
# if plugins=() is in oneline form, substitute ) with new plugins and go to the next line
/^[ \t]*plugins=\([^#]+\).*\$/ {
# if plugins=() is in oneline form (empty or not), substitute ) with new plugins and go to the next line
/^[ \t]*plugins=\([^#]*\).*\$/ {
sub(/\)/, \" $add_plugins&\")
print \$0
next
+31 -1
View File
@@ -16,6 +16,10 @@
# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
# - win32yank (Windows)
# - tmux (if $TMUX is set)
# - OSC 52 (when no clipboard tool is available, e.g. over SSH or in a container)
#
# Set ZSH_CLIPBOARD_OSC52 to "always" to copy through OSC 52 even if a
# clipboard tool is available, or to "never" to disable the fallback.
#
# Defines two functions, clipcopy and clippaste, based on the detected platform.
##
@@ -48,6 +52,22 @@
# # Paste to a file
# clippaste > file.txt
#
function _has_osc52_clipboard() {
[[ -n "${TTY:-}" ]] && [[ -w "${TTY}" ]] && (( ${+commands[base64]} ))
}
function _clipcopy_osc52() {
emulate -L zsh
local content
content=$(cat "${1:-/dev/stdin}" | base64 | tr -d '\n') || return 1
print -rn -- $'\e]52;c;'"${content}"$'\e\\' > /dev/tty
}
function _clippaste_osc52() {
print 'clippaste: OSC 52 is write-only and no other clipboard tool was found' >&2
return 1
}
function detect-clipboard() {
emulate -L zsh
@@ -59,7 +79,10 @@ function detect-clipboard() {
function clippaste() { cat /dev/clipboard; }
elif (( $+commands[clip.exe] )) && (( $+commands[powershell.exe] )); then
function clipcopy() { cat "${1:-/dev/stdin}" | clip.exe; }
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
function clippaste() {
setopt localoptions pipefail
powershell.exe -noprofile -command Get-Clipboard | tr -d '\r'
}
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; }
function clippaste() { wl-paste --no-newline; }
@@ -84,6 +107,9 @@ function detect-clipboard() {
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
function clipcopy() { tmux load-buffer -w "${1:--}"; }
function clippaste() { tmux save-buffer -; }
elif [[ "${ZSH_CLIPBOARD_OSC52:-}" != never ]] && _has_osc52_clipboard; then
function clipcopy() { _clipcopy_osc52 "$@"; }
function clippaste() { _clippaste_osc52; }
else
function _retry_clipboard_detection_or_fail() {
local clipcmd="${1}"; shift
@@ -98,6 +124,10 @@ function detect-clipboard() {
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
return 1
fi
if [[ "${ZSH_CLIPBOARD_OSC52:-}" == always ]] && _has_osc52_clipboard; then
function clipcopy() { _clipcopy_osc52 "$@"; }
fi
}
function clipcopy clippaste {
-17
View File
@@ -110,23 +110,6 @@ bindkey -M emacs '^[[1;5D' backward-word
bindkey -M viins '^[[1;5D' backward-word
bindkey -M vicmd '^[[1;5D' backward-word
# [Keypad] - application mode (enabled above) makes the keypad send escape
# sequences instead of characters, so map them back to the plain keys
() {
local seq key
local -A keypad=(
'^[Op' '0' '^[Oq' '1' '^[Or' '2' '^[Os' '3' '^[Ot' '4'
'^[Ou' '5' '^[Ov' '6' '^[Ow' '7' '^[Ox' '8' '^[Oy' '9'
'^[On' '.' '^[Ol' ',' '^[Ok' '+' '^[Om' '-' '^[Oj' '*'
'^[Oo' '/' '^[OX' '=' '^[OM' '^M'
)
for seq key in "${(@kv)keypad}"; do
bindkey -M emacs -s "$seq" "$key"
bindkey -M viins -s "$seq" "$key"
bindkey -M vicmd -s "$seq" "$key"
done
}
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
bindkey -s '\el' '^q ls\n' # [Esc-l] - run command: ls
+11
View File
@@ -2,6 +2,8 @@
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
autoload -Uz is-at-least
typeset -AHg FX FG BG
FX=(
@@ -18,7 +20,16 @@ FX=(
() {
setopt localoptions noksharrays
local -a codes fg bg
local code
codes=({000..255})
# ${a:^b} array zipping needs zsh 5.0.6
if ! is-at-least 5.0.6; then
for code in $codes; do
FG[$code]="%{"$'\e'"[38;5;${code}m%}"
BG[$code]="%{"$'\e'"[48;5;${code}m%}"
done
return
fi
fg=( "%{"$'\e'"[38;5;"${^codes}"m%}" )
bg=( "%{"$'\e'"[48;5;"${^codes}"m%}" )
FG=( ${codes:^fg} )
+7 -5
View File
@@ -5,7 +5,6 @@
# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
# Fully supports screen, iterm, and probably most modern xterm and rxvt
# (In screen, only short_tab_title is used)
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
function title {
setopt localoptions nopromptsubst
@@ -17,7 +16,7 @@ function title {
: ${2=$1}
case "$TERM" in
cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty*|st*|foot*|contour*|wezterm*)
cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty*|st*|foot*|contour*|wezterm*|nsterm*)
print -Pn "\e]2;${2:q}\a" # set window name
print -Pn "\e]1;${1:q}\a" # set tab name
;;
@@ -26,10 +25,12 @@ function title {
print -Pn "\ek${1:q}\e\\" # set screen hardstatus/tmux window name if `allow-rename` is on
;;
*)
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
case "$TERM_PROGRAM" in
"iTerm.app"|"Apple_Terminal")
print -Pn "\e]2;${2:q}\a" # set window name
print -Pn "\e]1;${1:q}\a" # set tab name
else
;;
*)
# Try to use terminfo to set the title if the feature is available
if (( ${+terminfo[fsl]} && ${+terminfo[tsl]} )); then
# Emit the capabilities with echoti so terminfo does its own parameter
@@ -39,7 +40,8 @@ function title {
print -Pn "$1"
echoti fsl
fi
fi
;;
esac
;;
esac
}
+43 -8
View File
@@ -7,16 +7,20 @@ run_awk() {
(( ! DEBUG )) || set -xv
local awk_subst_plugins="\
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
do {
prev = \$0
gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after
gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL
gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after
gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL
} while (\$0 != prev)
"
# Disable plugins awk script
local awk_script="
@@ -167,3 +171,34 @@ z)" \
"plugins=(
git
)"
run_awk_and_test \
"it should delete two adjacent plugins among others in oneline format" \
"docker kubectl" \
"plugins=(git docker kubectl npm)" \
"plugins=(git npm)"
run_awk_and_test \
"it should delete three adjacent plugins among others in oneline format" \
"docker kubectl aws" \
"plugins=(git docker kubectl aws npm)" \
"plugins=(git npm)"
run_awk_and_test \
"it should delete every plugin of a long oneline list" \
"git docker kubectl aws npm z" \
"plugins=(git docker kubectl aws npm z)" \
"plugins=()"
run_awk_and_test \
"it should delete adjacent plugins sharing a line in multiline format" \
"docker kubectl aws" \
"plugins=(
git
docker kubectl aws
npm
)" \
"plugins=(
git
npm
)"
+2
View File
@@ -58,6 +58,8 @@ Running the shortest `gs` shell alias that it found:
![image](https://github.com/ohmyzsh/ohmyzsh/assets/19378/39642750-fb10-4f1a-b7f9-f36789eeb01b)
It also looks through aliases you type, suggesting only ones that cover more of the command. With the kubectl plugin, `k get pods` suggests `kgp`, while `kgp` on its own suggests nothing.
### Options
+22 -7
View File
@@ -1,5 +1,5 @@
alias-finder() {
local cmd=" " exact="" longer="" cheaper="" wordEnd="'?$" finder="" filter=""
local c="" cmd=" " exact="" longer="" cheaper="" wordEnd="'?$" finder="" filter="" cmdLen=""
# build command and options
for c in "$@"; do
@@ -19,11 +19,15 @@ alias-finder() {
zstyle -t ':omz:plugins:alias-finder' cheaper && cheaper=true
# format cmd for grep
## - replace newlines with spaces
## - replace newlines and multiple spaces with one space
## - trim both ends
## - replace multiple spaces with one space
## - add escaping character to special characters
cmd=$(echo -n "$cmd" | tr '\n' ' ' | xargs | tr -s '[:space:]' | sed 's/[].\|$(){}?+*^[]/\\&/g')
setopt localoptions extendedglob
cmd=${cmd//[[:space:]]##/ }
cmd=${cmd# }
cmd=${cmd% }
local esc_pattern='(#m)[][.\\|$(){}?+*^]' MATCH MBEGIN MEND
cmd=${cmd//${~esc_pattern}/\\$MATCH}
if [[ $longer == true ]]; then
wordEnd="" # remove wordEnd to find longer aliases
@@ -35,7 +39,7 @@ alias-finder() {
# make filter to find only shorter results than current cmd
if [[ $cheaper == true ]]; then
cmdLen=$(echo -n "$cmd" | wc -c)
cmdLen=${#cmd}
if [[ $cmdLen -le 1 ]]; then
return
fi
@@ -61,9 +65,20 @@ alias-finder() {
preexec_alias-finder() {
# TODO: Remove backward compatibility (other than zstyle form)
zstyle -t ':omz:plugins:alias-finder' autoload && alias-finder $1 || if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
alias-finder $1
zstyle -t ':omz:plugins:alias-finder' autoload || [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]] || return
# $3 has aliases expanded, so `k get pods` can suggest `kgp`
local -a words=(${(z)1}) found=(${(f)"$(alias-finder $3)"}) keep
local used=${aliases[$words[1]]} line
# If an alias was typed, only suggest aliases that cover more of the command
if [[ -n "$used" ]]; then
for line in $found; do
(( ${#${(Q)line#*=}} > ${#used} )) && keep+=("$line")
done
found=($keep)
fi
(( $#found )) && print -rl -- $found
}
autoload -U add-zsh-hook
+2 -1
View File
@@ -35,7 +35,8 @@ plugins=(... aws)
* `aws_change_access_key`: changes the AWS access key of a profile.
* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`).
* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`) and
`$AWS_SHARED_CREDENTIALS_FILE` (default: `~/.aws/credentials`).
Used to provide completion for the `asp` function.
* `aws_regions`: lists the available regions.
+43 -5
View File
@@ -42,7 +42,7 @@ function asp() {
export AWS_PROFILE=$1
export AWS_EB_PROFILE=$1
export AWS_PROFILE_REGION=$(aws configure get region)
export AWS_PROFILE_REGION=$(_aws_profile_region "$1")
_aws_update_state
@@ -239,9 +239,47 @@ function aws_regions() {
}
function aws_profiles() {
aws --no-cli-pager configure list-profiles 2> /dev/null && return
[[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
command grep -Eo '^[[:space:]]*\[[[:space:]]*(profile[[:space:]]+)?[^][:space:]]+[[:space:]]*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | command sed -E 's/^[[:space:]]*\[[[:space:]]*(profile[[:space:]]+)?([^][:space:]]+)[[:space:]]*\]$/\2/'
emulate -L zsh
local config="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
local creds="${AWS_SHARED_CREDENTIALS_FILE:-$HOME/.aws/credentials}"
# Read the files directly; the AWS CLI is slow to start
if [[ ! -r "$config" && ! -r "$creds" ]]; then
aws --no-cli-pager configure list-profiles 2> /dev/null
return
fi
local line words
# Only read the section headers, so the credentials never enter the shell
for line in "${(@f)$(command grep -h '^[[:space:]]*\[' -- "$config" "$creds" 2> /dev/null)}"; do
line=${line#*\[} # drop up to the first [
line=${line%\]*} # drop from the last ] (comments, CR)
words=(${=line})
if (( $#words == 1 )); then
print -r -- $words[1] # [default], or [foo] in the credentials file
elif (( $#words == 2 )) && [[ $words[1] == profile ]]; then
print -r -- $words[2]
fi
done | command sort -u
}
# Read a profile's region from the config file, falling back to the AWS CLI
function _aws_profile_region() {
emulate -L zsh
local config="${AWS_CONFIG_FILE:-$HOME/.aws/config}" line words in_profile
if [[ -r "$config" ]]; then
# Only read headers and region lines, so any credentials never enter the shell
for line in "${(@f)$(command grep -e '\[' -e region -- "$config" 2> /dev/null)}"; do
line=${line%$'\r'}
words=(${=line//[\[\]=]/ }) # "[profile foo]" -> (profile foo), "region = x" -> (region x)
if [[ ${${=line}[1]} == \[* ]]; then # header, possibly indented
in_profile=
[[ "$words" == "profile $1" || ( $1 == default && "$words" == default ) ]] && in_profile=1
elif [[ -n $in_profile && $words[1] == region ]]; then
print -r -- $words[2]
return
fi
done
fi
aws configure get region
}
function _aws_regions() {
@@ -285,7 +323,7 @@ if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
export AWS_PROFILE="$AWS_DEFAULT_PROFILE"
export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE"
test -z "${aws_state[2]}" && AWS_REGION=$(aws configure get region)
test -z "${aws_state[2]}" && AWS_REGION=$(_aws_profile_region "$AWS_PROFILE")
export AWS_REGION=${AWS_REGION:-$aws_state[2]}
export AWS_DEFAULT_REGION="$AWS_REGION"
+16
View File
@@ -0,0 +1,16 @@
# Bitwarden plugin
This plugin adds Zsh completions for whichever Bitwarden CLIs are installed:
- [Bitwarden CLI (`bw`)](https://bitwarden.com/help/cli/)
- [Bitwarden Secrets Manager CLI (`bws`)](https://bitwarden.com/help/secrets-manager-cli/)
To enable it, add `bitwarden` to the plugins array in your `.zshrc`:
```zsh
plugins=(... bitwarden)
```
Each installed CLI generates and refreshes its own completion cache in the
background when the plugin loads. The cache files are
`$ZSH_CACHE_DIR/completions/_bw` and `$ZSH_CACHE_DIR/completions/_bws`.
+45
View File
@@ -0,0 +1,45 @@
# Autocompletion for the Bitwarden CLI (bw) and Secrets Manager CLI (bws).
() {
local cli completion cache_file
local -a generator_args
for cli in bw bws; do
completion="_$cli"
cache_file="$ZSH_CACHE_DIR/completions/$completion"
if (( ! $+commands[$cli] )); then
# compinit can register a cached completion after the CLI is removed.
if [[ -f "$cache_file" && ${_comps[$cli]-} == "$completion" ]]; then
unset "_comps[$cli]"
fi
continue
fi
case "$cli" in
bw)
generator_args=(completion --shell zsh)
# bw emits function definitions. Use ksh-style autoload to run _bw
# on the first Tab press as well as loading its helper functions.
autoload -Uk "$completion"
;;
bws)
generator_args=(completions zsh)
autoload -Uz "$completion"
;;
esac
# Register the completion if compinit hasn't picked it up yet.
if [[ -z ${_comps[$cli]-} ]]; then
_comps[$cli]=$completion
fi
() {
zmodload -F zsh/files b:zf_mv || return
local temp_file
temp_file=$(mktemp "${cache_file:h}/.$completion.XXXXXXXX") || return
if command "$cli" "$@" >| "$temp_file" && [[ -s "$temp_file" ]] &&
zf_mv -f -- "$temp_file" "$cache_file"; then
return
fi
rm -f -- "$temp_file"
} "${generator_args[@]}" &|
done
}
+1 -1
View File
@@ -59,7 +59,7 @@ ensures the `bdr` alias runs without warnings.
| `bsra` | `bsr --all` | Run all stopped services. |
| `bu` | `brew update` | Update brew and all installed formulae. |
| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
| `bubu` | `bubo && bup` | Do the last two operations above. |
| `bubu` | `bu && bup` | Update Homebrew data, then upgrade outdated, unpinned brews. |
| `bugbc` | `brew upgrade --greedy && brew cleanup` | Upgrade outdated formulae and casks (greedy), then run cleanup. |
| `bup` | `brew upgrade` | Upgrade outdated, unpinned brews. |
| `buz` | `brew uninstall --zap` | Remove all files associated with a cask. |
+1 -1
View File
@@ -75,7 +75,7 @@ alias bsr='brew services run'
alias bsra='bsr --all'
alias bu='brew update'
alias bubo='brew update && brew outdated'
alias bubu='bubo && bup'
alias bubu='bu && bup'
alias bubug='bubo && bugbc'
alias bugbc='brew upgrade --greedy && brew cleanup'
alias bup='brew upgrade'
+25 -15
View File
@@ -1,6 +1,6 @@
# Bridgetown plugin
This plugin adds some aliases and autocompletion for common [Bridgetown](https://bridgetownrb.com/) commands.
This plugin adds aliases for common [Bridgetown](https://www.bridgetownrb.com/) commands.
To use it, add `bridgetown` to the plugins array in your zshrc file:
@@ -10,17 +10,27 @@ plugins=(... bridgetown)
## Aliases
| Alias | Command |
|-------|----------------------------|
| br | `bridgetown` |
| bra | `bin/bridgetown apply` |
| brb | `bin/bridgetown build` |
| brc | `bin/bridgetown console` |
| brclean | `bin/bridgetown clean` |
| brd | `bin/bridgetown deploy` |
| brdoc | `bin/bridgetown doctor` |
| brh | `bin/bridgetown help` |
| brn | `bridgetown new` |
| brp | `bridgetown plugins` |
| brpl | `bridgetown plugins list` |
| brs | `bin/bridgetown start` |
Most aliases use the project's `bin/bridgetown` executable so the command runs with the Bridgetown version
locked in its `Gemfile`. The `br` and `brn` aliases use the globally installed executable and can be run
outside a Bridgetown project.
| Alias | Command | Description |
| --------- | ---------------------------- | ---------------------------------------- |
| `br` | `bridgetown` | Run the globally installed CLI |
| `bra` | `bin/bridgetown apply` | Apply an automation |
| `brb` | `bin/bridgetown build` | Build the site |
| `brc` | `bin/bridgetown console` | Open the Bridgetown console |
| `brclean` | `bin/bridgetown clean` | Remove generated files and caches |
| `brco` | `bin/bridgetown configure` | Apply a bundled configuration |
| `brd` | `bin/bridgetown deploy` | Run the project's deployment task |
| `brdev` | `bin/bridgetown dev` | Start the development server |
| `bre` | `bin/bridgetown esbuild` | Manage the esbuild configuration |
| `brh` | `bin/bridgetown help` | Show command help |
| `brn` | `bridgetown new` | Create a new Bridgetown site |
| `brp` | `bin/bridgetown plugins` | Access plugin commands |
| `brpl` | `bin/bridgetown plugins list` | List installed plugins |
| `brs` | `bin/bridgetown start` | Start the development server |
| `brt` | `bin/bridgetown test` | Run the project's test build task |
`deploy` and `test` are standard tasks from the `Rakefile` generated for a new Bridgetown site. If the project
customizes or removes those tasks, the corresponding aliases follow that project behavior.
+6 -3
View File
@@ -3,10 +3,13 @@ alias bra='bin/bridgetown apply'
alias brb='bin/bridgetown build'
alias brc='bin/bridgetown console'
alias brclean='bin/bridgetown clean'
alias brco='bin/bridgetown configure'
alias brd='bin/bridgetown deploy'
alias brdoc='bin/bridgetown doctor'
alias brdev='bin/bridgetown dev'
alias bre='bin/bridgetown esbuild'
alias brh='bin/bridgetown help'
alias brn='bridgetown new'
alias brp='bridgetown plugins'
alias brpl='bridgetown plugins list'
alias brp='bin/bridgetown plugins'
alias brpl='bin/bridgetown plugins list'
alias brs='bin/bridgetown start'
alias brt='bin/bridgetown test'
+1
View File
@@ -90,6 +90,7 @@ colorize_less() {
# (e.g. when not scrolled to the bottom) while already the next file will be displayed.
local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
ZSH_COLORIZE_CHROMA_FORMATTER=$ZSH_COLORIZE_CHROMA_FORMATTER \
colorize_cat %s 2> /dev/null'"
# LESSCLOSE will be set to prevent any errors by executing a user script
+11 -3
View File
@@ -1,6 +1,6 @@
# conda plugin
The conda plugin provides [aliases](#aliases) for `conda`, usually installed via [anaconda](https://www.anaconda.com/) or [miniconda](https://docs.conda.io/en/latest/miniconda.html).
The conda plugin provides [aliases](#aliases) and [completion](#completion) for `conda`, usually installed via [anaconda](https://www.anaconda.com/) or [miniconda](https://docs.conda.io/en/latest/miniconda.html).
To use it, add `conda` to the plugins array in your zshrc file:
@@ -28,10 +28,18 @@ plugins=(... conda)
| `cnle` | `conda list --export` | Export the list of installed packages in the current environment |
| `cnles` | `conda list --explicit > spec-file.txt` | Export the list of installed packages in the current environment to a spec file |
| `cnr` | `conda remove` | Remove given package |
| `cnrn` | `conda remove -y -all -n` | Remove all packages in the specified environment |
| `cnrp` | `conda remove -y -all -p` | Remove all packages in the specified prefix |
| `cnrn` | `conda remove -y --all -n` | Remove all packages in the specified environment |
| `cnrp` | `conda remove -y --all -p` | Remove all packages in the specified prefix |
| `cnry` | `conda remove -y` | Remove given package without confirmation |
| `cnsr` | `conda search` | Search conda repositories for package |
| `cnu` | `conda update` | Update conda package manager |
| `cnua` | `conda update --all` | Update all installed packages |
| `cnuc` | `conda update conda` | Update conda package manager |
## Completion
Tab completion is available for the following commands, using the environment list conda keeps in
`~/.conda/environments.txt`:
- `cna`: completes environment names for `conda activate`
- `cnrn`: completes environment names for `conda remove -y --all -n`
+21 -2
View File
@@ -1,4 +1,7 @@
alias cna='conda activate'
unalias cna cnrn 2>/dev/null
cna() { conda activate "$@"; }
cnrn() { conda remove -y --all -n "$@"; }
alias cnab='conda activate base'
alias cncf='conda env create -f'
alias cncn='conda create -y -n'
@@ -14,10 +17,26 @@ alias cnl='conda list'
alias cnle='conda list --export'
alias cnles='conda list --explicit > spec-file.txt'
alias cnr='conda remove'
alias cnrn='conda remove -y --all -n'
alias cnrp='conda remove -y --all -p'
alias cnry='conda remove -y'
alias cnsr='conda search'
alias cnu='conda update'
alias cnua='conda update --all'
alias cnuc='conda update conda'
_omz_conda_envs() {
emulate -L zsh -o extended_glob
local envs_file="$HOME/.conda/environments.txt"
[[ -r "$envs_file" ]] || return 1
# Each line is an env prefix; named envs live under <dir>/envs/<name>.
# The root prefix (base) and envs created with -p have no name and are skipped.
local -aU envs
envs=(${(f)"$(<$envs_file)"})
envs=(${${(M)envs:#*/envs/[^/]##}:t})
(( ${#envs} )) && compadd -Q -a envs
}
if (( $+functions[compdef] )); then
compdef _omz_conda_envs cna cnrn
fi
+1 -1
View File
@@ -14,6 +14,6 @@ function copyfile {
return 1
fi
clipcopy $1
clipcopy $1 || return 1
echo ${(%):-"%B$1%b copied to clipboard."}
}
+74
View File
@@ -0,0 +1,74 @@
#!/usr/bin/env zsh
emulate -LR zsh
source "${1:-${0:A:h:h}/copyfile.plugin.zsh}"
test_dir=$(mktemp -d) || exit 1
trap 'command rm -rf -- "$test_dir"' EXIT
typeset -i clipboard_status=0 failures=0 tests=0
typeset output expected_output
clipcopy() {
print -r -- "$#" "$1" >| "$test_dir/call"
if (( clipboard_status )); then
print -u2 -r -- "clipboard backend failed"
return $clipboard_status
fi
command cat -- "$1" >| "$test_dir/clipboard"
}
check_copyfile() {
local description="$1" expected_status="$2" expected_stdout="$3" expected_stderr="$4"
shift 4
output=$(copyfile "$@" 2> "$test_dir/stderr")
local actual_status=$?
(( tests++ ))
if [[ $actual_status == $expected_status && $output == "$expected_stdout" && $(<"$test_dir/stderr") == "$expected_stderr" ]]; then
print -r -- "PASS: $description"
else
print -u2 -r -- "FAIL: $description"
print -u2 -r -- " status: $actual_status (expected $expected_status)"
print -u2 -r -- " stdout: ${(qqq)output} (expected ${(qqq)expected_stdout})"
print -u2 -r -- " stderr: $(<"$test_dir/stderr") (expected $expected_stderr)"
(( failures++ ))
fi
}
for filename in plain.txt 'file with spaces.txt' 'unicode-ą.txt' empty.txt; do
if [[ $filename == empty.txt ]]; then
: >| "$test_dir/$filename"
else
print -r -- "contents of $filename" >| "$test_dir/$filename"
fi
expected_output=${(%):-"%B$test_dir/$filename%b copied to clipboard."}
clipboard_status=0
check_copyfile "successful copy of $filename" 0 "$expected_output" '' "$test_dir/$filename"
if [[ $(<"$test_dir/call") != "1 $test_dir/$filename" ]] || ! command cmp -s -- "$test_dir/$filename" "$test_dir/clipboard"; then
print -u2 -r -- "FAIL: clipboard received a different argument or contents for $filename"
(( failures++ ))
fi
for clipboard_status in 1 42 127; do
check_copyfile "clipboard exit $clipboard_status for $filename" 1 '' 'clipboard backend failed' "$test_dir/$filename"
done
done
command rm -f -- "$test_dir/call"
check_copyfile 'missing argument' 1 'Usage: copyfile <file>' ''
check_copyfile 'empty argument' 1 'Usage: copyfile <file>' '' ''
check_copyfile 'nonexistent file' 1 "Error: '$test_dir/missing.txt' is not a valid file." '' "$test_dir/missing.txt"
check_copyfile 'directory argument' 1 "Error: '$test_dir' is not a valid file." '' "$test_dir"
if [[ -e "$test_dir/call" ]]; then
print -u2 -r -- 'FAIL: invalid input invoked the clipboard backend'
(( failures++ ))
fi
print -r -- "$tests tests, $failures failures"
(( failures == 0 ))
+1 -1
View File
@@ -52,7 +52,7 @@ function push_future() {
if [[ $#dirhistory_future -ge $DIRHISTORY_SIZE ]]; then
shift dirhistory_future
fi
if [[ $#dirhistory_future -eq 0 || $dirhistory_futuret[$#dirhistory_future] != "$1" ]]; then
if [[ $#dirhistory_future -eq 0 || $dirhistory_future[$#dirhistory_future] != "$1" ]]; then
dirhistory_future+=($1)
fi
}
+29 -25
View File
@@ -13,28 +13,32 @@ plugins=(... docker-compose)
## Aliases
| Alias | Command | Description |
|-----------|----------------------------------|----------------------------------------------------------------------------------|
| dco | `docker-compose` | Docker-compose main command |
| dcb | `docker-compose build` | Build containers |
| dcc | `docker-compose config` | Parse, resolve and render compose file in canonical format |
| dce | `docker-compose exec` | Execute command inside a container |
| dcps | `docker-compose ps` | List containers |
| dcrestart | `docker-compose restart` | Restart container |
| dcrm | `docker-compose rm` | Remove container |
| dcr | `docker-compose run` | Run a command in container |
| dcstop | `docker-compose stop` | Stop a container |
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
| dcdn | `docker-compose down` | Stop and remove containers |
| dcl | `docker-compose logs` | Show logs of container |
| dclf | `docker-compose logs -f` | Show logs and follow output |
| dclF | `docker-compose logs -f --tail0` | Just follow recent logs |
| dcpull | `docker-compose pull` | Pull image of a service |
| dcstart | `docker-compose start` | Start a container |
| dck | `docker-compose kill` | Kills containers |
| dcv | `docker-compose version` | Show version information |
| dcsts | `docker-compose stats` | Show stats of containers |
| dci | `docker-compose images` | List images |
| Alias | Command | Description |
|-----------|-------------------------------------|----------------------------------------------------------------------------------------------|
| dco | `docker-compose` | Docker-compose main command |
| dcb | `docker-compose build` | Build containers |
| dcc | `docker-compose config` | Parse, resolve and render compose file in canonical format |
| dce | `docker-compose exec` | Execute command inside a container |
| dcps | `docker-compose ps` | List containers |
| dcrestart | `docker-compose restart` | Restart container |
| dcrm | `docker-compose rm` | Remove container |
| dcr | `docker-compose run` | Run a command in container |
| dcstop | `docker-compose stop` | Stop a container |
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
| dcupw | `docker-compose up --watch` | Watch changes in service and rebuild/restart accordingly (see [Use Compose Watch] for usage) |
| dcupwb | `docker-compose up --watch --build` | Same as `dcupw`, but build images before starting containers |
| dcdn | `docker-compose down` | Stop and remove containers |
| dcl | `docker-compose logs` | Show logs of container |
| dclf | `docker-compose logs -f` | Show logs and follow output |
| dclF | `docker-compose logs -f --tail0` | Just follow recent logs |
| dcpull | `docker-compose pull` | Pull image of a service |
| dcstart | `docker-compose start` | Start a container |
| dck | `docker-compose kill` | Kills containers |
| dcv | `docker-compose version` | Show version information |
| dcsts | `docker-compose stats` | Show stats of containers |
| dci | `docker-compose images` | List images |
[Use Compose Watch]: https://docs.docker.com/compose/how-tos/file-watch/
@@ -17,6 +17,8 @@ alias dcup="$dccmd up"
alias dcupb="$dccmd up --build"
alias dcupd="$dccmd up -d"
alias dcupdb="$dccmd up -d --build"
alias dcupw="$dccmd up --watch"
alias dcupwb="$dccmd up --watch --build"
alias dcdn="$dccmd down"
alias dcl="$dccmd logs"
alias dclf="$dccmd logs -f"
+1
View File
@@ -84,6 +84,7 @@ If you use Podman's Docker wrapper, you need to enable legacy completion. See ab
| dtop | `docker top` | Display the running processes of a container |
| dvi | `docker volume inspect` | Display detailed information about one or more volumes |
| dvls | `docker volume ls` | List all the volumes known to docker |
| dvrm | `docker volume rm` | Remove one or more volumes |
| dvprune | `docker volume prune` | Cleanup dangling volumes |
| dxc | `docker container exec` | Run a new command in a running container |
| dxcit | `docker container exec -it` | Run a new command in a running container in an interactive shell |
+6
View File
@@ -35,6 +35,7 @@ alias dsts='docker stats'
alias dtop='docker top'
alias dvi='docker volume inspect'
alias dvls='docker volume ls'
alias dvrm='docker volume rm'
alias dvprune='docker volume prune'
alias dxc='docker container exec'
alias dxcit='docker container exec -it'
@@ -48,6 +49,11 @@ fi
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
# Make sure the cache directory exists; when the plugin is loaded by a
# standalone plugin manager (e.g. antigen) the core is not sourced, so
# $ZSH_CACHE_DIR/completions may not have been created yet (#13679).
[[ -d "$ZSH_CACHE_DIR/completions" ]] || mkdir -p "$ZSH_CACHE_DIR/completions"
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `docker`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then
+1 -1
View File
@@ -100,7 +100,7 @@ takes preference, _i.e._ the .env file will never be sourced.
## Named Pipe (FIFO) Support
The plugin supports `.env` files provided as UNIX named pipes (FIFOs) in addition to regular files.
This is useful when secrets managers like [1Password Environments](https://developer.1password.com/docs/environment/)
This is useful when secrets managers like [1Password Environments](https://developer.1password.com/docs/environments/)
mount `.env` files as named pipes to inject secrets on-the-fly without writing them to disk.
No additional configuration is required — the plugin automatically detects and sources named pipes.
+2 -2
View File
@@ -263,9 +263,9 @@ _dotenv_check_syntax() {
local filename="$1"
if (( $# == 2 )); then
printf '%s' "$2" | zsh -fn /dev/stdin
printf '%s' "$2" | command zsh -fn /dev/stdin
else
zsh -fn -- "$filename"
command zsh -fn -- "$filename"
fi || {
echo "dotenv: error when sourcing '$filename' file" >&2
return 1
+1 -1
View File
@@ -25,7 +25,7 @@ plugins=(... drush)
| `drcr` | `drush core-cron` | Run all cron hooks in all active modules for specified site |
| `drct` | `drush cc theme-registry` | Clear theme-registry cache |
| `drcv` | `drush cc views` | Clear views cache _(make sure that the views module is enabled)_ |
| `drdmp` | `drush drush sql-dump --ordered-dump --result-file=dumpsql` | Backup database in a new dump.sql file |
| `drdmp` | `drush sql-dump --ordered-dump --result-file=dump.sql` | Backup database in a new dump.sql file |
| `drf` | `drush features` | Display features status |
| `drfr` | `drush features-revert -y` | Revert a feature module on your site |
| `drfra` | `drush features-revert-all` | Revert all enabled feature module on your site |
+1 -1
View File
@@ -40,7 +40,7 @@ case $state in
'new' \
'serve' \
'test' \
'vesion' && ret=0
'version' && ret=0
;;
addon)
_arguments \
+3 -3
View File
@@ -46,10 +46,10 @@ Encode a file's contents to base64 and save output to text file.
- From parameter
```console
$ encodefile64 ohmyzsh.icn
ohmyzsh.icn's content encoded in base64 and saved as ohmyzsh.icn.txt
$ encodefile64 oh-my-zsh
oh-my-zsh's content encoded in base64 and saved as oh-my-zsh.txt
$ ef64 "oh-my-zsh"
ohmyzsh.icn's content encoded in base64 and saved as ohmyzsh.icn.txt
oh-my-zsh's content encoded in base64 and saved as oh-my-zsh.txt
```
### Decoding
+21 -8
View File
@@ -2,24 +2,37 @@ encode64() {
if [[ $# -eq 0 ]]; then
cat | base64
else
printf '%s' $1 | base64
printf '%s' "$1" | base64
fi
}
encodefile64() {
if [[ $# -eq 0 ]]; then
echo "You must provide a filename"
else
base64 $1 > $1.txt
echo "${1}'s content encoded in base64 and saved as ${1}.txt"
if [[ $# -ne 1 || ! -f "$1" || ! -r "$1" ]]; then
print -u2 -- 'Usage: encodefile64 <file>'
return 1
fi
local file="$1" output="${1}.txt" tmp_file
[[ $output == /* ]] || output="./$output"
tmp_file=$(mktemp "${output}.XXXXXX") || return 1
if ! base64 < "$file" > "$tmp_file"; then
command rm -f "$tmp_file"
return 1
fi
if ! command mv "$tmp_file" "$output"; then
command rm -f "$tmp_file"
return 1
fi
print -- "$file's content encoded in base64 and saved as ${file}.txt"
}
decode64() {
if [[ $# -eq 0 ]]; then
cat | base64 --decode
cat | base64 -d
else
printf '%s' $1 | base64 --decode
printf '%s' "$1" | base64 -d
fi
}
alias e64=encode64
+77
View File
@@ -0,0 +1,77 @@
#!/usr/bin/env zsh
emulate -LR zsh
source "${1:-${0:A:h:h}/encode64.plugin.zsh}"
test_dir=$(mktemp -d) || exit 1
trap 'command rm -rf -- "$test_dir"' EXIT
cd "$test_dir" || exit 1
typeset -i failures=0 tests=0
typeset output expected_output
check_result() {
local description="$1" expected_status="$2" expected_stdout="$3" expected_stderr="$4"
shift 4
output=$("$@" 2> "$test_dir/stderr")
local actual_status=$?
(( tests++ ))
if [[ $actual_status == $expected_status && $output == "$expected_stdout" && $(<"$test_dir/stderr") == "$expected_stderr" ]]; then
print -r -- "PASS: $description"
else
print -u2 -r -- "FAIL: $description"
print -u2 -r -- " status: $actual_status (expected $expected_status)"
print -u2 -r -- " stdout: ${(qqq)output} (expected ${(qqq)expected_stdout})"
print -u2 -r -- " stderr: $(<"$test_dir/stderr") (expected $expected_stderr)"
(( failures++ ))
fi
}
check_encode_arg() { encode64 'oh-my-zsh'; }
check_encode_empty() { encode64 ''; }
check_decode_arg() { decode64 'b2gtbXktenNo'; }
expected_output=$(printf '%s' 'oh-my-zsh' | base64)
check_result 'encode argument' 0 "$expected_output" '' check_encode_arg
check_result 'encode empty argument' 0 '' '' check_encode_empty
check_result 'decode argument' 0 'oh-my-zsh' '' check_decode_arg
file="$test_dir/file with spaces.txt"
print -r -- 'file contents' >| "$file"
encodefile64 "$file" > "$test_dir/stdout" 2> "$test_dir/stderr"
file_status=$?
expected_output=$(base64 < "$file")
(( tests++ ))
if [[ $file_status == 0 && $(<"${file}.txt") == "$expected_output" && $(<"$test_dir/stdout") == "$file's content encoded in base64 and saved as ${file}.txt" && ! -s "$test_dir/stderr" ]]; then
print -r -- 'PASS: encode file with spaces'
else
print -u2 -r -- 'FAIL: encode file with spaces'
(( failures++ ))
fi
check_invalid_file() { encodefile64 ''; }
check_result 'empty filename' 1 '' 'Usage: encodefile64 <file>' check_invalid_file
if [[ -e .txt ]]; then
print -u2 -r -- 'FAIL: empty filename created .txt'
(( failures++ ))
command rm -f .txt
fi
print -r -- 'preserve existing output' >| "${file}.txt"
base64() { return 42; }
encodefile64 "$file" > "$test_dir/stdout" 2> "$test_dir/stderr"
file_status=$?
unset -f base64
(( tests++ ))
if [[ $file_status != 0 && $(<"${file}.txt") == 'preserve existing output' && ! -s "$test_dir/stdout" ]]; then
print -r -- 'PASS: failed encoding preserves existing output'
else
print -u2 -r -- 'FAIL: failed encoding preserves existing output'
(( failures++ ))
fi
print -r -- "$tests tests, $failures failures"
(( failures == 0 ))
+3
View File
@@ -45,9 +45,12 @@ plugins=(... extract)
| `tar.lrz` | Tarball with lrzip compression |
| `tar.lz` | Tarball with lzip compression |
| `tar.lz4` | Tarball with lz4 compression |
| `tar.lzma` | Tarball with lzma compression |
| `tar.xz` | Tarball with lzma2 compression |
| `tar.zma` | Tarball with lzma compression |
| `tar.zst` | Tarball with zstd compression |
| `tar.Z` | Tarball with compress (LZW) compression |
| `taz` | Tarball with compress (LZW) compression |
| `tbz` | Tarball with bzip compression |
| `tbz2` | Tarball with bzip2 compression |
| `tgz` | Tarball with gzip compression |
+1
View File
@@ -31,6 +31,7 @@ local -a exts=(
tar.lrz
tar.lz
tar.lz4
tar.lzma
tar.xz
tar.zma
tar.zst
+45 -7
View File
@@ -88,7 +88,7 @@ EOF
tar --xz --help &> /dev/null \
&& tar --xz -xvf "$full_path" \
|| xzcat "$full_path" | tar xvf - } ;;
(*.tar.zma|*.tlz)
(*.tar.lzma|*.tar.zma|*.tlz)
tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$full_path" \
|| lzcat "$full_path" | tar xvf - ;;
@@ -97,16 +97,23 @@ EOF
&& tar --zstd -xvf "$full_path" \
|| zstdcat "$full_path" | tar xvf - ;;
(*.tar) tar xvf "$full_path" ;;
# `tar cf - dir | compress > dir.tar.Z`: the plain `.Z` arm below only decompresses the
# stream back to `dir.tar`, so the combined form has to untar it in one step. `.taz` is the
# historic name for the same file, next to `.tgz`/`.tbz`/`.tlz`/`.txz`/`.tzst`. Matching is
# on the lowercased name, so `.tar.Z` lands here too.
(*.tar.z|*.taz) uncompress -c "$full_path" | tar xvf - ;;
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$full_path" ;;
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
(*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;;
(*.bz2) (( $+commands[pbzip2] )) && pbzip2 -d "$full_path" || bunzip2 "$full_path" ;;
(*.bz2)
(( $+commands[pbzip2] )) && pbzip2 -cd "$full_path" > "${file:t:r}" \
|| bunzip2 -c "$full_path" > "${file:t:r}" ;;
(*.xz) xzcat "$full_path" > "${file:t:r}" ;;
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
(*.lz4) lz4 -d "$full_path" ;;
(*.lzma) unlzma "$full_path" ;;
(*.z) uncompress "$full_path" ;;
(*.lzma) unlzma -c "$full_path" > "${file:t:r}" ;;
(*.z) uncompress -c "$full_path" > "${file:t:r}" ;;
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
(*.rar)
if (( $+commands[unrar] )); then
@@ -133,9 +140,40 @@ EOF
(*.deb)
command mkdir -p "control" "data"
ar vx "$full_path" > /dev/null
builtin cd -q control; extract ../control.tar.*
builtin cd -q ../data; extract ../data.tar.*
builtin cd -q ..; command rm *.tar.* debian-binary ;;
local member= dest= failed=0
for member in control.tar.* data.tar.*; do
dest="${member%%.*}"
case "${member:l}" in
(*.tar.gz)
(( $+commands[pigz] )) && { tar -I pigz -xvf "$member" -C "$dest" } \
|| tar zxvf "$member" -C "$dest" ;;
(*.tar.bz2)
(( $+commands[pbzip2] )) && { tar -I pbzip2 -xvf "$member" -C "$dest" } \
|| tar xvjf "$member" -C "$dest" ;;
(*.tar.xz)
# .deb members are small, so skip extract()'s pixz fast path and
# let tar use its built-in xz support (or a plain pipe).
tar --xz --help &> /dev/null \
&& tar --xz -xvf "$member" -C "$dest" \
|| xzcat "$member" | tar xvf - -C "$dest" ;;
(*.tar.zst)
tar --zstd --help &> /dev/null \
&& tar --zstd -xvf "$member" -C "$dest" \
|| zstdcat "$member" | tar xvf - -C "$dest" ;;
(*.tar)
tar xvf "$member" -C "$dest" ;;
(*)
echo "extract: cannot extract unexpected .deb member '$member'" >&2
failed=1
success=1 ;;
esac
done
if (( failed )); then
# Keep the archive members so the unexpected one can be inspected.
echo "extract: leaving .deb members in place" >&2
else
command rm *.tar.* debian-binary
fi ;;
(*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;;
(*.cab|*.exe) cabextract "$full_path" ;;
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
+188
View File
@@ -0,0 +1,188 @@
#!/usr/bin/env zsh
# Run with: zsh -df plugins/extract/tests/extract.test.zsh
emulate -L zsh
setopt err_return
for tool in ar lzma unlzma uncompress; do
(( $+commands[$tool] )) || {
print -u2 -r -- "These tests require $tool."
exit 1
}
done
source "${0:A:h:h}/extract.plugin.zsh"
local test_dir=$(mktemp -d) original_dir=$PWD
check_extract() {
local extension=$1 mode=$2
local case_dir="$test_dir/$extension-$mode"
mkdir -p "$case_dir/source files" "$case_dir/work/target dir"
local archive="$case_dir/source files/sample.txt.$extension"
cp "$test_dir/fixture.$extension" "$archive"
builtin cd "$case_dir/work"
local output="$PWD/sample.txt"
local -a args
case "$mode" in
target)
args=(-t 'target dir')
output="$PWD/target dir/sample.txt"
;;
remove) args=(-r) ;;
esac
# Run the plugin without the test's ERR_RETURN option.
() {
emulate -L zsh
extract "${args[@]}" "$archive"
} || return 1
cmp "$test_dir/plain" "$output"
if [[ $mode == remove ]]; then
[[ ! -e $archive ]]
else
[[ -f $archive ]]
fi
print -r -- "PASS: $extension ($mode)"
}
# Extracting a .deb must place the control members directly in <name>/control
# and the data members directly in <name>/data, whatever their member count.
check_deb_extract() {
local mode=$1
local case_dir="$test_dir/deb-$mode"
mkdir -p "$case_dir/source files" "$case_dir/work/target dir" \
"$case_dir/src/ctl" "$case_dir/src/data/usr/bin"
print -r -- "postinst script" > "$case_dir/src/ctl/postinst"
print -r -- "conf:1" > "$case_dir/src/ctl/conffiles"
print -r -- "app main" > "$case_dir/src/data/usr/bin/app"
tar czf "$case_dir/src/control.tar.gz" -C "$case_dir/src/ctl" conffiles postinst
tar czf "$case_dir/src/data.tar.gz" -C "$case_dir/src/data" usr
print -r -- "2.0" > "$case_dir/src/debian-binary"
(
builtin cd "$case_dir/src"
rm -f "$case_dir/source files/pkg.deb"
ar rS "$case_dir/source files/pkg.deb" debian-binary control.tar.gz data.tar.gz
)
local archive="$case_dir/source files/pkg.deb"
builtin cd "$case_dir/work"
local base="$PWD/pkg"
local -a args
case "$mode" in
target)
args=(-t 'target dir')
base="$PWD/target dir/pkg"
;;
remove) args=(-r) ;;
esac
() {
emulate -L zsh
extract "${args[@]}" "$archive"
} || return 1
[[ -f "$base/control/conffiles" && -f "$base/control/postinst" ]] ||
{ print -u2 -r -- "$mode: control members not extracted into $base/control"; return 1 }
[[ -f "$base/data/usr/bin/app" ]] ||
{ print -u2 -r -- "$mode: data members not extracted into $base/data"; return 1 }
[[ ! -d "$base/control/control" && ! -d "$base/data/data" ]] ||
{ print -u2 -r -- "$mode: deb extraction double-nested the member directories"; return 1 }
[[ ! -e "$base/control.tar.gz" && ! -e "$base/data.tar.gz" && ! -e "$base/debian-binary" ]] ||
{ print -u2 -r -- "$mode: deb member debris left behind"; return 1 }
if [[ $mode == remove ]]; then
[[ ! -e $archive ]]
else
[[ -f $archive ]]
fi
print -r -- "PASS: deb ($mode)"
}
# An unexpected member must be reported and left on disk for inspection, and
# the cleanup must not delete the other members around it either.
check_deb_unexpected_member() {
local case_dir="$test_dir/deb-unexpected"
mkdir -p "$case_dir/src/ctl" "$case_dir/src/data/usr/bin"
print -r -- "postinst script" > "$case_dir/src/ctl/postinst"
print -r -- "app main" > "$case_dir/src/data/usr/bin/app"
tar czf "$case_dir/src/control.tar.gz" -C "$case_dir/src/ctl" postinst
print -r -- "unknown compression" > "$case_dir/src/control.tar.weird"
tar czf "$case_dir/src/data.tar.gz" -C "$case_dir/src/data" usr
print -r -- "2.0" > "$case_dir/src/debian-binary"
(
builtin cd "$case_dir/src"
ar rS "$case_dir/pkg.deb" debian-binary control.tar.weird data.tar.gz
)
builtin cd "$case_dir"
() {
emulate -L zsh
extract "$case_dir/pkg.deb"
} || return 1
[[ -f "$case_dir/pkg/data/usr/bin/app" ]] ||
{ print -u2 -r -- "deb-unexpected: known members were not extracted"; return 1 }
[[ -f "$case_dir/pkg/control.tar.weird" && -f "$case_dir/pkg/data.tar.gz" &&
-f "$case_dir/pkg/debian-binary" ]] ||
{ print -u2 -r -- "deb-unexpected: archive members were deleted"; return 1 }
print -r -- "PASS: deb (unexpected member)"
}
# Passing more than one .deb in a single call must not leak the loop variables
# between archives; the stale `member`/`dest` locals used to be printed by the
# second archive.
check_deb_multiple() {
local case_dir="$test_dir/deb-multiple"
mkdir -p "$case_dir/src/ctl" "$case_dir/src/data/usr/bin"
print -r -- "postinst script" > "$case_dir/src/ctl/postinst"
print -r -- "app main" > "$case_dir/src/data/usr/bin/app"
tar czf "$case_dir/src/control.tar.gz" -C "$case_dir/src/ctl" postinst
tar czf "$case_dir/src/data.tar.gz" -C "$case_dir/src/data" usr
print -r -- "2.0" > "$case_dir/src/debian-binary"
(
builtin cd "$case_dir/src"
ar rS "$case_dir/one.deb" debian-binary control.tar.gz data.tar.gz
ar rS "$case_dir/two.deb" debian-binary control.tar.gz data.tar.gz
)
builtin cd "$case_dir"
local output
output=$( () {
emulate -L zsh
extract one.deb two.deb
} 2>&1 ) || return 1
[[ $output != *member=* && $output != *dest=* ]] ||
{ print -u2 -r -- "deb-multiple: stale loop variables were printed"; return 1 }
[[ -f one/control/postinst && -f one/data/usr/bin/app &&
-f two/control/postinst && -f two/data/usr/bin/app ]] ||
{ print -u2 -r -- "deb-multiple: both archives were not extracted"; return 1 }
print -r -- "PASS: deb (multiple archives)"
}
{
print -r -- hello > "$test_dir/plain"
lzma -c "$test_dir/plain" > "$test_dir/fixture.lzma"
# "hello\n" as a .Z stream, since many systems only ship uncompress.
printf '\037\235\220\150\312\260\141\363\106\001' \
> "$test_dir/fixture.Z"
cp "$test_dir/plain" "$test_dir/sample.txt"
tar -cf "$test_dir/fixture.tar" -C "$test_dir" sample.txt
lzma -c "$test_dir/fixture.tar" > "$test_dir/fixture.tar.lzma"
for extension in lzma Z tar.lzma; do
for mode in default target remove; do
check_extract "$extension" "$mode"
done
done
check_deb_extract default
check_deb_extract target
check_deb_extract remove
check_deb_unexpected_member
check_deb_multiple
print 'All extract compressed-file tests passed.'
} always {
builtin cd "$original_dir"
rm -rf -- "$test_dir"
}
+18
View File
@@ -0,0 +1,18 @@
# Fizzy CLI plugin
This plugin adds completion for the [Fizzy CLI (fizzy)](https://github.com/basecamp/fizzy-cli).
To use it, add `fizzy` to the plugins array in your zshrc file:
```zsh
plugins=(... fizzy)
```
This plugin does not add any aliases.
## Cache
This plugin caches the completion script and automatically updates it when the
plugin is loaded, which is usually when you start a new terminal emulator.
The cache is stored at `$ZSH_CACHE_DIR/completions/_fizzy`.
+24
View File
@@ -0,0 +1,24 @@
# Autocompletion for the Fizzy CLI (fizzy).
if (( ! $+commands[fizzy] )); then
return
fi
# If the completion isn't registered yet, autoload it and bind it to `fizzy`.
# Otherwise, compinit will have already done that from the cache.
if [[ -z ${_comps[fizzy]-} ]]; then
typeset -g -A _comps
autoload -Uz _fizzy
_comps[fizzy]=_fizzy
fi
zmodload -F zsh/files b:zf_mv || return
() {
local cache_file="$ZSH_CACHE_DIR/completions/_fizzy"
local temp_file
temp_file=$(mktemp "$ZSH_CACHE_DIR/completions/._fizzy.XXXXXXXX") || return
if command fizzy completion zsh >| "$temp_file" && [[ -s "$temp_file" ]] &&
zf_mv -f -- "$temp_file" "$cache_file"; then
return
fi
rm -f -- "$temp_file"
} &|
+15
View File
@@ -0,0 +1,15 @@
# fnox
Adds shell integration and completions for [fnox](https://github.com/jdx/fnox), a tool for provider-agnostic secret injection.
## Installation
[Install fnox](https://fnox.jdx.dev/guide/quick-start.html), then add it to your plugins in `~/.zshrc`:
```zsh
plugins=(fnox)
```
## Usage
See the [fnox documentation](https://fnox.jdx.dev/guide/shell-integration.html) for shell integration and usage.
+23
View File
@@ -0,0 +1,23 @@
if (( ! $+commands[fnox] )); then
# if we don't have fnox at all just bail out
return
fi
eval "$(fnox activate zsh)"
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `fnox`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_fnox" ]]; then
typeset -g -A _comps
autoload -Uz _fnox
_comps[fnox]=_fnox
fi
# Regenerate completions when the executable changes.
if [[ ! -s "$ZSH_CACHE_DIR/completions/_fnox" || "$commands[fnox]" -nt "$ZSH_CACHE_DIR/completions/_fnox" ]]; then
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._fnox"
zf_mv -f -- =( fnox completion zsh ) "$ZSH_CACHE_DIR/completions/_fnox"
} &|
fi
+1
View File
@@ -7,6 +7,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
search_locations=(
"$HOME/google-cloud-sdk"
"/usr/local/share/google-cloud-sdk"
"/usr/local/google-cloud-sdk"
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/opt/homebrew/share/google-cloud-sdk"
+10 -9
View File
@@ -1,7 +1,6 @@
# git-commit plugin
The git-commit plugin adds several
[git aliases](https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-alias) for
The git-commit plugin adds several git subcommands for
[conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
To use it, add `git-commit` to the plugins array in your zshrc file:
@@ -13,7 +12,7 @@ plugins=(... git-commit)
## Syntax
```zsh
git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] "<message>"
git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] [(-b, --body) "<body>"] "<message>"
```
Where `type` is one of the following:
@@ -31,17 +30,19 @@ Where `type` is one of the following:
- `test`
- `wip`
> NOTE: the alias for `revert` type is `rev`, as otherwise it conflicts with the git command of the same name.
> It will still generate a commit message in the format `revert: <message>`
The optional `-b` / `--body` becomes the commit body (a blank line after the subject), as defined by
[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary).
> ⚠️ Enabling this plugin will (potentially) overwrite all `alias.<type>` that you manually set. Use with
> care!
> NOTE: the subcommand for `revert` type is `rev`, as otherwise it conflicts with the
> git command of the same name. It will still generate a commit message in the format
> `revert: <message>`
## Examples
| Git alias | Command |
| Git subcommand | Command |
| --------------------------------------------- | ---------------------------------------------------- |
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
| `git wip "work in progress"` | `git commit -m "work in progress"` |
| `git wip "work in progress"` | `git commit -m "wip: work in progress"` |
| `git fix -s "router" "correct redirect link"` | `git commit -m "fix(router): correct redirect link"` |
| `git rev -s "api" "rollback v2"` | `git commit -m "revert(api): rollback v2"` |
| `git feat -s "auth" -b "Keep session across redirects." "add login redirect"` | `git commit -m "feat(auth): add login redirect" -m "Keep session across redirects."` |
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+46
View File
@@ -0,0 +1,46 @@
#!/usr/bin/env zsh
_omz_git_commit() {
0=${(%):-%x}
if [[ "$0" != */git-* ]]; then
echo >&2 "Expecting command named git-foo. Got '$0'."
return 1
fi
local _type="${0##*/git-}"
# The subcommand is shortened to avoid Git's built-in revert command.
if [[ "$_type" == rev ]]; then
_type=revert
fi
local _scope _attention _message _body
while [ $# -ne 0 ]; do
case $1 in
-s | --scope )
if [ -z "$2" ]; then
echo >&2 "Missing scope!"
return 1
fi
_scope="$2"
shift 2
;;
-a | --attention )
_attention="!"
shift 1
;;
-b | --body )
if [ -z "$2" ]; then
echo >&2 "Missing body!"
return 1
fi
_body="$2"
shift 2
;;
* )
_message="${_message} $1"
shift 1
;;
esac
done
git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}" ${_body:+-m} ${_body:+"$_body"}
}
_omz_git_commit "$@"
+42 -55
View File
@@ -1,58 +1,45 @@
local _rev="$(git -C $ZSH rev-parse HEAD 2> /dev/null)"
if [[ $_rev == $(git config --global --get oh-my-zsh.git-commit-alias 2> /dev/null) ]]; then
return
fi
git config --global oh-my-zsh.git-commit-alias "$_rev"
# Add git-commit commands directory to path
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
path=("${0:a:h}/git-commands" $path)
local -a _git_commit_aliases
_git_commit_aliases=(
'build'
'chore'
'ci'
'docs'
'feat'
'fix'
'perf'
'refactor'
'revert'
'style'
'test'
'wip'
)
# Append completions for custom git commands
() {
local -a git_user_commands
zstyle -a ':completion:*:*:git:*' user-commands 'git_user_commands' \
|| git_user_commands=()
git_user_commands+=(
build:'Commit with a message indicating a build' \
chore:'Commit with a message indicating a chore' \
ci:'Commit with a message indicating a CI change' \
docs:'Commit with a message indicating an update to the documentation' \
feat:'Commit with a message indicating a feature' \
fix:'Commit with a message indicating a fix' \
perf:'Commit with a message indicating a performance enhancement' \
refactor:'Commit with a message indicating a refactor' \
rev:'Commit with a message indicating a revert' \
style:'Commit with a message indicating a style change' \
test:'Commit with a message indicating updates to tests' \
wip:'Commit with a message indicating a work in progress'
)
zstyle ':completion:*:*:git:*' user-commands "${git_user_commands[@]}"
}
local _alias _type
for _type in "${_git_commit_aliases[@]}"; do
# an alias can't be named "revert" because the git command takes precedence
# https://stackoverflow.com/a/3538791
case "$_type" in
revert) _alias=rev ;;
*) _alias=$_type ;;
esac
local _func='!a() {
local _scope _attention _message
while [ $# -ne 0 ]; do
case $1 in
-s | --scope )
if [ -z $2 ]; then
echo "Missing scope!"
return 1
# Clean up aliases from the prior implementation of git-commit. Keep this migration
# for users upgrading from versions that still wrote aliases to .gitconfig.
() {
git config --global --get oh-my-zsh.git-commit-alias &> /dev/null || return 0
local -a old_git_aliases=(
'build' 'chore' 'ci'
'docs' 'feat' 'fix'
'perf' 'refactor' 'rev'
'style' 'test' 'wip'
)
local git_alias
for git_alias in $old_git_aliases; do
if [[ "$(git config --global --get alias.$git_alias | tr '\n' ' ')" == "!a() { local _scope _attention _message"* ]]; then
git config --global --unset alias.$git_alias
fi
_scope="$2"
shift 2
;;
-a | --attention )
_attention="!"
shift 1
;;
* )
_message="${_message} $1"
shift 1
;;
esac
done
git commit -m "'$_type'${_scope:+(${_scope})}${_attention}:${_message}"
}; a'
git config --global alias.$_alias "$_func"
done
done
git config --global --unset oh-my-zsh.git-commit-alias
}
+3 -1
View File
@@ -21,7 +21,7 @@ plugins=(... git)
| `gapa` | `git add --patch` |
| `gau` | `git add --update` |
| `gav` | `git add --verbose` |
| `gwip` | `git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"` |
| `gwip` | `git add -A; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"` |
| `gam` | `git am` |
| `gama` | `git am --abort` |
| `gamc` | `git am --continue` |
@@ -191,6 +191,7 @@ plugins=(... git)
| `grmc` | `git rm --cached` |
| `gcount` | `git shortlog --summary -n` |
| `gsh` | `git show` |
| `gshs` | `git show --stat` |
| `gsps` | `git show --pretty=short --show-signature` |
| `gstall` | `git stash --all` |
| `gstu` | `git stash --include-untracked` |
@@ -207,6 +208,7 @@ plugins=(... git)
| `gsb` | `git status --short -b` |
| `gsnut` | `git status --untracked-files=no` |
| `gsi` | `git submodule init` |
| `gsms` | `git submodule status` |
| `gsu` | `git submodule update` |
| `gsuri` | `git submodule update --recursive --init` |
| `gsd` | `git svn dcommit` |
+3 -1
View File
@@ -119,7 +119,7 @@ alias gaa='git add --all'
alias gapa='git add --patch'
alias gau='git add --update'
alias gav='git add --verbose'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
alias gwip='git add -A; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
alias gam='git am'
alias gama='git am --abort'
alias gamc='git am --continue'
@@ -392,6 +392,7 @@ alias grm='git rm'
alias grmc='git rm --cached'
alias gcount='git shortlog --summary --numbered'
alias gsh='git show'
alias gshs='git show --stat'
alias gsps='git show --pretty=short --show-signature'
alias gstall='git stash --all'
alias gstaa='git stash apply'
@@ -409,6 +410,7 @@ alias gss='git status --short'
alias gsb='git status --short --branch'
alias gsnut='git status --untracked-files=no'
alias gsi='git submodule init'
alias gsms='git submodule status'
alias gsu='git submodule update'
alias gsuri='git submodule update --recursive --init'
alias gsd='git svn dcommit'
+5 -1
View File
@@ -4,7 +4,11 @@ globalias() {
# (A) makes it an array even if there's only one element
local word=${${(Az)LBUFFER}[-1]}
if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
zle _expand_alias
# Completion also considers quoted strings and assignment values as aliases.
# Only expand when the complete shell word is an alias name.
if (( ${+aliases[$word]} || ${+galiases[$word]} )); then
zle _expand_alias
fi
zle expand-word
fi
zle self-insert
@@ -0,0 +1,81 @@
#!/usr/bin/env zsh
# Exercise the actual ZLE widgets in an isolated interactive shell.
emulate -L zsh
setopt err_return
zmodload zsh/zpty
zmodload zsh/zselect
local test_dir=$(mktemp -d)
export GLOBALIAS_TEST_PLUGIN=${0:A:h:h}/globalias.plugin.zsh
export GLOBALIAS_TEST_RESULT=$test_dir/result
wait_for_marker() {
local marker=$1 output received
local -i deadline=$(( SECONDS + 5 ))
while (( SECONDS < deadline )); do
if zpty -r globalias-test output; then
received+=$output
[[ $received == *$marker* ]] && return 0
else
zselect -t 1 || true
fi
done
print -u2 -r -- "Timed out waiting for ZLE: $received"
return 1
}
check_expansion() {
local input=$1 expected=$2 actual
zpty -w -n globalias-test "$input"$' \x18'
wait_for_marker GLOBALIAS_TEST_CAPTURED
actual=$(< "$GLOBALIAS_TEST_RESULT")
if [[ $actual != "$expected" ]]; then
print -u2 -r -- "Input: ${(qqq)input}"
print -u2 -r -- "Expected: ${(qqq)expected}; got: ${(qqq)actual}"
return 1
fi
}
{
cat > "$test_dir/setup.zsh" <<'SETUP'
autoload -Uz compinit
compinit -D
source "$GLOBALIAS_TEST_PLUGIN"
alias 1='cd -1'
alias ll='ls -l'
alias -g G='| grep'
GLOBALIAS_FILTER_VALUES=(ll)
_globalias_test_capture() {
print -rn -- "$BUFFER" > "$GLOBALIAS_TEST_RESULT"
print -r -- $'\nGLOBALIAS_TEST_CAPTURED'
BUFFER=
zle .accept-line
}
zle -N _globalias_test_capture
bindkey '^X' _globalias_test_capture
PS1='GLOBALIAS_TEST_READY> '
RPROMPT=
SETUP
zpty -b globalias-test zsh -dfi
zpty -w globalias-test "source ${(q)test_dir}/setup.zsh"
wait_for_marker GLOBALIAS_TEST_READY
check_expansion 'DEBUG=1' 'DEBUG=1 '
check_expansion 'DEBUG="1"' 'DEBUG="1" '
check_expansion "DEBUG='1'" "DEBUG='1' "
check_expansion '1' 'cd -1 '
check_expansion '"1"' '"1" '
check_expansion "'1'" "'1' "
check_expansion '\1' '\1 '
check_expansion 'echo G' 'echo | grep '
check_expansion 'DEBUG=1 1' 'DEBUG=1 cd -1 '
check_expansion 'll' 'll '
check_expansion 'echo $((1+2))' 'echo 3 '
check_expansion 'echo {a,b}' 'echo a b '
check_expansion '' ' '
print 'All globalias expansion tests passed.'
} always {
zpty -d globalias-test 2>/dev/null || true
rm -rf -- "$test_dir"
}
+2
View File
@@ -22,6 +22,7 @@ plugins=(... golang)
| gofx | `go fix` | Update packages to use a new API |
| gog | `go get` | Downloads packages and then installs them to $GOPATH |
| goga | `go get ./...` | Installs all dependencies in current directory, recursively |
| goge | `go generate` | Generate Go files by processing source |
| goi | `go install` | Compiles and installs packages to $GOPATH |
| gol | `go list` | Lists Go packages |
| gom | `go mod` | Access to operations on modules |
@@ -54,3 +55,4 @@ changes your prompt to:
```
~/go/project$ ▋ 1.22.3
```
+1
View File
@@ -19,6 +19,7 @@ alias gofa='go fmt ./...'
alias gofx='go fix'
alias gog='go get'
alias goga='go get ./...'
alias goge='go generate'
alias goi='go install'
alias gol='go list'
alias gom='go mod'
+31 -1
View File
@@ -5,10 +5,40 @@ Applies some fixes for some common issues encountered with [GPG's gpg-agent](htt
More specifically, this plugin:
- Updates the `GPG_TTY` environment variable before each shell execution.
- Updates the `SSH_AUTH_SOCK` environment variable if `enable-ssh-support` is turned on.
- Updates the `SSH_AUTH_SOCK` environment variable if `gpg-agent` is your SSH
agent. By default the plugin checks whether `enable-ssh-support` is turned
on. The [`ssh-support` setting](#settings) lets you say so yourself.
To use it, add `gpg-agent` to the plugins array of your zshrc file:
```zsh
plugins=(... gpg-agent)
```
## Settings
Every time a shell starts, the plugin runs `gpgconf --list-options gpg-agent` to
find out whether `enable-ssh-support` is turned on. That check can be slow. If
you already know the answer, state it with the `ssh-support` style and the
plugin skips the check. Set it in your zshrc, before Oh My Zsh is sourced.
If you don't use `gpg-agent` as your SSH agent:
```zsh
zstyle ':omz:plugins:gpg-agent' ssh-support no
```
The plugin then only sets `GPG_TTY`. It leaves `SSH_AUTH_SOCK` alone, and it
doesn't update the agent's tty before each command, which only SSH support
needs.
If you do use `gpg-agent` as your SSH agent:
```zsh
zstyle ':omz:plugins:gpg-agent' ssh-support yes
```
The plugin then sets `SSH_AUTH_SOCK` without checking. `enable-ssh-support`
still has to be set in your `gpg-agent.conf` for SSH to work.
Leave the style unset to keep the automatic check.
+16 -1
View File
@@ -1,5 +1,16 @@
export GPG_TTY=$TTY
# The ssh-support style says whether gpg-agent is used as the ssh agent.
# Setting it saves asking gpgconf, which can be slow.
zstyle -t ':omz:plugins:gpg-agent' ssh-support
_gpg_agent_ssh_support=$? # 0 if yes, 1 if no, 2 if not set
# Everything below is only needed for ssh support
if (( _gpg_agent_ssh_support == 1 )); then
unset _gpg_agent_ssh_support
return
fi
# Fix for passphrase prompt on the correct tty
# See https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html#option-_002d_002denable_002dssh_002dsupport
function _gpg-agent_update-tty_preexec {
@@ -9,9 +20,13 @@ autoload -U add-zsh-hook
add-zsh-hook preexec _gpg-agent_update-tty_preexec
# If enable-ssh-support is set, fix ssh agent integration
if [[ $(gpgconf --list-options gpg-agent 2>/dev/null | awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then
if (( _gpg_agent_ssh_support == 0 )) \
|| [[ $(gpgconf --list-options gpg-agent 2>/dev/null \
| awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then
unset SSH_AGENT_PID
if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
fi
unset _gpg_agent_ssh_support
+31
View File
@@ -112,6 +112,37 @@ plugins=(... hcloud)
| hcst | `hcloud server-type list` | List all server types |
| hcit | `hcloud image list --type system` | List all system images |
## Prompt function
This plugin provides `hcloud_prompt_info` which can be added to your prompt to display the current Hetzner Cloud context.
- If `HCLOUD_TOKEN` environment variable is set, it displays `HCLOUD_TOKEN` (indicating direct token usage)
- Otherwise, it displays the active context name
### Usage
Add `$(hcloud_prompt_info)` to your `PROMPT` or `RPROMPT` in your `.zshrc`:
```zsh
RPROMPT='$(hcloud_prompt_info)'
```
### Theme variables
| Variable | Default | Description |
| :----------------------------- | :-------------- | :----------------------------------------------- |
| `ZSH_THEME_HCLOUD_PREFIX` | `<hcloud:` | Prefix before the context name |
| `ZSH_THEME_HCLOUD_SUFFIX` | `>` | Suffix after the context name |
| `ZSH_THEME_HCLOUD_TOKEN_TEXT` | `HCLOUD_TOKEN` | Text shown when `HCLOUD_TOKEN` env var is set |
### Example with custom styling
```zsh
ZSH_THEME_HCLOUD_PREFIX="%{$fg[blue]%}hcloud:("
ZSH_THEME_HCLOUD_SUFFIX=")%{$reset_color%}"
RPROMPT='$(hcloud_prompt_info)'
```
## Requirements
This plugin requires the [Hetzner Cloud CLI](https://github.com/hetznercloud/cli) to be installed.
+17
View File
@@ -131,3 +131,20 @@ alias hcdc='hcloud datacenter list'
alias hcloc='hcloud location list'
alias hcst='hcloud server-type list'
alias hcit='hcloud image list --type system'
# Prompt function to display current hcloud context
# Usage: add $(hcloud_prompt_info) to your PROMPT or RPROMPT
function hcloud_prompt_info() {
# Check if HCLOUD_TOKEN is set (overrides context)
if [[ -n "$HCLOUD_TOKEN" ]]; then
echo "${ZSH_THEME_HCLOUD_PREFIX=<hcloud:}${ZSH_THEME_HCLOUD_TOKEN_TEXT=HCLOUD_TOKEN}${ZSH_THEME_HCLOUD_SUFFIX=>}"
return
fi
# Get active context
local context
context=$(hcloud context active 2>/dev/null)
[[ -n "$context" ]] || return
echo "${ZSH_THEME_HCLOUD_PREFIX=<hcloud:}${context}${ZSH_THEME_HCLOUD_SUFFIX=>}"
}
+17 -4
View File
@@ -1,5 +1,18 @@
# Autocompletion for invoke.
#
if [ $commands[invoke] ]; then
source <(invoke --print-completion-script=zsh)
# Autocompletion for the Invoke CLI (invoke).
if (( ! $+commands[invoke] )); then
return
fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_invoke" ]]; then
invoke --print-completion-script=zsh | tee "$ZSH_CACHE_DIR/completions/_invoke" >/dev/null
source "$ZSH_CACHE_DIR/completions/_invoke"
else
source "$ZSH_CACHE_DIR/completions/_invoke"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._invoke"
zf_mv -f -- =( invoke --print-completion-script=zsh ) "$ZSH_CACHE_DIR/completions/_invoke"
} &|
fi
+17 -3
View File
@@ -1,4 +1,18 @@
if [ $commands[istioctl] ]; then
source <(istioctl completion zsh)
compdef _istioctl istioctl
# Autocompletion for the Istio CLI (istioctl).
if (( ! $+commands[istioctl] )); then
return
fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_istioctl" ]]; then
istioctl completion zsh | tee "$ZSH_CACHE_DIR/completions/_istioctl" >/dev/null
source "$ZSH_CACHE_DIR/completions/_istioctl"
else
source "$ZSH_CACHE_DIR/completions/_istioctl"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._istioctl"
zf_mv -f -- =( istioctl completion zsh ) "$ZSH_CACHE_DIR/completions/_istioctl"
} &|
fi
+2 -1
View File
@@ -44,6 +44,7 @@ plugins=(... jj)
| jjgi | `jj git init` |
| jjgp | `jj git push` |
| jjgpa | `jj git push --all` |
| jjgpb | `jj git push --bookmark` |
| jjgpd | `jj git push --deleted` |
| jjgpt | `jj git push --tracked` |
| jjgrl | `jj git remote list` |
@@ -70,7 +71,7 @@ plugins=(... jj)
## Prompt usage
Because `jj` has a very powerful [template syntax](https://martinvonz.github.io/jj/latest/templates/), this
Because `jj` has a very powerful [template syntax](https://docs.jj-vcs.dev/latest/templates/), this
plugin only exposes a convenience function `jj_prompt_template` to read information from the current change.
It is basically the same as `jj log --no-graph -r @ -T $1`:
+1
View File
@@ -70,6 +70,7 @@ alias jjgfa='jj git fetch --all-remotes'
alias jjgi='jj git init'
alias jjgp='jj git push'
alias jjgpa='jj git push --all'
alias jjgpb='jj git push --bookmark'
alias jjgpd='jj git push --deleted'
alias jjgpt='jj git push --tracked'
alias jjgrl='jj git remote list'
+14 -8
View File
@@ -22,14 +22,17 @@ fi
# Define json tools for each method
case "$JSONTOOLS_METHOD" in
node)
# node doesn't make it easy to deal with stdin, so we pass it as an argument with xargs -0
# Read stdin directly so input is not limited by command-line argument size.
function pp_json() {
xargs -0 node -e 'console.log(JSON.stringify(JSON.parse(process.argv[1]), null, 4));'
node -e '
const input = require("fs").readFileSync(0, "utf8");
console.log(JSON.stringify(JSON.parse(input), null, 4));
'
}
function is_json() {
xargs -0 node -e '
node -e '
try {
json = JSON.parse(process.argv[1]);
JSON.parse(require("fs").readFileSync(0, "utf8"));
console.log("true");
process.exit(0);
} catch (e) {
@@ -39,10 +42,14 @@ case "$JSONTOOLS_METHOD" in
'
}
function urlencode_json() {
xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"
node -e '
console.log(encodeURIComponent(require("fs").readFileSync(0, "utf8")));
'
}
function urldecode_json() {
xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"
node -e '
console.log(decodeURIComponent(require("fs").readFileSync(0, "utf8")));
'
}
;;
python3)
@@ -79,8 +86,7 @@ print(unquote_plus(sys.stdin.read()))
function pp_json() {
ruby -e '
require "json"
require "yaml"
puts JSON.parse(STDIN.read).to_yaml
puts JSON.pretty_generate(JSON.parse(STDIN.read), indent: " ")
'
}
function is_json() {
@@ -0,0 +1,54 @@
#!/usr/bin/env zsh
# Run with: zsh -df plugins/jsontools/tests/jsontools-ruby.test.zsh
emulate -L zsh
setopt err_return
(( $+commands[ruby] )) || {
print -u2 'These tests require Ruby.'
exit 1
}
JSONTOOLS_METHOD=ruby
source "${0:A:h:h}/jsontools.plugin.zsh"
local test_dir=$(mktemp -d)
check_output() {
local tool=$1 description=$2 expected_status=${3:-0}
local -i result=0
$tool < "$test_dir/input" > "$test_dir/actual" || result=$?
if (( result != expected_status )) \
|| ! cmp -s "$test_dir/expected" "$test_dir/actual"; then
print -u2 -r -- "FAIL: $description ($tool exited $result)"
return 1
fi
print -r -- "PASS: $description"
}
{
# pp_json prints JSON with the same 4-space indent as the node and python3 methods.
print -rn -- '{"value":42}' > "$test_dir/input"
printf '{\n "value": 42\n}\n' > "$test_dir/expected"
check_output pp_json 'pretty-print a small document'
print -rn -- '{"list":[1,"two"],"nested":{"a":null,"b":true}}' > "$test_dir/input"
printf '{\n "list": [\n 1,\n "two"\n ],\n "nested": {\n "a": null,\n "b": true\n }\n}\n' \
> "$test_dir/expected"
check_output pp_json 'pretty-print a nested document'
printf '{"a":1}\n[2]\n' > "$test_dir/input"
printf '{\n "a": 1\n}\n[\n 2\n]\n' > "$test_dir/expected"
check_output pp_ndjson 'pretty-print NDJSON'
print -rn -- '{"value":42}' > "$test_dir/input"
print -r -- true > "$test_dir/expected"
check_output is_json 'validate a document'
print -rn -- '{invalid}' > "$test_dir/input"
print -r -- false > "$test_dir/expected"
check_output is_json 'reject invalid JSON' 1
print 'All jsontools Ruby tests passed.'
} always {
rm -rf -- "$test_dir"
}
@@ -0,0 +1,64 @@
#!/usr/bin/env zsh
# Run with: zsh -df plugins/jsontools/tests/jsontools.test.zsh
emulate -L zsh
setopt err_return
(( $+commands[node] )) || {
print -u2 'These tests require Node.js.'
exit 1
}
JSONTOOLS_METHOD=node
source "${0:A:h:h}/jsontools.plugin.zsh"
local test_dir=$(mktemp -d)
check_output() {
local tool=$1 description=$2 expected_status=${3:-0}
local -i result=0
$tool < "$test_dir/input" > "$test_dir/actual" || result=$?
if (( result != expected_status )) \
|| ! cmp -s "$test_dir/expected" "$test_dir/actual"; then
print -u2 -r -- "FAIL: $description ($tool exited $result)"
return 1
fi
print -r -- "PASS: $description"
}
{
print -rn -- '{"value":42}' > "$test_dir/input"
printf '{\n "value": 42\n}\n' > "$test_dir/expected"
check_output pp_json 'pretty-print a small document'
# Larger than the 128 KiB limit for a single command-line argument.
local large_value=${(l:262144::x:):-}
print -rn -- '{"value":"'"$large_value"'"}' > "$test_dir/input"
printf '{\n "value": "%s"\n}\n' "$large_value" > "$test_dir/expected"
check_output pp_json 'pretty-print a large document'
print -r -- true > "$test_dir/expected"
check_output is_json 'validate a large document'
print -r -- '%7B%22value%22%3A%22'"$large_value"'%22%7D' \
> "$test_dir/expected"
check_output urlencode_json 'encode a large document'
local encoded=$(< "$test_dir/expected")
print -rn -- "$encoded" > "$test_dir/input"
print -r -- '{"value":"'"$large_value"'"}' > "$test_dir/expected"
check_output urldecode_json 'decode a large document'
# Passed as an argument, node used to parse this as its own option.
print -rn -- '--version' > "$test_dir/input"
print -r -- '--version' > "$test_dir/expected"
check_output urlencode_json 'encode input that starts with --'
print -rn -- '{invalid}' > "$test_dir/input"
print -r -- false > "$test_dir/expected"
check_output is_json 'reject invalid JSON' 1
printf '1\0002' > "$test_dir/input"
check_output is_json 'reject input with NUL bytes' 1
print 'All jsontools Node.js tests passed.'
} always {
rm -rf -- "$test_dir"
}
+17 -4
View File
@@ -1,8 +1,21 @@
# Autocompletion for kn, the command line interface for knative
# Autocompletion for kn, the command line interface for Knative.
#
# Author: https://github.com/btannous
if [ $commands[kn] ]; then
source <(kn completion zsh)
compdef _kn kn
if (( ! $+commands[kn] )); then
return
fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_kn" ]]; then
kn completion zsh | tee "$ZSH_CACHE_DIR/completions/_kn" >/dev/null
source "$ZSH_CACHE_DIR/completions/_kn"
else
source "$ZSH_CACHE_DIR/completions/_kn"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._kn"
zf_mv -f -- =( kn completion zsh ) "$ZSH_CACHE_DIR/completions/_kn"
} &|
fi
+17 -2
View File
@@ -1,3 +1,18 @@
if [ $commands[kompose] ]; then
source <(kompose completion zsh)
# Autocompletion for the Kompose CLI (kompose).
if (( ! $+commands[kompose] )); then
return
fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_kompose" ]]; then
kompose completion zsh | tee "$ZSH_CACHE_DIR/completions/_kompose" >/dev/null
source "$ZSH_CACHE_DIR/completions/_kompose"
else
source "$ZSH_CACHE_DIR/completions/_kompose"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._kompose"
zf_mv -f -- =( kompose completion zsh ) "$ZSH_CACHE_DIR/completions/_kompose"
} &|
fi
+17 -2
View File
@@ -1,3 +1,18 @@
if [ $commands[kops] ]; then
source <(kops completion zsh)
# Autocompletion for the Kubernetes Operations CLI (kops).
if (( ! $+commands[kops] )); then
return
fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_kops" ]]; then
kops completion zsh | tee "$ZSH_CACHE_DIR/completions/_kops" >/dev/null
source "$ZSH_CACHE_DIR/completions/_kops"
else
source "$ZSH_CACHE_DIR/completions/_kops"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._kops"
zf_mv -f -- =( kops completion zsh ) "$ZSH_CACHE_DIR/completions/_kops"
} &|
fi
+1
View File
@@ -60,6 +60,7 @@ plugins=(... kubectl)
| | | **Namespace management** |
| kgns | `kubectl get namespaces` | List the current namespaces in a cluster |
| kcn | `kubectl config set-context --current --namespace` | Change current namespace |
| kcgetns | `kubectl config view --minify -o jsonpath={.contexts[0].context.namespace}` | Get the current context's namespace |
| kens | `kubectl edit namespace` | Edit namespace resource from the default editor |
| kdns | `kubectl describe namespace` | Describe namespace resource in detail |
| kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace |
+2 -1
View File
@@ -31,7 +31,7 @@ alias kapk='kubectl apply -k'
# Drop into an interactive terminal on a container
alias keti='kubectl exec -t -i'
# Manage configuration quickly to switch contexts between local, dev ad staging.
# Manage configuration quickly to switch contexts between local, dev and staging.
alias kcuc='kubectl config use-context'
alias kcsc='kubectl config set-context'
alias kcdc='kubectl config delete-context'
@@ -83,6 +83,7 @@ alias kens='kubectl edit namespace'
alias kdns='kubectl describe namespace'
alias kdelns='kubectl delete namespace'
alias kcn='kubectl config set-context --current --namespace'
alias kcgetns="kubectl config view --minify -o 'jsonpath={.contexts[0].context.namespace}'"
# ConfigMap management
alias kgcm='kubectl get configmaps'
+73
View File
@@ -2,10 +2,69 @@
This plugin adds aliases and autocompletion for Laravel [Artisan](https://laravel.com/docs/artisan) and [Bob](http://daylerees.github.io/laravel-bob/) command-line interfaces.
It replaces the `laravel4` and `laravel5` plugins. Enable only `laravel` to use
the shared aliases and completion with Laravel projects of different versions.
```
plugins=(... laravel)
```
## Completion
For Laravel 4 and later, completion reads the available commands from
`artisan list --raw --no-ansi` in the current project, including custom commands.
The legacy static command-name completion is retained for Laravel 3, which does
not support that command. Artisan runs only when completing a command name;
command arguments use file completion without booting the application.
No Laravel command runs when the plugin is loaded.
## Migrating from laravel4 or laravel5
Replace `laravel4` or `laravel5` in your `plugins` array with `laravel`.
The old plugin names still load `laravel`, with a deprecation notice, and retain
their own version-specific aliases listed below. These aliases are available
only while the corresponding legacy plugin is enabled. When switching to
`laravel` alone, use `artisan` or the shared aliases instead; add any shortcuts
you still need to your own configuration.
| Alias | Command |
|-------|---------|
| `la4`, `la5` | `php artisan` |
| `la4dump` | `php artisan dump-autoload` |
| `la4cache`, `la5cache` | `php artisan cache:clear` |
| `la4routes` | `php artisan routes` (Laravel 4) |
| `la5routes` | `php artisan route:list` (Laravel 5 and later) |
| `la5vendor` | `php artisan vendor:publish` |
Only commands supported by your project's Laravel version can be run. The
version-specific aliases keep their original meaning; they do not translate
commands between versions.
## Settings
By default the aliases run `php artisan`. To use a different PHP command, such as
`herd php` (which runs the PHP version the [Laravel Herd](https://herd.laravel.com) site
is isolated to, instead of Herd's global version) or a specific version like `php8.4`,
set this before Oh My Zsh is sourced:
```zsh
zstyle ':omz:plugins:laravel' php 'herd php'
```
`php` in the aliases below is then replaced with that command.
For a wrapper such as `herd php`, Zsh normally attempts completion for the
wrapper after expanding the alias. To complete `artisan`, `la4`, and `la5`
directly with this plugin instead, enable Zsh's `COMPLETE_ALIASES` option:
```zsh
setopt COMPLETE_ALIASES
```
This option applies to all aliases in your shell.
## Aliases
| Alias | Description |
|:-:|:-:|
| `artisan` | `php artisan` |
@@ -65,3 +124,17 @@ plugins=(... laravel)
| `paqr` | `php artisan queue:retry` |
| `paqt` | `php artisan queue:table` |
| `paqw` | `php artisan queue:work` |
## Modules
Aliases for [nWidart/laravel-modules](https://github.com/nWidart/laravel-modules).
| Alias | Description |
|:-:|:-:|
| `pamol` | `php artisan module:list` |
| `pamomk` | `php artisan module:make` |
| `pamoe` | `php artisan module:enable` |
| `pamod` | `php artisan module:disable` |
| `pamom` | `php artisan module:migrate` |
| `pamomr` | `php artisan module:migrate-rollback` |
| `pamos` | `php artisan module:seed` |
+20 -10
View File
@@ -8,6 +8,9 @@
# - Adds aliases and autocompletion for bob
local curcontext="$curcontext" state line _opts _bundles ret=1
local php_command command_list
local -a artisan_commands
_arguments -C \
'1: :->cmds' \
'*:: :->args' && ret=0
@@ -15,6 +18,21 @@ _arguments -C \
case $state in
cmds)
# Boot the application only to discover command names, not file arguments.
# Laravel 3 falls back to the static command names below.
zstyle -s ':omz:plugins:laravel' php php_command || php_command=php
if [[ -f artisan ]] && command_list=$(
"${(@Q)${(z)php_command}}" artisan list --raw --no-ansi 2>/dev/null
); then
artisan_commands=("${(@f)command_list}")
artisan_commands=(${artisan_commands[@]%%[[:space:]]*})
fi
if (( ${#artisan_commands} )); then
compadd -- "${artisan_commands[@]}"
return $?
fi
_values "Artisan command" \
'session\:install[Create a session table]' \
'migrate[Manage Migrations]' \
@@ -24,16 +42,8 @@ case $state in
ret=0
;;
args)
case $line[1] in
migrate)
_values \
'install[Create the Laravel migration table' \
'make[Create a migration]' \
'rollback[Roll back to the last migration operation]' \
'reset[Roll back all migrations that have ever run]'
ret=0
;;
esac
_files
return $?
;;
esac
+60 -39
View File
@@ -1,51 +1,72 @@
#!zsh
alias artisan='php artisan'
alias bob='php artisan bob::build'
# Command used to run artisan, e.g. `herd php` or `php8.4` (default: `php`)
zstyle -s ':omz:plugins:laravel' php _omz_laravel_php || _omz_laravel_php=php
alias artisan="$_omz_laravel_php artisan"
alias bob="$_omz_laravel_php artisan bob::build"
# Development
alias pas='php artisan serve'
alias pad='php artisan dev'
alias pats='php artisan test'
alias pas="$_omz_laravel_php artisan serve"
alias pad="$_omz_laravel_php artisan dev"
alias pats="$_omz_laravel_php artisan test"
# Database
alias pam='php artisan migrate'
alias pamf='php artisan migrate:fresh'
alias pamfs='php artisan migrate:fresh --seed'
alias pamr='php artisan migrate:rollback'
alias pads='php artisan db:seed'
alias padw='php artisan db:wipe'
alias pam="$_omz_laravel_php artisan migrate"
alias pamf="$_omz_laravel_php artisan migrate:fresh"
alias pamfs="$_omz_laravel_php artisan migrate:fresh --seed"
alias pamr="$_omz_laravel_php artisan migrate:rollback"
alias pads="$_omz_laravel_php artisan db:seed"
alias padw="$_omz_laravel_php artisan db:wipe"
# Makers
alias pamm='php artisan make:model'
alias pamc='php artisan make:controller'
alias pams='php artisan make:seeder'
alias pamt='php artisan make:test'
alias pamfa='php artisan make:factory'
alias pamp='php artisan make:policy'
alias pame='php artisan make:event'
alias pamj='php artisan make:job'
alias paml='php artisan make:listener'
alias pamn='php artisan make:notification'
alias pampp='php artisan make:provider'
alias pamcl='php artisan make:class'
alias pamen='php artisan make:enum'
alias pami='php artisan make:interface'
alias pamtr='php artisan make:trait'
alias pamv='php artisan make:view'
alias pammig='php artisan make:migration'
alias pamm="$_omz_laravel_php artisan make:model"
alias pamc="$_omz_laravel_php artisan make:controller"
alias pams="$_omz_laravel_php artisan make:seeder"
alias pamt="$_omz_laravel_php artisan make:test"
alias pamfa="$_omz_laravel_php artisan make:factory"
alias pamp="$_omz_laravel_php artisan make:policy"
alias pame="$_omz_laravel_php artisan make:event"
alias pamj="$_omz_laravel_php artisan make:job"
alias paml="$_omz_laravel_php artisan make:listener"
alias pamn="$_omz_laravel_php artisan make:notification"
alias pampp="$_omz_laravel_php artisan make:provider"
alias pamcl="$_omz_laravel_php artisan make:class"
alias pamen="$_omz_laravel_php artisan make:enum"
alias pami="$_omz_laravel_php artisan make:interface"
alias pamtr="$_omz_laravel_php artisan make:trait"
alias pamv="$_omz_laravel_php artisan make:view"
alias pammig="$_omz_laravel_php artisan make:migration"
# Clears
alias pacac='php artisan cache:clear'
alias pacoc='php artisan config:clear'
alias pavic='php artisan view:clear'
alias paroc='php artisan route:clear'
alias paopc='php artisan optimize:clear'
alias pacac="$_omz_laravel_php artisan cache:clear"
alias pacoc="$_omz_laravel_php artisan config:clear"
alias pavic="$_omz_laravel_php artisan view:clear"
alias paroc="$_omz_laravel_php artisan route:clear"
alias paopc="$_omz_laravel_php artisan optimize:clear"
# queues
alias paqf='php artisan queue:failed'
alias paqft='php artisan queue:failed-table'
alias paql='php artisan queue:listen'
alias paqr='php artisan queue:retry'
alias paqt='php artisan queue:table'
alias paqw='php artisan queue:work'
alias paqf="$_omz_laravel_php artisan queue:failed"
alias paqft="$_omz_laravel_php artisan queue:failed-table"
alias paql="$_omz_laravel_php artisan queue:listen"
alias paqr="$_omz_laravel_php artisan queue:retry"
alias paqt="$_omz_laravel_php artisan queue:table"
alias paqw="$_omz_laravel_php artisan queue:work"
# Modules (nWidart/laravel-modules)
alias pamol="$_omz_laravel_php artisan module:list"
alias pamomk="$_omz_laravel_php artisan module:make"
alias pamoe="$_omz_laravel_php artisan module:enable"
alias pamod="$_omz_laravel_php artisan module:disable"
alias pamom="$_omz_laravel_php artisan module:migrate"
alias pamomr="$_omz_laravel_php artisan module:migrate-rollback"
alias pamos="$_omz_laravel_php artisan module:seed"
unset _omz_laravel_php
# Also load completion when reached through a legacy plugin name.
if (( ! ${fpath[(Ie)${0:A:h}]} )); then
fpath+=("${0:A:h}")
fi
autoload -Uz _artisan
compdef _artisan artisan
+171
View File
@@ -0,0 +1,171 @@
#!/usr/bin/env zsh
# Run with: zsh -df plugins/laravel/tests/laravel.test.zsh
emulate -LR zsh
plugin_dir=${0:A:h:h}
test_dir=$(mktemp -d) || exit 1
trap 'command rm -rf -- "$test_dir"' EXIT
typeset -i tests=0 failures=0 fixture_status=0
typeset completion_state=cmds fixture_output output
autoload -Uz compinit
compinit -D -u
# Record the interpreter's arguments even when invoked in a subshell.
php() {
print -rl -- "$@" >| "$test_dir/call"
print -r -- "$fixture_output"
return $fixture_status
}
check() {
local description=$1
shift
(( tests++ ))
if "$@"; then
print -r -- "PASS: $description"
else
print -u2 -r -- "FAIL: $description"
(( failures++ ))
fi
}
source "$plugin_dir/laravel.plugin.zsh"
check 'plugin loading does not execute PHP' test ! -e "$test_dir/call"
check 'completion is registered for artisan' \
test "${_comps[artisan]}" = _artisan
for name in la4 la4dump la4cache la4routes la5 la5cache la5routes la5vendor; do
check "laravel alone does not add $name" test "${+aliases[$name]}" = 0
done
for name in la4 la5; do
check "laravel alone does not register $name completion" \
test "${+_comps[$name]}" = 0
done
for entry in \
'pas:serve' 'pam:migrate' 'pamm:make:model' 'bob:bob::build'; do
name=${entry%%:*}
expected_command=${entry#*:}
expected_call=$'artisan\n'"$expected_command"$'\nargument with spaces'
eval "$name 'argument with spaces'" > /dev/null
check "$name preserves its command and arguments" \
test "$(command cat -- "$test_dir/call")" = "$expected_call"
done
# Exercise completion dispatch without requiring an interactive ZLE session.
_arguments() { state=$completion_state; line=(migrate); return 1; }
compadd() { [[ $1 == -- ]] && shift; print -rl -- "$@"; }
_values() { print -rl -- "$@"; }
_files() { print -r -- file-completion; }
mkdir "$test_dir/project with spaces"
builtin cd "$test_dir/project with spaces"
touch artisan
fixture_output='cache:clear Clear the application cache
migrate Run migrations
project:custom Run a custom command'
output=$(_artisan)
check 'project commands, namespaces and custom commands are completed' \
test "$output" = $'cache:clear\nmigrate\nproject:custom'
check 'completion uses the portable raw list interface' \
test "$(command cat -- "$test_dir/call")" = $'artisan\nlist\n--raw\n--no-ansi'
fixture_output='routes List Laravel 4 routes
dump-autoload Regenerate autoload files'
output=$(_artisan)
check 'Laravel 4 commands are discovered rather than hardcoded' \
test "$output" = $'routes\ndump-autoload'
completion_state=args
for fixture_status in 0 1; do
command rm -f -- "$test_dir/call"
output=$(_artisan)
check "command arguments use file completion (PHP status $fixture_status)" \
test "$output" = file-completion
check "argument completion never boots Artisan (PHP status $fixture_status)" \
test ! -e "$test_dir/call"
done
completion_state=cmds
fixture_status=1
fixture_output='Unsupported option: --raw'
output=$(_artisan)
check 'legacy Artisan retains its static completion when raw listing fails' \
test "${output[(f)-1]}" = 'key\:\:generate[Generate a key]'
fixture_status=0
fixture_output=''
output=$(_artisan)
check 'an empty command list falls back to legacy completion' \
test "${output[(f)-1]}" = 'key\:\:generate[Generate a key]'
command rm "$test_dir/call"
builtin cd "$test_dir"
output=$(_artisan)
check 'completion outside a project does not execute PHP' \
test ! -e "$test_dir/call"
# A configured command may contain multiple words and quoted arguments.
wrapper() {
print -rl -- "$@" >| "$test_dir/wrapper-call"
print -r -- "$fixture_output"
}
zstyle ':omz:plugins:laravel' php 'wrapper --site "site with spaces" php'
source "$plugin_dir/../laravel5/laravel5.plugin.zsh" 2> "$test_dir/warning"
eval 'la5routes "argument with spaces"' > /dev/null
expected_call=$'--site\nsite with spaces\nphp\nartisan\nroute:list'
expected_call+=$'\nargument with spaces'
check 'legacy aliases honor a configured PHP wrapper' \
test "$(command cat -- "$test_dir/wrapper-call")" = "$expected_call"
builtin cd "$test_dir/project with spaces"
fixture_output=$'project:custom Run a custom command'
output=$(_artisan)
expected_call=$'--site\nsite with spaces\nphp\nartisan\nlist\n--raw\n--no-ansi'
check 'completion honors a configured PHP wrapper' \
test "$(command cat -- "$test_dir/wrapper-call")" = "$expected_call"
check 'wrapper output is completed' test "$output" = project:custom
zstyle -d ':omz:plugins:laravel' php
for plugin in laravel4 laravel5; do
# Start a separate shell so no previously loaded completion can hide a
# missing autoload path in the compatibility plugin.
output=$(zsh -df -c '
autoload -Uz compinit
compinit -D -u
source "$1" 2> "$2"
prefix=la${3#laravel}
for name in artisan $prefix; do
[[ ${_comps[$name]} == _artisan ]] || exit 1
done
if [[ $prefix == la4 ]]; then
[[ ${+aliases[la5]} == 0 ]] || exit 1
expected_aliases=(
la4 "php artisan" la4dump "php artisan dump-autoload"
la4cache "php artisan cache:clear" la4routes "php artisan routes"
)
else
[[ ${+aliases[la4]} == 0 ]] || exit 1
expected_aliases=(
la5 "php artisan" la5cache "php artisan cache:clear"
la5routes "php artisan route:list"
la5vendor "php artisan vendor:publish"
)
fi
for name expected in "${expected_aliases[@]}"; do
[[ ${aliases[$name]} == "$expected" ]] || exit 1
done
autoload +X _artisan || exit 1
[[ ${functions_source[_artisan]} == */laravel/_artisan ]] || exit 1
print -r -- loaded
' zsh "$plugin_dir/../$plugin/$plugin.plugin.zsh" \
"$test_dir/warning" "$plugin")
result=$?
check "$plugin loads the unified completion and original aliases" \
test "$result:$output" = '0:loaded'
check "$plugin explains how to migrate" \
test "$(command cat -- "$test_dir/warning")" != ''
done
print -r -- "$tests tests, $failures failures"
(( failures == 0 ))
+7 -12
View File
@@ -1,18 +1,13 @@
# Laravel 4 plugin
This plugin adds some aliases for common [Laravel 4](https://laravel.com/docs/4.2) commands.
To use it, add `laravel4` to the plugins array in your zshrc file:
This plugin is deprecated. Use the [laravel plugin](../laravel) instead:
```zsh
plugins=(... laravel4)
plugins=(... laravel)
```
## Aliases
| Alias | Command | Description |
|-----------|-----------------------------|-------------------------------------|
| la4 | `php artisan` | Main Artisan command |
| la4dump | `php artisan dump-autoload` | Regenerate framework autoload files |
| la4cache | `php artisan cache:clear` | Flush the application cache |
| la4routes | `php artisan routes` | List all registered routes |
This compatibility loader sources `laravel` for shared aliases and completion,
then adds the original `la4`, `la4dump`, `la4cache`, and `la4routes` aliases.
These version-specific aliases are only available while `laravel4` is enabled.
When switching to `laravel` alone, use `artisan` or the shared aliases, or define
any shortcuts you still need in your own configuration.
+12 -17
View File
@@ -1,20 +1,15 @@
# Laravel4 basic command completion
_laravel4_get_command_list () {
php artisan --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }'
}
print -Pru2 -- \
'%F{yellow}[oh-my-zsh] The %Blaravel4%b plugin is deprecated.' \
'Use %Blaravel%b instead.%f'
_laravel4 () {
if [ -f artisan ]; then
compadd `_laravel4_get_command_list`
fi
}
source "${0:A:h:h}/laravel/laravel.plugin.zsh"
compdef _laravel4 artisan
compdef _laravel4 la4
# Keep compatibility aliases scoped to users of this legacy plugin.
zstyle -s ':omz:plugins:laravel' php _omz_laravel_php || _omz_laravel_php=php
alias la4="$_omz_laravel_php artisan"
alias la4dump="$_omz_laravel_php artisan dump-autoload"
alias la4cache="$_omz_laravel_php artisan cache:clear"
alias la4routes="$_omz_laravel_php artisan routes"
unset _omz_laravel_php
#Alias
alias la4='php artisan'
alias la4dump='php artisan dump-autoload'
alias la4cache='php artisan cache:clear'
alias la4routes='php artisan routes'
compdef _artisan la4
+7 -12
View File
@@ -1,18 +1,13 @@
# Laravel 5 plugin
This plugin adds some aliases for common [Laravel 5](https://laravel.com/docs) commands.
To use it, add `laravel5` to the plugins array in your zshrc file:
This plugin is deprecated. Use the [laravel plugin](../laravel) instead:
```zsh
plugins=(... laravel5)
plugins=(... laravel)
```
## Aliases
| Alias | Command | Description |
|-----------|------------------------------|----------------------------------------------------|
| la5 | `php artisan` | Main Artisan command |
| la5cache | `php artisan cache:clear` | Flush the application cache |
| la5routes | `php artisan route:list` | List all registered routes |
| la5vendor | `php artisan vendor:publish` | Publish any publishable assets from vendor package |
This compatibility loader sources `laravel` for shared aliases and completion,
then adds the original `la5`, `la5cache`, `la5routes`, and `la5vendor` aliases.
These version-specific aliases are only available while `laravel5` is enabled.
When switching to `laravel` alone, use `artisan` or the shared aliases, or define
any shortcuts you still need in your own configuration.
+12 -16
View File
@@ -1,19 +1,15 @@
# Alias
alias la5='php artisan'
alias la5cache='php artisan cache:clear'
alias la5routes='php artisan route:list'
alias la5vendor='php artisan vendor:publish'
print -Pru2 -- \
'%F{yellow}[oh-my-zsh] The %Blaravel5%b plugin is deprecated.' \
'Use %Blaravel%b instead.%f'
# Laravel5 basic command completion
_laravel5_get_command_list () {
php artisan --raw --no-ansi list | sed "s/[[:space:]].*//g"
}
source "${0:A:h:h}/laravel/laravel.plugin.zsh"
_laravel5 () {
if [[ -f artisan ]]; then
compadd $(_laravel5_get_command_list)
fi
}
# Keep compatibility aliases scoped to users of this legacy plugin.
zstyle -s ':omz:plugins:laravel' php _omz_laravel_php || _omz_laravel_php=php
alias la5="$_omz_laravel_php artisan"
alias la5cache="$_omz_laravel_php artisan cache:clear"
alias la5routes="$_omz_laravel_php artisan route:list"
alias la5vendor="$_omz_laravel_php artisan vendor:publish"
unset _omz_laravel_php
compdef _laravel5 artisan
compdef _laravel5 la5
compdef _artisan la5
+15 -12
View File
@@ -72,11 +72,6 @@ EOF
return 0
;;
shuf|shuff|shuffle)
# The shuffle property of current playlist can't be changed in iTunes 12,
# so this workaround uses AppleScript to simulate user input instead.
# Defaults to toggling when no options are given.
# The toggle option depends on the shuffle button being visible in the Now playing area.
# On and off use the menu bar items.
local state=$1
if [[ -n "$state" && "$state" != (on|off|toggle) ]]; then
@@ -85,16 +80,24 @@ EOF
fi
case "$state" in
on|off)
# Inspired by: https://stackoverflow.com/a/14675583
osascript >/dev/null 2>&1 <<EOF
tell application "System Events" to perform action "AXPress" of (menu item "${state}" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar item "Controls" of menu bar 1 of application process "iTunes" )
EOF
# Inspired by: https://stackoverflow.com/a/43942013/2396771
on)
osascript -e "tell application \"$APP_NAME\" to set shuffle enabled to true";
return 0
;;
off)
osascript -e "tell application \"$APP_NAME\" to set shuffle enabled to false";
return 0
;;
toggle|*)
osascript >/dev/null 2>&1 <<EOF
tell application "System Events" to perform action "AXPress" of (button 2 of process "iTunes"'s window "iTunes"'s scroll area 1)
osascript 2>/dev/null <<EOF
tell application "$APP_NAME"
if shuffle enabled then
set shuffle enabled to false
else
set shuffle enabled to true
end
end tell
EOF
return 0
;;
Loaded 100 of 158 files, more files were not shown because too many files have changed in this diff. Show more