Compare commits

...
Author SHA1 Message Date
8ba0ed4ede fix(fossil): improve placement of the fossil prompt info (#11139)
* Better placement of Fossil prompt info

Instead of blindly tacking `$fossil_prompt_info` onto the end of the
prompt string and making assumptions about whether `$PROMPT` or
`$RPROMPT` are in use here, assume the user is using a theme that puts
`$git_prompt_info` in there somewhere and inject our info immediately
afterward.  The theme creator decided that's a good place for Git prompt
info, so that's a good place for Fossil prompt info, too.

This also replaces some calls out to `grep` with internal Zsh string
manipulation for less overhead.

* fix(fossil): fall back to RPROMPT when the theme has no git_prompt_info

Keeps today's behaviour for themes without git_prompt_info, and re-checks on
each prompt in case the theme rebuilds its prompt.

---------

Co-authored-by: Robby Russell <robby@planetargon.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 19:30:07 +01:00
10ffeda6b5 fix(fossil)!: reduce prompt spacing (#11141)
BREAKING CHANGE: the fossil plugin now ships a prompt function that
removes spacing between segments. Spaces can always be added by
changing the setting variables. Check out the README for details.

* Reduced unnecessary space in Fossil plugin prompt

The prior version was way too opinionated, adding space between each element of the prompt string, unlike common Git prompt strings.  If the user wants more space, they can override our public variables to suit.  The inverse argument doesn't hold: it's easy to add space to existing variables, but not as easy to remove it after the fact.

As part of this, changed the branch name from red to blue (matching the preceding part of the prompt) so the red "X" added to indicate a dirty branch doesn't get lost in the branch name.

* fix(fossil): keep the branch name red
* Document fossil prompt settings

---------

Co-authored-by: Robby Russell <robby@planetargon.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Marc Cornellà <marc@mcornella.com>
2026-12-02 19:27:35 +01:00
Robby Russell 9ffcf687ef chore(macos): drop stale MiniPlayer note from music shuffle help (#14286)
The note described the old System Events button click, which #13365
replaces with Music's `shuffle enabled` property.
2026-12-02 18:57:58 +01:00
Robby RussellandMonson Shao 65badb0e63 feat(init): keep the zcompdump file in $ZSH_CACHE_DIR (#14289)
The default dump file moves from `${ZDOTDIR:-$HOME}` to `$ZSH_CACHE_DIR`,
so it no longer clutters the home directory. `ZSH_COMPDUMP` still
overrides the location, and `omz reload` already deletes the dump
wherever it lives. Diagnostics list dump files in both places.

The first shell after updating rebuilds the dump once. Old
`~/.zcompdump-*` files are left in place and can be deleted.

Closes #13406

Co-authored-by: Monson Shao <holymonson@gmail.com>
2026-12-02 18:54:14 +01:00
8da770db74 ci: add jactionlint and address workflow findings (#14304)
* ci: add jactionlint and address workflow findings

* ci(installer): pin vercel 66.6.0 and group major updates

68.0.0 was released the same day it was pinned, which skips the
seven-day cooldown this branch adds. Vercel ships a major version
about weekly, so majors join the npm group to keep it to one PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: lock workflow action dependencies

Add .github/workflows/actions.lock, generated by gh actions-lock. It
records the commit for every action the workflows use, including
actions called by other actions. Workflows now reference release
tags and the lockfile holds the commit that runs.

Verify the lockfile in the Workflow lint job so a workflow change
that skips regenerating it fails the pull request.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* ci: lock and time-limit the alias collision job

The job arrived from master in #10859 after this branch was cut, so
it had no timeout and its setup-python version was missing from the
lockfile.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: mcornella <1441704+mcornella@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-12-02 18:52:53 +01:00
Kaustubh PhatakandClaude Opus 5.5 ccf23f54ea feat(kubectl): add kgnow alias to watch nodes (#14321)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 06:24:59 -08:00
Shreyansh Jain 81a38b0075 fix(systemadmin): use the log file passed to the access log functions (#14320) 2026-12-02 06:04:37 -08:00
Divya ff3767f564 fix(lib): pad omz_urlencode escapes to two hex digits (#14319) 2026-12-02 06:02:34 -08:00
Sanjay Doppalapudi 3cf60fdc97 docs(archlinux): match the README to the upgrade aliases (#14322) 2026-12-02 06:01:47 -08:00
Yahya Kayaal f8277e5043 fix(localstack): require message file argument in sqs-send (#14315) 2026-11-29 09:09:43 -08:00
dependabot[bot] ec7622cfbc chore(deps): bump the py-minor group (#14317)
Bumps the py-minor group in /.github/workflows/dependencies with 4 updates: [certifi](https://github.com/certifi/python-certifi), [charset-normalizer](https://github.com/jawah/charset_normalizer), [pyyaml](https://github.com/yaml/pyyaml) and [semver](https://github.com/python-semver/python-semver).


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

Updates `charset-normalizer` from 3.5.2 to 3.5.3
- [Release notes](https://github.com/jawah/charset_normalizer/releases)
- [Changelog](https://github.com/jawah/charset_normalizer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jawah/charset_normalizer/compare/3.5.2...3.5.3)

Updates `pyyaml` from 6.0.3 to 6.0.4
- [Release notes](https://github.com/yaml/pyyaml/releases)
- [Changelog](https://github.com/yaml/pyyaml/blob/6.0.4/CHANGES)
- [Commits](https://github.com/yaml/pyyaml/compare/6.0.3...6.0.4)

Updates `semver` from 3.1.2 to 3.1.3
- [Release notes](https://github.com/python-semver/python-semver/releases)
- [Changelog](https://github.com/python-semver/python-semver/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/python-semver/python-semver/compare/3.1.2...3.1.3)

---
updated-dependencies:
- dependency-name: certifi
  dependency-version: 2026.11.20
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: py-minor
- dependency-name: charset-normalizer
  dependency-version: 3.5.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: py-minor
- dependency-name: pyyaml
  dependency-version: 6.0.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: py-minor
- dependency-name: semver
  dependency-version: 3.1.3
  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-29 09:08:31 -08:00
dependabot[bot] e0bc2c99c4 chore(deps): bump the gha-minor group with 2 updates (#14316)
Bumps the gha-minor group with 2 updates: [actions/setup-python](https://github.com/actions/setup-python) and [github/codeql-action/upload-sarif](https://github.com/github/codeql-action).


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/v7...6d4fd22b20465ccc0f7354476588e8df7c9ca0e0)

Updates `github/codeql-action/upload-sarif` from 4.39.3 to 4.39.5
- [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/33d7b85da1a04171e211befe2c739303b9a4c066...915412ff23e8b7659517e607487dbeae018f2934)

---
updated-dependencies:
- 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.5
  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-29 09:04:57 -08:00
YourNeelsOG e0fb74a8e2 fix(vi-mode): restore cursor shape when leaving visual mode (#14313)
Fixes #11705
2026-11-28 13:55:09 -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
42 changed files with 6473 additions and 76 deletions

No files matched your search

+20
View File
@@ -6,6 +6,8 @@ updates:
interval: "weekly" interval: "weekly"
day: "sunday" day: "sunday"
labels: [] labels: []
cooldown:
default-days: 7
groups: groups:
gha-minor: gha-minor:
patterns: patterns:
@@ -19,6 +21,8 @@ updates:
interval: "weekly" interval: "weekly"
day: "sunday" day: "sunday"
labels: [] labels: []
cooldown:
default-days: 7
groups: groups:
py-minor: py-minor:
patterns: patterns:
@@ -26,3 +30,19 @@ updates:
update-types: update-types:
- minor - minor
- patch - patch
- package-ecosystem: npm
directory: "/.github/workflows/installer"
schedule:
interval: "weekly"
day: "sunday"
labels: []
cooldown:
default-days: 7
groups:
npm-minor:
patterns:
- "*"
update-types:
- major
- minor
- patch
+66
View File
@@ -0,0 +1,66 @@
# Workflow checks
The `Workflow lint` workflow runs jactionlint on pull requests and pushes to
`master`. It checks workflows and Dependabot configuration with the default
profile, including ShellCheck for inline shell scripts. It runs without online
checks or publishing credentials.
To run the same checks locally, install jactionlint 2.6.0 and ShellCheck, then run
from the repository root:
```sh
jactionlint --profile=default --no-online
```
Keep the local jactionlint version aligned with the pinned action in `lint.yml`.
There is no baseline: new findings fail the check. Any rule exception should be
limited to the relevant line and explain why it is needed.
## Action lockfile
`actions.lock` records the commit for every action the workflows use, including
actions called by other actions. Workflows reference release tags; the lockfile
holds the commit that runs. Do not edit it by hand.
After adding a workflow or changing any `uses:` line, regenerate it with the
[`gh actions-lock`](https://github.com/github/gh-actions-lock) extension and
commit the result:
```sh
gh extension install github/gh-actions-lock
gh actions-lock
```
Dependabot updates the lockfile entry in the same pull request when it bumps an
action.
The `Workflow lint` workflow verifies the lockfile on every pull request and
fails when it does not match the workflows.
## Project tracking
`project.yml` intentionally uses `pull_request_target` so the GitHub App can add
fork contributions to the project board. It must not check out or execute PR
code. Project IDs are validated before passing them through step outputs, and
PR-derived plugin/theme names are restricted to letters, digits, dots, underscores
and hyphens.
The App tokens request explicit permissions: project tracking needs organization
projects write access and issues/pull requests read access; dependency updates
need contents read access and issues/pull requests write access. Dependency pushes
use the job's separate `GITHUB_TOKEN` with contents write access.
## Installer deployment
The Vercel CLI is pinned in `installer/package.json` and `installer/package-lock.json`.
Dependabot checks this dependency weekly, with a seven-day cooldown for version
updates, like the other configured ecosystems. Deployment installs the lockfile
with `npm ci --ignore-scripts`; `.vercelignore` uploads only `install.sh`.
After changing the CLI version, update its lockfile and verify the CLI locally:
```sh
npm install --package-lock-only --ignore-scripts --prefix .github/workflows/installer
npm ci --ignore-scripts --prefix .github/workflows/installer
.github/workflows/installer/node_modules/.bin/vercel --version
```
+90
View File
@@ -0,0 +1,90 @@
# This file is machine-generated by `gh actions-lock`.
# Do not edit by hand; run `gh actions-lock` to update.
# Docs: https://gh.io/actions-lockfile
version: 'v0.0.3'
workflows:
'.github/workflows/dependencies.yml':
- 'actions/checkout@v7.0.1'
- 'actions/create-github-app-token@v3.4.0'
- 'actions/setup-python@v7.1.0'
- 'step-security/harden-runner@v2.23.0'
'.github/workflows/installer.yml':
- 'actions/checkout@v7.0.1'
- 'actions/setup-node@v7.1.0'
- 'step-security/harden-runner@v2.23.0'
'.github/workflows/lint.yml':
- 'actions/checkout@v7.0.1'
- 'github/gh-actions-lock@verify/v0.5.1'
- 'jdx/jactionlint@v2.6.0'
- 'step-security/harden-runner@v2.23.0'
'.github/workflows/main.yml':
- 'actions/checkout@v7.0.1'
- 'actions/setup-python@v7.1.0'
- 'step-security/harden-runner@v2.23.0'
'.github/workflows/project.yml':
- 'actions/create-github-app-token@v3.4.0'
- 'step-security/harden-runner@v2.23.0'
'.github/workflows/scorecard.yml':
- 'actions/checkout@v7.0.1'
- 'actions/upload-artifact@v7.0.2'
- 'github/codeql-action@v4.39.5'
- 'ossf/scorecard-action@v2.6.0'
- 'step-security/harden-runner@v2.23.0'
dependencies:
'actions/checkout@v7.0.1':
ref: 'v7.0.1'
commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
owner_id: 44036562
repo_id: 197814629
'actions/create-github-app-token@v3.4.0':
ref: 'v3.4.0'
commit: 'sha1-f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc'
owner_id: 44036562
repo_id: 642580244
'actions/setup-node@v7.1.0':
ref: 'v7.1.0'
commit: 'sha1-949feb2413d6458794dcd2491c4babbbce0c15c1'
owner_id: 44036562
repo_id: 189476904
'actions/setup-python@v7.1.0':
ref: 'v7.1.0'
commit: 'sha1-6d4fd22b20465ccc0f7354476588e8df7c9ca0e0'
owner_id: 44036562
repo_id: 192625525
'actions/upload-artifact@v7.0.2':
ref: 'v7.0.2'
commit: 'sha1-cf430e030ddbb5b0abf93d22962f4752f3646cd9'
owner_id: 44036562
repo_id: 192625955
'github/codeql-action@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2':
ref: 'v4.38.2'
commit: 'sha1-2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2'
owner_id: 9919
repo_id: 259445878
'github/codeql-action@v4.39.5':
ref: 'v4.39.5'
commit: 'sha1-915412ff23e8b7659517e607487dbeae018f2934'
owner_id: 9919
repo_id: 259445878
'github/gh-actions-lock@verify/v0.5.1':
ref: 'verify/v0.5.1'
commit: 'sha1-5fa07d19c267d19e29f4341f10fdf7f516375038'
owner_id: 9919
repo_id: 1217640442
'jdx/jactionlint@v2.6.0':
ref: 'v2.6.0'
commit: 'sha1-72c00452809bcca05b8bc12acdcf15dd7a9c1c5e'
owner_id: 216188
repo_id: 1404951382
uses:
- 'github/codeql-action@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2'
'ossf/scorecard-action@v2.6.0':
ref: 'v2.6.0'
commit: 'sha1-23f22cd43608bae7a1f1fa2603d7314dee9538a5'
owner_id: 67707773
repo_id: 421101922
'step-security/harden-runner@v2.23.0':
ref: 'v2.23.0'
commit: 'sha1-aebdcf6156ab6691adf63218240e476564a1ed4c'
owner_id: 88700172
repo_id: 422287306
@@ -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
+8 -4
View File
@@ -11,27 +11,31 @@ jobs:
check: check:
name: Check for updates name: Check for updates
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
permissions: permissions:
contents: write # this is needed to push commits and branches contents: write # this is needed to push commits and branches
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0 uses: step-security/harden-runner@v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: Checkout - name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 uses: actions/checkout@v7.0.1
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Authenticate as @ohmyzsh - name: Authenticate as @ohmyzsh
id: generate-token id: generate-token
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 uses: actions/create-github-app-token@v3.4.0
with: with:
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }} client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }} private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
permission-contents: read
permission-issues: write
permission-pull-requests: write
- name: Setup Python - name: Setup Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 uses: actions/setup-python@v7.1.0
with: with:
python-version: "3.12" python-version: "3.12"
cache: "pip" cache: "pip"
@@ -1,7 +1,7 @@
certifi==2026.10.23 certifi==2026.11.20
charset-normalizer==3.5.2 charset-normalizer==3.5.3
idna==3.20 idna==3.20
PyYAML==6.0.3 PyYAML==6.0.4
requests==2.34.2 requests==2.34.2
semver==3.1.2 semver==3.1.3
urllib3==2.8.0 urllib3==2.8.0
+16 -6
View File
@@ -19,6 +19,7 @@ jobs:
name: Test installer name: Test installer
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy: strategy:
matrix: matrix:
os: os:
@@ -26,12 +27,12 @@ jobs:
- macos-latest - macos-latest
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0 uses: step-security/harden-runner@v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: Set up git repository - name: Set up git repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 uses: actions/checkout@v7.0.1
- name: Install zsh - name: Install zsh
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: sudo apt-get update; sudo apt-get install zsh run: sudo apt-get update; sudo apt-get install zsh
@@ -42,19 +43,28 @@ jobs:
name: Deploy installer in install.ohmyz.sh name: Deploy installer in install.ohmyz.sh
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15
environment: vercel environment: vercel
needs: needs:
- test - test
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0 uses: step-security/harden-runner@v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: Checkout - name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@v7.1.0
with:
node-version: "24"
package-manager-cache: false
- name: Install Vercel CLI - name: Install Vercel CLI
run: npm install -g vercel working-directory: .github/workflows/installer
run: npm ci --ignore-scripts --no-audit --no-fund
- name: Setup project and deploy - name: Setup project and deploy
env: env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
@@ -63,4 +73,4 @@ jobs:
run: | run: |
cp tools/install.sh .github/workflows/installer/install.sh cp tools/install.sh .github/workflows/installer/install.sh
cd .github/workflows/installer cd .github/workflows/installer
vc deploy --prod -t "$VERCEL_TOKEN" ./node_modules/.bin/vercel deploy --prod -t "$VERCEL_TOKEN"
+1
View File
@@ -1 +1,2 @@
install.sh install.sh
node_modules/
File diff suppressed because it is too large. Load diff
+7
View File
@@ -0,0 +1,7 @@
{
"name": "ohmyzsh-installer-deploy",
"private": true,
"devDependencies": {
"vercel": "66.6.0"
}
}
+35
View File
@@ -0,0 +1,35 @@
name: Workflow lint
on:
pull_request:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
jactionlint:
name: Lint GitHub Actions
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@v2.23.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- name: Lint workflows and Dependabot configuration
uses: jdx/jactionlint@v2.6.0
with:
profile: default
online: "false"
- name: Verify action lockfile
uses: github/gh-actions-lock@verify/v0.5.1
+32 -2
View File
@@ -21,15 +21,16 @@ jobs:
tests: tests:
name: Run tests name: Run tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0 uses: step-security/harden-runner@v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: Set up git repository - name: Set up git repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 uses: actions/checkout@v7.0.1
- name: Install zsh - name: Install zsh
run: sudo apt-get update; sudo apt-get install zsh run: sudo apt-get update; sudo apt-get install zsh
- name: Check syntax - name: Check syntax
@@ -41,3 +42,32 @@ jobs:
./themes/*.zsh-theme; do ./themes/*.zsh-theme; do
zsh -n "$file" || return 1 zsh -n "$file" || return 1
done done
collisions:
name: Check alias collisions
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Set up git repository
uses: actions/checkout@v7.0.1
- name: Set up Python
uses: actions/setup-python@v7.1.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@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
+43 -11
View File
@@ -2,6 +2,8 @@ name: Project tracking
on: on:
issues: issues:
types: [opened, reopened] types: [opened, reopened]
# Board updates need an App token for fork PRs; no PR code is checked out or run.
# jactionlint ignore=dangerous-triggers
pull_request_target: pull_request_target:
types: [opened, reopened, synchronize] types: [opened, reopened, synchronize]
@@ -14,25 +16,35 @@ jobs:
add-to-project: add-to-project:
name: Add to project name: Add to project
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
shell: bash
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0 uses: step-security/harden-runner@v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: Authenticate as @ohmyzsh - name: Authenticate as @ohmyzsh
id: generate-token id: generate-token
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 uses: actions/create-github-app-token@v3.4.0
with: with:
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }} client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }} private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
permission-organization-projects: write
permission-issues: read
permission-pull-requests: read
- name: Read project data - name: Read project data
id: project
env: env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }} GH_TOKEN: ${{ steps.generate-token.outputs.token }}
ORGANIZATION: ohmyzsh ORGANIZATION: ohmyzsh
PROJECT_NUMBER: "1" PROJECT_NUMBER: "1"
run: | run: |
# Get Project data # Get Project data
# GraphQL variables must reach GitHub literally.
# shellcheck disable=SC2016
gh api graphql -f query=' gh api graphql -f query='
query($org: String!, $number: Int!) { query($org: String!, $number: Int!) {
organization(login: $org){ organization(login: $org){
@@ -48,19 +60,29 @@ jobs:
} }
} }
} }
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json }' -f org="$ORGANIZATION" -F number="$PROJECT_NUMBER" > project_data.json
# Parse project data # Parse project data
cat >> "$GITHUB_ENV" <<EOF PROJECT_ID=$(jq -er '.data.organization.projectV2.id' project_data.json)
PROJECT_ID=$(jq '.data.organization.projectV2.id' project_data.json) PLUGIN_FIELD_ID=$(jq -er '.data.organization.projectV2.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json)
PLUGIN_FIELD_ID=$(jq '.data.organization.projectV2.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json) THEME_FIELD_ID=$(jq -er '.data.organization.projectV2.fields.nodes[] | select(.name == "Theme") | .id' project_data.json)
THEME_FIELD_ID=$(jq '.data.organization.projectV2.fields.nodes[] | select(.name == "Theme") | .id' project_data.json) for id in "$PROJECT_ID" "$PLUGIN_FIELD_ID" "$THEME_FIELD_ID"; do
EOF [[ "$id" =~ ^[A-Za-z0-9_=/+-]+$ ]] || exit 1
done
{
echo "PROJECT_ID=$PROJECT_ID"
echo "PLUGIN_FIELD_ID=$PLUGIN_FIELD_ID"
echo "THEME_FIELD_ID=$THEME_FIELD_ID"
} >> "$GITHUB_OUTPUT"
- name: Add to project - name: Add to project
id: item
env: env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }} GH_TOKEN: ${{ steps.generate-token.outputs.token }}
ISSUE_OR_PR_ID: ${{ github.event.issue.node_id || github.event.pull_request.node_id }} ISSUE_OR_PR_ID: ${{ github.event.issue.node_id || github.event.pull_request.node_id }}
PROJECT_ID: ${{ steps.project.outputs.PROJECT_ID }}
run: | run: |
# GraphQL variables must reach GitHub literally.
# shellcheck disable=SC2016
item_id="$(gh api graphql -f query=' item_id="$(gh api graphql -f query='
mutation($project: ID!, $content: ID!) { mutation($project: ID!, $content: ID!) {
addProjectV2ItemById(input: {projectId: $project, contentId: $content}) { addProjectV2ItemById(input: {projectId: $project, contentId: $content}) {
@@ -69,10 +91,12 @@ jobs:
} }
} }
} }
' -f project="$PROJECT_ID" -f content="$ISSUE_OR_PR_ID" --jq '.data.addProjectV2ItemById.item.id')" ' -f project="$PROJECT_ID" -f content="$ISSUE_OR_PR_ID" --jq '.data.addProjectV2ItemById.item.id // error("missing project item ID")')"
echo "ITEM_ID=$item_id" >> $GITHUB_ENV [[ "$item_id" =~ ^[A-Za-z0-9_=/+-]+$ ]] || exit 1
echo "ITEM_ID=$item_id" >> "$GITHUB_OUTPUT"
- name: Classify Pull Request - name: Classify Pull Request
id: classify
if: github.event_name == 'pull_request_target' if: github.event_name == 'pull_request_target'
env: env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }} GH_TOKEN: ${{ steps.generate-token.outputs.token }}
@@ -109,12 +133,20 @@ jobs:
print "THEME=" theme print "THEME=" theme
} }
} }
' >> "$GITHUB_ENV" ' >> "$GITHUB_OUTPUT"
- name: Fill Pull Request fields in project - name: Fill Pull Request fields in project
if: github.event_name == 'pull_request_target' if: github.event_name == 'pull_request_target'
env: env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }} GH_TOKEN: ${{ steps.generate-token.outputs.token }}
PROJECT_ID: ${{ steps.project.outputs.PROJECT_ID }}
ITEM_ID: ${{ steps.item.outputs.ITEM_ID }}
PLUGIN_FIELD_ID: ${{ steps.project.outputs.PLUGIN_FIELD_ID }}
PLUGIN: ${{ steps.classify.outputs.PLUGIN }}
THEME_FIELD_ID: ${{ steps.project.outputs.THEME_FIELD_ID }}
THEME: ${{ steps.classify.outputs.THEME }}
run: | run: |
# GraphQL variables must reach GitHub literally.
# shellcheck disable=SC2016
gh api graphql -f query=' gh api graphql -f query='
mutation ( mutation (
$project: ID! $project: ID!
+12 -7
View File
@@ -14,13 +14,18 @@ on:
push: push:
branches: ["master"] branches: ["master"]
# Declare default permissions as read only. concurrency:
permissions: read-all group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Permissions are granted only to the analysis job.
permissions: {}
jobs: jobs:
analysis: analysis:
name: Scorecard analysis name: Scorecard analysis
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15
permissions: permissions:
# Needed to upload the results to code-scanning dashboard. # Needed to upload the results to code-scanning dashboard.
security-events: write security-events: write
@@ -36,30 +41,30 @@ jobs:
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0 uses: step-security/harden-runner@v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: "Checkout code" - name: "Checkout code"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 uses: actions/checkout@v7.0.1
with: with:
persist-credentials: false persist-credentials: false
- name: "Run analysis" - name: "Run analysis"
uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0 uses: ossf/scorecard-action@v2.6.0
with: with:
results_file: results.sarif results_file: results.sarif
results_format: sarif results_format: sarif
publish_results: true publish_results: true
- name: "Upload artifact" - name: "Upload artifact"
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 uses: actions/upload-artifact@v7.0.2
with: with:
name: SARIF file name: SARIF file
path: results.sarif path: results.sarif
retention-days: 5 retention-days: 5
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3 uses: github/codeql-action/upload-sarif@v4.39.5
with: with:
sarif_file: results.sarif sarif_file: results.sarif
+27
View File
@@ -16,6 +16,10 @@
# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/ # - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
# - win32yank (Windows) # - win32yank (Windows)
# - tmux (if $TMUX is set) # - 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. # Defines two functions, clipcopy and clippaste, based on the detected platform.
## ##
@@ -48,6 +52,22 @@
# # Paste to a file # # Paste to a file
# clippaste > file.txt # 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() { function detect-clipboard() {
emulate -L zsh emulate -L zsh
@@ -87,6 +107,9 @@ function detect-clipboard() {
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
function clipcopy() { tmux load-buffer -w "${1:--}"; } function clipcopy() { tmux load-buffer -w "${1:--}"; }
function clippaste() { tmux save-buffer -; } function clippaste() { tmux save-buffer -; }
elif [[ "${ZSH_CLIPBOARD_OSC52:-}" != never ]] && _has_osc52_clipboard; then
function clipcopy() { _clipcopy_osc52 "$@"; }
function clippaste() { _clippaste_osc52; }
else else
function _retry_clipboard_detection_or_fail() { function _retry_clipboard_detection_or_fail() {
local clipcmd="${1}"; shift local clipcmd="${1}"; shift
@@ -101,6 +124,10 @@ function detect-clipboard() {
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; } function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
return 1 return 1
fi fi
if [[ "${ZSH_CLIPBOARD_OSC52:-}" == always ]] && _has_osc52_clipboard; then
function clipcopy() { _clipcopy_osc52 "$@"; }
fi
} }
function clipcopy clippaste { function clipcopy clippaste {
+4 -3
View File
@@ -237,9 +237,10 @@ function _omz_diag_dump_one_big_text() {
fi fi
builtin echo builtin echo
builtin echo "Zsh compdump files:" builtin echo "Zsh compdump files:"
local dumpfile dumpfiles local dumpfile
command ls -lad $zdotdir/.zcompdump* local -U dumpfiles
dumpfiles=( $zdotdir/.zcompdump*(N) ) dumpfiles=( $zdotdir/.zcompdump*(N) ${ZSH_COMPDUMP:h}/.zcompdump*(N) )
(( $#dumpfiles )) && command ls -lad $dumpfiles
if [[ $verbose -ge 2 ]]; then if [[ $verbose -ge 2 ]]; then
for dumpfile in $dumpfiles; do for dumpfile in $dumpfiles; do
_omz_diag_dump_echo_file_w_header $dumpfile _omz_diag_dump_echo_file_w_header $dumpfile
+1 -1
View File
@@ -231,7 +231,7 @@ function omz_urlencode() {
url_str+="$byte" url_str+="$byte"
else else
ord=$(( [##16] #byte )) ord=$(( [##16] #byte ))
url_str+="%$ord" url_str+="%${(l:2::0:)ord}"
fi fi
fi fi
done done
+11
View File
@@ -2,6 +2,8 @@
# P.C. Shyamshankar <sykora@lucentbeing.com> # P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ # Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
autoload -Uz is-at-least
typeset -AHg FX FG BG typeset -AHg FX FG BG
FX=( FX=(
@@ -18,7 +20,16 @@ FX=(
() { () {
setopt localoptions noksharrays setopt localoptions noksharrays
local -a codes fg bg local -a codes fg bg
local code
codes=({000..255}) 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%}" ) fg=( "%{"$'\e'"[38;5;"${^codes}"m%}" )
bg=( "%{"$'\e'"[48;5;"${^codes}"m%}" ) bg=( "%{"$'\e'"[48;5;"${^codes}"m%}" )
FG=( ${codes:^fg} ) FG=( ${codes:^fg} )
+1 -1
View File
@@ -128,7 +128,7 @@ fi
# Save the location of the current completion dump file. # Save the location of the current completion dump file.
if [[ -z "$ZSH_COMPDUMP" ]]; then if [[ -z "$ZSH_COMPDUMP" ]]; then
ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" ZSH_COMPDUMP="${ZSH_CACHE_DIR}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
fi fi
# Resolve the commit $ZSH is checked out at into $REPLY by reading the git # Resolve the commit $ZSH is checked out at into $REPLY by reading the git
+4 -4
View File
@@ -103,8 +103,8 @@ upgrades were available. Use `pacman -Que` instead.
| parep | `pacaur -Si` | Display information about a package in the repositories | | parep | `pacaur -Si` | Display information about a package in the repositories |
| pareps | `pacaur -Ss` | Search for packages in the repositories | | pareps | `pacaur -Ss` | Search for packages in the repositories |
| paupd | `pacaur -Sy` | Update and refresh local package, ABS and AUR databases | | paupd | `pacaur -Sy` | Update and refresh local package, ABS and AUR databases |
| paupg | `pacaur -Syua` | Sync with repositories before upgrading all packages (from AUR too) | | paupg | `pacaur -Syu` | Sync with repositories before upgrading all packages (from AUR too) |
| pasu | `pacaur -Syua --no-confirm` | Same as `paupg`, but without confirmation | | pasu | `pacaur -Syu --noconfirm` | Same as `paupg`, but without confirmation |
| upgrade[¹](#f1) | `pacaur -Syu` | Sync with repositories before upgrading packages | | upgrade[¹](#f1) | `pacaur -Syu` | Sync with repositories before upgrading packages |
#### Trizen #### Trizen
@@ -128,7 +128,7 @@ upgrades were available. Use `pacman -Que` instead.
| trreps | `trizen -Ss` | Search for packages in the repositories | | trreps | `trizen -Ss` | Search for packages in the repositories |
| trupd | `trizen -Sy` | Update and refresh local package, ABS and AUR databases | | trupd | `trizen -Sy` | Update and refresh local package, ABS and AUR databases |
| trupg | `trizen -Syua` | Sync with repositories before upgrading all packages (from AUR too) | | trupg | `trizen -Syua` | Sync with repositories before upgrading all packages (from AUR too) |
| trsu | `trizen -Syua --no-confirm` | Same as `trupg`, but without confirmation | | trsu | `trizen -Syua --noconfirm` | Same as `trupg`, but without confirmation |
| upgrade[¹](#f1) | `trizen -Syu` | Sync with repositories before upgrading packages | | upgrade[¹](#f1) | `trizen -Syu` | Sync with repositories before upgrading packages |
#### Yay #### Yay
@@ -152,7 +152,7 @@ upgrades were available. Use `pacman -Que` instead.
| yareps | `yay -Ss` | Search for packages in the repositories | | yareps | `yay -Ss` | Search for packages in the repositories |
| yaupd | `yay -Sy` | Update and refresh local package, ABS and AUR databases | | yaupd | `yay -Sy` | Update and refresh local package, ABS and AUR databases |
| yaupg | `yay -Syu` | Sync with repositories before upgrading packages | | yaupg | `yay -Syu` | Sync with repositories before upgrading packages |
| yasu | `yay -Syu --no-confirm` | Same as `yaupg`, but without confirmation | | yasu | `yay -Syu --noconfirm` | Same as `yaupg`, but without confirmation |
| upgrade[¹](#f1) | `yay -Syu` | Sync with repositories before upgrading packages | | upgrade[¹](#f1) | `yay -Syu` | Sync with repositories before upgrading packages |
--- ---
+1 -1
View File
@@ -59,7 +59,7 @@ ensures the `bdr` alias runs without warnings.
| `bsra` | `bsr --all` | Run all stopped services. | | `bsra` | `bsr --all` | Run all stopped services. |
| `bu` | `brew update` | Update brew and all installed formulae. | | `bu` | `brew update` | Update brew and all installed formulae. |
| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. | | `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. | | `bugbc` | `brew upgrade --greedy && brew cleanup` | Upgrade outdated formulae and casks (greedy), then run cleanup. |
| `bup` | `brew upgrade` | Upgrade outdated, unpinned brews. | | `bup` | `brew upgrade` | Upgrade outdated, unpinned brews. |
| `buz` | `brew uninstall --zap` | Remove all files associated with a cask. | | `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 bsra='bsr --all'
alias bu='brew update' alias bu='brew update'
alias bubo='brew update && brew outdated' alias bubo='brew update && brew outdated'
alias bubu='bubo && bup' alias bubu='bu && bup'
alias bubug='bubo && bugbc' alias bubug='bubo && bugbc'
alias bugbc='brew upgrade --greedy && brew cleanup' alias bugbc='brew upgrade --greedy && brew cleanup'
alias bup='brew upgrade' alias bup='brew upgrade'
+2
View File
@@ -49,6 +49,8 @@ plugins=(... extract)
| `tar.xz` | Tarball with lzma2 compression | | `tar.xz` | Tarball with lzma2 compression |
| `tar.zma` | Tarball with lzma compression | | `tar.zma` | Tarball with lzma compression |
| `tar.zst` | Tarball with zstd 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 | | `tbz` | Tarball with bzip compression |
| `tbz2` | Tarball with bzip2 compression | | `tbz2` | Tarball with bzip2 compression |
| `tgz` | Tarball with gzip compression | | `tgz` | Tarball with gzip compression |
+5
View File
@@ -97,6 +97,11 @@ EOF
&& tar --zstd -xvf "$full_path" \ && tar --zstd -xvf "$full_path" \
|| zstdcat "$full_path" | tar xvf - ;; || zstdcat "$full_path" | tar xvf - ;;
(*.tar) tar xvf "$full_path" ;; (*.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.lz) (( $+commands[lzip] )) && tar xvf "$full_path" ;;
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;; (*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;; (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
+24 -1
View File
@@ -1,7 +1,30 @@
## Fossil Plugin ## Fossil Plugin
This plugin adds completion support and prompt for fossil repositories. This plugin adds completion support and prompt for fossil repositories.
The prompt will display the current branch and status been dirty or clean.
To use it, add `fossil` to the plugins array in your .zshrc file:
```zsh
plugins=(... fossil)
``
This plugin provides a prompt function named `fossil_prompt_info` that
will display the current branch and if there are changes (dirty) or not (clean).
### Prompt segments
These variables control how the prompt function looks:
```
ZSH_THEME_FOSSIL_PROMPT_PREFIX="%{$fg_bold[blue]%}fossil:(%{$fg_bold[red]%}"
ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})"
ZSH_THEME_FOSSIL_PROMPT_DIRTY="%{$fg_bold[red]%}✖"
ZSH_THEME_FOSSIL_PROMPT_CLEAN="%{$fg_bold[green]%}✔"
```
You can override their values in your .zshrc file, anywhere after the
`source $ZSH/oh-my-zsh.sh` line.
### CONTRIBUTOR ### CONTRIBUTOR
- Jefferson González ([jgmdev](https://github.com/jgmdev)) - Jefferson González ([jgmdev](https://github.com/jgmdev))
+21 -13
View File
@@ -28,24 +28,32 @@ function fossil_prompt_info() {
printf ' %s%s%s%s%s' \ printf ' %s%s%s%s%s' \
"$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \ "$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \
"${branch:gs/%/%%}" \ "${branch:gs/%/%%}" \
"$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \
"$dirty" \ "$dirty" \
"$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \
"%{$reset_color%}" "%{$reset_color%}"
} }
function _fossil_prompt () { function _fossil_prompt () {
local current=`echo $PROMPT $RPROMPT | grep fossil` # Re-check each time, in case the theme rebuilds its prompt in precmd
if [ -z "$_FOSSIL_PROMPT" ] || [[ "$PROMPT$RPROMPT" != *fossil_prompt_info* ]]; then
if [ "$_FOSSIL_PROMPT" = "" -o "$current" = "" ]; then # Use substitutions to work out what other plugins and themes have
local _prompt=${PROMPT} # done ahead of us so we don't duplicate their work.
local _rprompt=${RPROMPT} #
# If $fossil_prompt_info isn't in the prompt strings already but we
local is_prompt=`echo $PROMPT | grep git` # can find $git_prompt_info, put it immediately afterward so that
# one or the other appears in the prompt. We're gambling that you
if [ "$is_prompt" = "" ]; then # aren't in a directory that's a checkout for both a Git repo and a
RPROMPT="$_rprompt"'$(fossil_prompt_info)' # Fossil repo.
else #
PROMPT="$_prompt"'$(fossil_prompt_info) ' # Otherwise, add it to the right prompt, as before.
if [ "${PROMPT/fossil_prompt_info//}" = "$PROMPT" ]; then
PROMPT="${PROMPT/git_prompt_info/git_prompt_info)\$(fossil_prompt_info}"
fi
if [ "${RPROMPT/fossil_prompt_info//}" = "$RPROMPT" ]; then
RPROMPT="${RPROMPT/git_prompt_info/git_prompt_info)\$(fossil_prompt_info}"
fi
if [[ "$PROMPT$RPROMPT" != *fossil_prompt_info* ]]; then
RPROMPT+='$(fossil_prompt_info)'
fi fi
_FOSSIL_PROMPT="1" _FOSSIL_PROMPT="1"
+2
View File
@@ -22,6 +22,7 @@ plugins=(... golang)
| gofx | `go fix` | Update packages to use a new API | | gofx | `go fix` | Update packages to use a new API |
| gog | `go get` | Downloads packages and then installs them to $GOPATH | | gog | `go get` | Downloads packages and then installs them to $GOPATH |
| goga | `go get ./...` | Installs all dependencies in current directory, recursively | | 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 | | goi | `go install` | Compiles and installs packages to $GOPATH |
| gol | `go list` | Lists Go packages | | gol | `go list` | Lists Go packages |
| gom | `go mod` | Access to operations on modules | | gom | `go mod` | Access to operations on modules |
@@ -54,3 +55,4 @@ changes your prompt to:
``` ```
~/go/project$ ▋ 1.22.3 ~/go/project$ ▋ 1.22.3
``` ```
+1
View File
@@ -19,6 +19,7 @@ alias gofa='go fmt ./...'
alias gofx='go fix' alias gofx='go fix'
alias gog='go get' alias gog='go get'
alias goga='go get ./...' alias goga='go get ./...'
alias goge='go generate'
alias goi='go install' alias goi='go install'
alias gol='go list' alias gol='go list'
alias gom='go mod' alias gom='go mod'
+2
View File
@@ -60,6 +60,7 @@ plugins=(... kubectl)
| | | **Namespace management** | | | | **Namespace management** |
| kgns | `kubectl get namespaces` | List the current namespaces in a cluster | | kgns | `kubectl get namespaces` | List the current namespaces in a cluster |
| kcn | `kubectl config set-context --current --namespace` | Change current namespace | | 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 | | kens | `kubectl edit namespace` | Edit namespace resource from the default editor |
| kdns | `kubectl describe namespace` | Describe namespace resource in detail | | kdns | `kubectl describe namespace` | Describe namespace resource in detail |
| kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace | | kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace |
@@ -112,6 +113,7 @@ plugins=(... kubectl)
| | | **Node management** | | | | **Node management** |
| kgno | `kubectl get nodes` | List the nodes in ps output format | | kgno | `kubectl get nodes` | List the nodes in ps output format |
| kgnosl | `kubectl get nodes --show-labels` | List the nodes in ps output format with labels | | kgnosl | `kubectl get nodes --show-labels` | List the nodes in ps output format with labels |
| kgnow | `kubectl get nodes --watch` | List the nodes, then watch for status changes (e.g. Ready/NotReady, cordoned, added or removed) |
| keno | `kubectl edit node` | Edit nodes resource from the default editor | | keno | `kubectl edit node` | Edit nodes resource from the default editor |
| kdno | `kubectl describe node` | Describe node resource in detail | | kdno | `kubectl describe node` | Describe node resource in detail |
| kdelno | `kubectl delete node` | Delete the node | | kdelno | `kubectl delete node` | Delete the node |
+3 -1
View File
@@ -31,7 +31,7 @@ alias kapk='kubectl apply -k'
# Drop into an interactive terminal on a container # Drop into an interactive terminal on a container
alias keti='kubectl exec -t -i' 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 kcuc='kubectl config use-context'
alias kcsc='kubectl config set-context' alias kcsc='kubectl config set-context'
alias kcdc='kubectl config delete-context' alias kcdc='kubectl config delete-context'
@@ -83,6 +83,7 @@ alias kens='kubectl edit namespace'
alias kdns='kubectl describe namespace' alias kdns='kubectl describe namespace'
alias kdelns='kubectl delete namespace' alias kdelns='kubectl delete namespace'
alias kcn='kubectl config set-context --current --namespace' alias kcn='kubectl config set-context --current --namespace'
alias kcgetns="kubectl config view --minify -o 'jsonpath={.contexts[0].context.namespace}'"
# ConfigMap management # ConfigMap management
alias kgcm='kubectl get configmaps' alias kgcm='kubectl get configmaps'
@@ -156,6 +157,7 @@ alias kcp='kubectl cp'
# Node Management # Node Management
alias kgno='kubectl get nodes' alias kgno='kubectl get nodes'
alias kgnosl='kubectl get nodes --show-labels' alias kgnosl='kubectl get nodes --show-labels'
alias kgnow='kubectl get nodes --watch'
alias keno='kubectl edit node' alias keno='kubectl edit node'
alias kdno='kubectl describe node' alias kdno='kubectl describe node'
alias kdelno='kubectl delete node' alias kdelno='kubectl delete node'
+3 -3
View File
@@ -28,10 +28,10 @@ lsk() {
# Example # Example
# sqs-send user user.json # sqs-send user user.json
sqs-send(){ sqs-send(){
if [ -z "$1" ]; then if [ -z "$1" ] || [ -z "$2" ]; then
echo "Use: sqs-send <queue> <payload>" echo "Use: sqs-send <queue> <payload>" >&2
return 1 return 1
fi fi
curl -X POST "http://localhost:4566/000000000000/$1" -d "Action=SendMessage" -d "MessageBody=$(cat $2)" curl -X POST "http://localhost:4566/000000000000/$1" -d "Action=SendMessage" -d "MessageBody=$(cat "$2")"
} }
+1 -1
View File
@@ -110,7 +110,7 @@ EOF
echo "\tlaunch|play|pause|stop|rewind|resume|quit" echo "\tlaunch|play|pause|stop|rewind|resume|quit"
echo "\tmute|unmute\tMute or unmute $APP_NAME" echo "\tmute|unmute\tMute or unmute $APP_NAME"
echo "\tnext|previous\tPlay next or previous track" echo "\tnext|previous\tPlay next or previous track"
echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer." echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle."
echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume." echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume."
echo "\tplaying|status\tShow what song is currently playing in Music." echo "\tplaying|status\tShow what song is currently playing in Music."
echo "\tplaylist [playlist name]\t Play specific playlist" echo "\tplaylist [playlist name]\t Play specific playlist"
+9
View File
@@ -46,6 +46,7 @@ You can set these variables in your `.zshrc` file, before Oh My Zsh is sourced.
For example: For example:
```sh ```sh
PYTHON_AUTO_VRUN=true
PYTHON_VENV_NAME=".venv" PYTHON_VENV_NAME=".venv"
PYTHON_VENV_NAMES=($PYTHON_VENV_NAME venv) PYTHON_VENV_NAMES=($PYTHON_VENV_NAME venv)
... ...
@@ -54,6 +55,14 @@ source "$ZSH/oh-my-zsh.sh"
``` ```
## `$PYTHON_AUTO_VRUN`
**Default**: `false`.
Enable automatic activation of virtual environments when entering a directory containing
`<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it.
Set to `true` to enable this feature.
## `$PYTHON_VENV_NAME` ## `$PYTHON_VENV_NAME`
**Default**: `venv`. **Default**: `venv`.
+8 -8
View File
@@ -153,34 +153,34 @@ function port_pro() {
# top10 of gain access to the ip address # top10 of gain access to the ip address
function accessip10() { function accessip10() {
awk '{counts[$(11)]+=1}; END {for(url in counts) print counts[url], url}' "$(retlog)" awk '{counts[$(11)]+=1}; END {for(url in counts) print counts[url], url}' "$(retlog "$1")"
} }
# top20 of Most Visited file or page # top20 of Most Visited file or page
function visitpage20() { function visitpage20() {
awk '{print $11}' "$(retlog)" | sort | uniq -c | sort -nr | head -n 20 awk '{print $11}' "$(retlog "$1")" | sort | uniq -c | sort -nr | head -n 20
} }
# top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences # top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences
function consume100() { function consume100() {
awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" | sort -n | uniq -c | sort -nr | head -n 100 awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog "$1")" | sort -n | uniq -c | sort -nr | head -n 100
# if django website or other website make by no suffix language # if django website or other website make by no suffix language
# awk '{print $7}' "$(retlog)" | sort -n | uniq -c | sort -nr | head -n 100 # awk '{print $7}' "$(retlog "$1")" | sort -n | uniq -c | sort -nr | head -n 100
} }
# Website traffic statistics (G) # Website traffic statistics (G)
function webtraffic() { function webtraffic() {
awk '{sum+=$10} END {print sum/1024/1024/1024}' "$(retlog)" awk '{sum+=$10} END {print sum/1024/1024/1024}' "$(retlog "$1")"
} }
# Statistical connections 404 # Statistical connections 404
function c404() { function c404() {
awk '($9 ~ /404/)' "$(retlog)" | awk '{print $9,$7}' | sort awk '($9 ~ /404/)' "$(retlog "$1")" | awk '{print $9,$7}' | sort
} }
# Statistical http status. # Statistical http status.
function httpstatus() { function httpstatus() {
awk '{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}' "$(retlog)" awk '{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}' "$(retlog "$1")"
} }
# Delete 0 byte file # Delete 0 byte file
@@ -211,5 +211,5 @@ function getip() {
# Second concurrent # Second concurrent
function conssec() { function conssec() {
awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog)" | sort -k 2 -nr | head -n10 awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog "$1")" | sort -k 2 -nr | head -n10
} }
+8
View File
@@ -12,6 +12,14 @@ plugins=(... terraform)
## Requirements ## Requirements
- [Terraform](https://terraform.io/) - [Terraform](https://terraform.io/)
- [terraform-docs](https://terraform-docs.io/) (optional, for completion)
## terraform-docs completion
If `terraform-docs` is installed, this plugin also enables its completion.
The completion script is generated from the installed version and cached in
`$ZSH_CACHE_DIR/completions/_terraform-docs`. It is refreshed in the background
each time the plugin loads, so completion stays in sync with the installed CLI.
## Aliases ## Aliases
+20
View File
@@ -39,3 +39,23 @@ alias tfsh='terraform show'
alias tfw='terraform workspace' alias tfw='terraform workspace'
alias tfwl='terraform workspace list' alias tfwl='terraform workspace list'
alias tfws='terraform workspace select' alias tfws='terraform workspace select'
if (( $+commands[terraform-docs] )); then
# If the completion file doesn't exist yet, compinit hasn't registered it.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_terraform-docs" ]]; then
typeset -g -A _comps
autoload -Uz _terraform-docs
_comps[terraform-docs]=_terraform-docs
fi
zmodload -F zsh/files b:zf_mv
() {
local completions
completions=$(command terraform-docs completion zsh) || return
[[ -n "$completions" ]] || return
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._terraform-docs"
zf_mv -f -- =(print -r -- "$completions") \
"$ZSH_CACHE_DIR/completions/_terraform-docs"
} &|
fi
+2
View File
@@ -4,7 +4,9 @@
To use it, add thefuck to the plugins array of your zshrc file: To use it, add thefuck to the plugins array of your zshrc file:
```zsh
plugins=(... thefuck) plugins=(... thefuck)
```
## Usage ## Usage
Press `ESC` twice to correct previous console command. Press `ESC` twice to correct previous console command.
+20
View File
@@ -43,12 +43,32 @@ function _vi-mode-set-cursor-shape-for-keymap() {
printf $'\e[%d q' "${_shape}" printf $'\e[%d q' "${_shape}"
} }
autoload -Uz is-at-least
if is-at-least 5.3; then
# Visual mode doesn't change $KEYMAP, it only activates the region, so
# zle-keymap-select never runs when it starts or ends
function _vi-mode-zle-line-pre-redraw() {
if [[ "$KEYMAP" = vicmd ]] && (( REGION_ACTIVE )); then
[[ "$VI_KEYMAP" != visual ]] || return 0
typeset -g VI_KEYMAP=visual
elif [[ "$VI_KEYMAP" = visual ]]; then
typeset -g VI_KEYMAP=$KEYMAP
else
return 0
fi
_vi-mode-set-cursor-shape-for-keymap "$VI_KEYMAP"
}
autoload -Uz add-zle-hook-widget
add-zle-hook-widget zle-line-pre-redraw _vi-mode-zle-line-pre-redraw
else
# zle-line-pre-redraw needs zsh 5.3
function _visual-mode { function _visual-mode {
typeset -g VI_KEYMAP=visual typeset -g VI_KEYMAP=visual
_vi-mode-set-cursor-shape-for-keymap "$VI_KEYMAP" _vi-mode-set-cursor-shape-for-keymap "$VI_KEYMAP"
zle .visual-mode zle .visual-mode
} }
zle -N visual-mode _visual-mode zle -N visual-mode _visual-mode
fi
function _vi-mode-should-reset-prompt() { function _vi-mode-should-reset-prompt() {
# If $VI_MODE_RESET_PROMPT_ON_MODE_CHANGE is unset (default), dynamically # If $VI_MODE_RESET_PROMPT_ON_MODE_CHANGE is unset (default), dynamically
+33 -4
View File
@@ -23,18 +23,47 @@ fi
if [ -e ~/.zshrc ]; then if [ -e ~/.zshrc ]; then
ZSHRC_SAVE=~/.zshrc.omz-uninstalled-$(date +%Y-%m-%d_%H-%M-%S) ZSHRC_SAVE=~/.zshrc.omz-uninstalled-$(date +%Y-%m-%d_%H-%M-%S)
echo "Found ~/.zshrc -- Renaming to ${ZSHRC_SAVE}" echo "Found ~/.zshrc -- Saving your current config to ${ZSHRC_SAVE}"
echo " (this file contains your current zsh configuration)"
mv ~/.zshrc "${ZSHRC_SAVE}" mv ~/.zshrc "${ZSHRC_SAVE}"
fi fi
echo "Looking for original zsh config..." echo "Looking for original zsh config..."
ZSHRC_ORIG=~/.zshrc.pre-oh-my-zsh ZSHRC_ORIG=~/.zshrc.pre-oh-my-zsh
if [ -e "$ZSHRC_ORIG" ]; then if [ -e "$ZSHRC_ORIG" ]; then
echo "Found $ZSHRC_ORIG -- Restoring to ~/.zshrc" ZSHRC_ORIG_DATE=$(date -r "$ZSHRC_ORIG" "+%Y-%m-%d" 2>/dev/null || date -d "@$(stat -c %Y "$ZSHRC_ORIG" 2>/dev/null)" "+%Y-%m-%d" 2>/dev/null || echo "unknown date")
echo "Found $ZSHRC_ORIG (last modified: ${ZSHRC_ORIG_DATE})"
echo "This is the zsh config that existed before Oh My Zsh was installed."
printf "Restore it as ~/.zshrc? [y/N] "
read -r restore_confirmation
if [ "$restore_confirmation" = y ] || [ "$restore_confirmation" = Y ]; then
mv "$ZSHRC_ORIG" ~/.zshrc mv "$ZSHRC_ORIG" ~/.zshrc
echo "Your original zsh config was restored." echo "Your original zsh config was restored to ~/.zshrc."
if [ -n "$ZSHRC_SAVE" ]; then
echo "Your Oh My Zsh config is saved at ${ZSHRC_SAVE} if you need it."
fi
else else
echo "No original zsh config found" echo "Skipping restore."
if [ -n "$ZSHRC_SAVE" ]; then
mv "${ZSHRC_SAVE}" ~/.zshrc
echo "Your current zsh config has been kept at ~/.zshrc."
echo "Your pre-OMZ backup is still at ${ZSHRC_ORIG} if you need it."
fi
fi
else
echo "No original zsh config found."
if [ -n "$ZSHRC_SAVE" ]; then
mv "${ZSHRC_SAVE}" ~/.zshrc
echo "Your current zsh config has been kept at ~/.zshrc."
fi
fi
# Warn if the active .zshrc still sources oh-my-zsh
if [ -f ~/.zshrc ] && command grep -q 'source.*oh-my-zsh\.sh' ~/.zshrc 2>/dev/null; then
echo ""
echo "Note: ~/.zshrc still contains a line sourcing oh-my-zsh.sh."
echo "Since oh-my-zsh has been removed, that line will cause an error"
echo "on every new shell. You may want to remove or comment it out."
fi fi
echo "Thanks for trying out Oh My Zsh. It's been uninstalled." echo "Thanks for trying out Oh My Zsh. It's been uninstalled."