mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
Merge branch 'master' into tf-plugin-add-workspace-aliases
This commit is contained in:
commit
d3e67b05c9
182 changed files with 2867 additions and 1297 deletions
|
|
@ -6,3 +6,6 @@ insert_final_newline = true
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
indent_style = space
|
indent_style = space
|
||||||
|
|
||||||
|
[*.py]
|
||||||
|
indent_size = 4
|
||||||
|
|
|
||||||
5
.github/CODEOWNERS
vendored
5
.github/CODEOWNERS
vendored
|
|
@ -1,13 +1,14 @@
|
||||||
# Plugin owners
|
# Plugin owners
|
||||||
plugins/archlinux/ @ratijas
|
plugins/archlinux/ @ratijas
|
||||||
|
plugins/dbt/ @msempere
|
||||||
|
plugins/eza/ @pepoluan
|
||||||
plugins/genpass/ @atoponce
|
plugins/genpass/ @atoponce
|
||||||
plugins/git-lfs/ @hellovietduc
|
plugins/git-lfs/ @hellovietduc
|
||||||
plugins/gitfast/ @felipec
|
plugins/gitfast/ @felipec
|
||||||
plugins/react-native @esthor
|
plugins/react-native @esthor
|
||||||
plugins/sdk/ @rgoldberg
|
plugins/sdk/ @rgoldberg
|
||||||
plugins/shell-proxy/ @septs
|
plugins/shell-proxy/ @septs
|
||||||
|
plugins/starship/ @axieax
|
||||||
plugins/universalarchive/ @Konfekt
|
plugins/universalarchive/ @Konfekt
|
||||||
plugins/wp-cli/ @joshmedeski
|
plugins/wp-cli/ @joshmedeski
|
||||||
plugins/zoxide/ @ajeetdsouza
|
plugins/zoxide/ @ajeetdsouza
|
||||||
plugins/starship/ @axieax
|
|
||||||
plugins/dbt/ @msempere
|
|
||||||
|
|
|
||||||
12
.github/dependabot.yml
vendored
Normal file
12
.github/dependabot.yml
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
day: "sunday"
|
||||||
|
- package-ecosystem: "pip"
|
||||||
|
directory: "/.github/workflows/dependencies"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
day: "sunday"
|
||||||
19
.github/dependencies.yml
vendored
19
.github/dependencies.yml
vendored
|
|
@ -2,7 +2,7 @@ dependencies:
|
||||||
plugins/gitfast:
|
plugins/gitfast:
|
||||||
repo: felipec/git-completion
|
repo: felipec/git-completion
|
||||||
branch: master
|
branch: master
|
||||||
version: tag:v2.0
|
version: tag:v2.1
|
||||||
postcopy: |
|
postcopy: |
|
||||||
set -e
|
set -e
|
||||||
rm -rf git-completion.plugin.zsh Makefile README.adoc t tools
|
rm -rf git-completion.plugin.zsh Makefile README.adoc t tools
|
||||||
|
|
@ -21,7 +21,7 @@ dependencies:
|
||||||
plugins/history-substring-search:
|
plugins/history-substring-search:
|
||||||
repo: zsh-users/zsh-history-substring-search
|
repo: zsh-users/zsh-history-substring-search
|
||||||
branch: master
|
branch: master
|
||||||
version: 8dd05bfcc12b0cd1ee9ea64be725b3d9f713cf64
|
version: 87ce96b1862928d84b1afe7c173316614b30e301
|
||||||
precopy: |
|
precopy: |
|
||||||
set -e
|
set -e
|
||||||
rm -f zsh-history-substring-search.plugin.zsh
|
rm -f zsh-history-substring-search.plugin.zsh
|
||||||
|
|
@ -29,3 +29,18 @@ dependencies:
|
||||||
postcopy: |
|
postcopy: |
|
||||||
set -e
|
set -e
|
||||||
test -e dependencies/OMZ-README.md && cat dependencies/OMZ-README.md >> README.md
|
test -e dependencies/OMZ-README.md && cat dependencies/OMZ-README.md >> README.md
|
||||||
|
plugins/gradle:
|
||||||
|
repo: gradle/gradle-completion
|
||||||
|
branch: master
|
||||||
|
version: 25da917cf5a88f3e58f05be3868a7b2748c8afe6
|
||||||
|
precopy: |
|
||||||
|
set -e
|
||||||
|
find . ! -name _gradle ! -name LICENSE -delete
|
||||||
|
plugins/wd:
|
||||||
|
repo: mfaerevaag/wd
|
||||||
|
branch: master
|
||||||
|
version: tag:v0.7.0
|
||||||
|
precopy: |
|
||||||
|
set -e
|
||||||
|
rm -r test
|
||||||
|
rm install.sh tty.gif wd.1
|
||||||
|
|
|
||||||
11
.github/workflows/dependencies.yml
vendored
11
.github/workflows/dependencies.yml
vendored
|
|
@ -1,8 +1,8 @@
|
||||||
name: Update dependencies
|
name: Update dependencies
|
||||||
on:
|
on:
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
# schedule:
|
schedule:
|
||||||
# - cron: '34 3 * * */8'
|
- cron: "0 6 * * 0"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
|
|
@ -12,12 +12,19 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
- name: Authenticate as @ohmyzsh
|
- name: Authenticate as @ohmyzsh
|
||||||
id: generate_token
|
id: generate_token
|
||||||
uses: ohmyzsh/github-app-token@v2
|
uses: ohmyzsh/github-app-token@v2
|
||||||
with:
|
with:
|
||||||
app_id: ${{ secrets.OHMYZSH_APP_ID }}
|
app_id: ${{ secrets.OHMYZSH_APP_ID }}
|
||||||
private_key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
private_key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.12"
|
||||||
|
cache: "pip"
|
||||||
- name: Process dependencies
|
- name: Process dependencies
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
|
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,7 @@
|
||||||
PyYAML~=6.0.1
|
certifi==2024.2.2
|
||||||
requests~=2.31.0
|
charset-normalizer==3.3.2
|
||||||
|
idna==3.7
|
||||||
|
PyYAML==6.0.1
|
||||||
|
requests==2.31.0
|
||||||
|
semver==3.0.2
|
||||||
|
urllib3==2.2.1
|
||||||
|
|
|
||||||
810
.github/workflows/dependencies/updater.py
vendored
810
.github/workflows/dependencies/updater.py
vendored
|
|
@ -1,11 +1,16 @@
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import requests
|
import timeit
|
||||||
import shutil
|
|
||||||
import yaml
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from typing import Optional, TypedDict
|
from typing import Literal, NotRequired, Optional, TypedDict
|
||||||
|
|
||||||
|
import requests
|
||||||
|
import yaml
|
||||||
|
from semver import Version
|
||||||
|
|
||||||
# Get TMP_DIR variable from environment
|
# Get TMP_DIR variable from environment
|
||||||
TMP_DIR = os.path.join(os.environ.get("TMP_DIR", "/tmp"), "ohmyzsh")
|
TMP_DIR = os.path.join(os.environ.get("TMP_DIR", "/tmp"), "ohmyzsh")
|
||||||
|
|
@ -14,28 +19,58 @@ DEPS_YAML_FILE = ".github/dependencies.yml"
|
||||||
# Dry run flag
|
# Dry run flag
|
||||||
DRY_RUN = os.environ.get("DRY_RUN", "0") == "1"
|
DRY_RUN = os.environ.get("DRY_RUN", "0") == "1"
|
||||||
|
|
||||||
import timeit
|
# utils for tag comparison
|
||||||
|
BASEVERSION = re.compile(
|
||||||
|
r"""[vV]?
|
||||||
|
(?P<major>(0|[1-9])\d*)
|
||||||
|
(\.
|
||||||
|
(?P<minor>(0|[1-9])\d*)
|
||||||
|
(\.
|
||||||
|
(?P<patch>(0|[1-9])\d*)
|
||||||
|
)?
|
||||||
|
)?
|
||||||
|
""",
|
||||||
|
re.VERBOSE,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def coerce(version: str) -> Optional[Version]:
|
||||||
|
match = BASEVERSION.search(version)
|
||||||
|
if not match:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# BASEVERSION looks for `MAJOR.minor.patch` in the string given
|
||||||
|
# it fills with None if any of them is missing (for example `2.1`)
|
||||||
|
ver = {
|
||||||
|
key: 0 if value is None else value for key, value in match.groupdict().items()
|
||||||
|
}
|
||||||
|
# Version takes `major`, `minor`, `patch` arguments
|
||||||
|
ver = Version(**ver) # pyright: ignore[reportArgumentType]
|
||||||
|
return ver
|
||||||
|
|
||||||
|
|
||||||
class CodeTimer:
|
class CodeTimer:
|
||||||
def __init__(self, name=None):
|
def __init__(self, name=None):
|
||||||
self.name = " '" + name + "'" if name else ''
|
self.name = " '" + name + "'" if name else ""
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self.start = timeit.default_timer()
|
self.start = timeit.default_timer()
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, traceback):
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
self.took = (timeit.default_timer() - self.start) * 1000.0
|
self.took = (timeit.default_timer() - self.start) * 1000.0
|
||||||
print('Code block' + self.name + ' took: ' + str(self.took) + ' ms')
|
print("Code block" + self.name + " took: " + str(self.took) + " ms")
|
||||||
|
|
||||||
|
|
||||||
### YAML representation
|
### YAML representation
|
||||||
def str_presenter(dumper, data):
|
def str_presenter(dumper, data):
|
||||||
"""
|
"""
|
||||||
Configures yaml for dumping multiline strings
|
Configures yaml for dumping multiline strings
|
||||||
Ref: https://stackoverflow.com/a/33300001
|
Ref: https://stackoverflow.com/a/33300001
|
||||||
"""
|
"""
|
||||||
if len(data.splitlines()) > 1: # check for multiline string
|
if len(data.splitlines()) > 1: # check for multiline string
|
||||||
return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
|
return dumper.represent_scalar("tag:yaml.org,2002:str", data, style="|")
|
||||||
return dumper.represent_scalar('tag:yaml.org,2002:str', data)
|
return dumper.represent_scalar("tag:yaml.org,2002:str", data)
|
||||||
|
|
||||||
|
|
||||||
yaml.add_representer(str, str_presenter)
|
yaml.add_representer(str, str_presenter)
|
||||||
yaml.representer.SafeRepresenter.add_representer(str, str_presenter)
|
yaml.representer.SafeRepresenter.add_representer(str, str_presenter)
|
||||||
|
|
@ -43,408 +78,521 @@ yaml.representer.SafeRepresenter.add_representer(str, str_presenter)
|
||||||
|
|
||||||
# Types
|
# Types
|
||||||
class DependencyDict(TypedDict):
|
class DependencyDict(TypedDict):
|
||||||
repo: str
|
repo: str
|
||||||
branch: str
|
branch: str
|
||||||
version: str
|
version: str
|
||||||
precopy: Optional[str]
|
precopy: NotRequired[str]
|
||||||
postcopy: Optional[str]
|
postcopy: NotRequired[str]
|
||||||
|
|
||||||
|
|
||||||
class DependencyYAML(TypedDict):
|
class DependencyYAML(TypedDict):
|
||||||
dependencies: dict[str, DependencyDict]
|
dependencies: dict[str, DependencyDict]
|
||||||
|
|
||||||
class UpdateStatus(TypedDict):
|
|
||||||
has_updates: bool
|
class UpdateStatusFalse(TypedDict):
|
||||||
version: Optional[str]
|
has_updates: Literal[False]
|
||||||
compare_url: Optional[str]
|
|
||||||
head_ref: Optional[str]
|
|
||||||
head_url: Optional[str]
|
class UpdateStatusTrue(TypedDict):
|
||||||
|
has_updates: Literal[True]
|
||||||
|
version: str
|
||||||
|
compare_url: str
|
||||||
|
head_ref: str
|
||||||
|
head_url: str
|
||||||
|
|
||||||
|
|
||||||
class CommandRunner:
|
class CommandRunner:
|
||||||
class Exception(Exception):
|
class Exception(Exception):
|
||||||
def __init__(self, message, returncode, stage, stdout, stderr):
|
def __init__(self, message, returncode, stage, stdout, stderr):
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
self.returncode = returncode
|
self.returncode = returncode
|
||||||
self.stage = stage
|
self.stage = stage
|
||||||
self.stdout = stdout
|
self.stdout = stdout
|
||||||
self.stderr = stderr
|
self.stderr = stderr
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run_or_fail(command: list[str], stage: str, *args, **kwargs):
|
def run_or_fail(command: list[str], stage: str, *args, **kwargs):
|
||||||
if DRY_RUN and command[0] == "gh":
|
if DRY_RUN and command[0] == "gh":
|
||||||
command.insert(0, "echo")
|
command.insert(0, "echo")
|
||||||
|
|
||||||
result = subprocess.run(command, *args, capture_output=True, **kwargs)
|
result = subprocess.run(command, *args, capture_output=True, **kwargs)
|
||||||
|
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
raise CommandRunner.Exception(
|
raise CommandRunner.Exception(
|
||||||
f"{stage} command failed with exit code {result.returncode}", returncode=result.returncode,
|
f"{stage} command failed with exit code {result.returncode}",
|
||||||
stage=stage,
|
returncode=result.returncode,
|
||||||
stdout=result.stdout.decode("utf-8"),
|
stage=stage,
|
||||||
stderr=result.stderr.decode("utf-8")
|
stdout=result.stdout.decode("utf-8"),
|
||||||
)
|
stderr=result.stderr.decode("utf-8"),
|
||||||
|
)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
class DependencyStore:
|
class DependencyStore:
|
||||||
store: DependencyYAML = {
|
store: DependencyYAML = {"dependencies": {}}
|
||||||
"dependencies": {}
|
|
||||||
}
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def set(data: DependencyYAML):
|
def set(data: DependencyYAML):
|
||||||
DependencyStore.store = data
|
DependencyStore.store = data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def update_dependency_version(path: str, version: str) -> DependencyYAML:
|
def update_dependency_version(path: str, version: str) -> DependencyYAML:
|
||||||
with CodeTimer(f"store deepcopy: {path}"):
|
with CodeTimer(f"store deepcopy: {path}"):
|
||||||
store_copy = deepcopy(DependencyStore.store)
|
store_copy = deepcopy(DependencyStore.store)
|
||||||
|
|
||||||
dependency = store_copy["dependencies"].get(path, {})
|
dependency = store_copy["dependencies"].get(path)
|
||||||
dependency["version"] = version
|
if dependency is None:
|
||||||
store_copy["dependencies"][path] = dependency
|
raise ValueError(f"Dependency {path} {version} not found")
|
||||||
|
dependency["version"] = version
|
||||||
|
store_copy["dependencies"][path] = dependency
|
||||||
|
|
||||||
return store_copy
|
return store_copy
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def write_store(file: str, data: DependencyYAML):
|
def write_store(file: str, data: DependencyYAML):
|
||||||
with open(file, "w") as yaml_file:
|
with open(file, "w") as yaml_file:
|
||||||
yaml.safe_dump(data, yaml_file, sort_keys=False)
|
yaml.safe_dump(data, yaml_file, sort_keys=False)
|
||||||
|
|
||||||
|
|
||||||
class Dependency:
|
class Dependency:
|
||||||
def __init__(self, path: str, values: DependencyDict):
|
def __init__(self, path: str, values: DependencyDict):
|
||||||
self.path = path
|
self.path = path
|
||||||
self.values = values
|
self.values = values
|
||||||
|
|
||||||
self.name: str = ""
|
self.name: str = ""
|
||||||
self.desc: str = ""
|
self.desc: str = ""
|
||||||
self.kind: str = ""
|
self.kind: str = ""
|
||||||
|
|
||||||
match path.split("/"):
|
match path.split("/"):
|
||||||
case ["plugins", name]:
|
case ["plugins", name]:
|
||||||
self.name = name
|
self.name = name
|
||||||
self.kind = "plugin"
|
self.kind = "plugin"
|
||||||
self.desc = f"{name} plugin"
|
self.desc = f"{name} plugin"
|
||||||
case ["themes", name]:
|
case ["themes", name]:
|
||||||
self.name = name.replace(".zsh-theme", "")
|
self.name = name.replace(".zsh-theme", "")
|
||||||
self.kind = "theme"
|
self.kind = "theme"
|
||||||
self.desc = f"{self.name} theme"
|
self.desc = f"{self.name} theme"
|
||||||
case _:
|
case _:
|
||||||
self.name = self.desc = path
|
self.name = self.desc = path
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
output: str = ""
|
output: str = ""
|
||||||
for key in DependencyDict.__dict__['__annotations__'].keys():
|
for key in DependencyDict.__dict__["__annotations__"].keys():
|
||||||
if key not in self.values:
|
if key not in self.values:
|
||||||
output += f"{key}: None\n"
|
output += f"{key}: None\n"
|
||||||
continue
|
continue
|
||||||
|
|
||||||
value = self.values[key]
|
value = self.values[key]
|
||||||
if "\n" not in value:
|
if "\n" not in value:
|
||||||
output += f"{key}: {value}\n"
|
output += f"{key}: {value}\n"
|
||||||
else:
|
else:
|
||||||
output += f"{key}:\n "
|
output += f"{key}:\n "
|
||||||
output += value.replace("\n", "\n ", value.count("\n") - 1)
|
output += value.replace("\n", "\n ", value.count("\n") - 1)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def update_or_notify(self):
|
def update_or_notify(self):
|
||||||
# Print dependency settings
|
# Print dependency settings
|
||||||
print(f"Processing {self.desc}...", file=sys.stderr)
|
print(f"Processing {self.desc}...", file=sys.stderr)
|
||||||
print(self, file=sys.stderr)
|
print(self, file=sys.stderr)
|
||||||
|
|
||||||
# Check for updates
|
# Check for updates
|
||||||
repo = self.values["repo"]
|
repo = self.values["repo"]
|
||||||
remote_branch = self.values["branch"]
|
remote_branch = self.values["branch"]
|
||||||
version = self.values["version"]
|
version = self.values["version"]
|
||||||
is_tag = version.startswith("tag:")
|
is_tag = version.startswith("tag:")
|
||||||
|
|
||||||
try:
|
|
||||||
with CodeTimer(f"update check: {repo}"):
|
|
||||||
if is_tag:
|
|
||||||
status = GitHub.check_newer_tag(repo, version.replace("tag:", ""))
|
|
||||||
else:
|
|
||||||
status = GitHub.check_updates(repo, remote_branch, version)
|
|
||||||
|
|
||||||
if status["has_updates"]:
|
|
||||||
short_sha = status["head_ref"][:8]
|
|
||||||
new_version = status["version"] if is_tag else short_sha
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Create new branch
|
with CodeTimer(f"update check: {repo}"):
|
||||||
branch = Git.create_branch(self.path, new_version)
|
if is_tag:
|
||||||
|
status = GitHub.check_newer_tag(repo, version.replace("tag:", ""))
|
||||||
|
else:
|
||||||
|
status = GitHub.check_updates(repo, remote_branch, version)
|
||||||
|
|
||||||
# Update dependencies.yml file
|
if status["has_updates"] is True:
|
||||||
self.__update_yaml(f"tag:{new_version}" if is_tag else status["version"])
|
short_sha = status["head_ref"][:8]
|
||||||
|
new_version = status["version"] if is_tag else short_sha
|
||||||
|
|
||||||
# Update dependency files
|
try:
|
||||||
self.__apply_upstream_changes()
|
branch_name = f"update/{self.path}/{new_version}"
|
||||||
|
|
||||||
# Add all changes and commit
|
# Create new branch
|
||||||
Git.add_and_commit(self.name, short_sha)
|
branch = Git.checkout_or_create_branch(branch_name)
|
||||||
|
|
||||||
# Push changes to remote
|
# Update dependencies.yml file
|
||||||
Git.push(branch)
|
self.__update_yaml(
|
||||||
|
f"tag:{new_version}" if is_tag else status["version"]
|
||||||
|
)
|
||||||
|
|
||||||
# Create GitHub PR
|
# Update dependency files
|
||||||
GitHub.create_pr(
|
self.__apply_upstream_changes()
|
||||||
branch,
|
|
||||||
f"feat({self.name}): update to version {new_version}",
|
# Add all changes and commit
|
||||||
f"""## Description
|
has_new_commit = Git.add_and_commit(self.name, short_sha)
|
||||||
|
|
||||||
|
if has_new_commit:
|
||||||
|
# Push changes to remote
|
||||||
|
Git.push(branch)
|
||||||
|
|
||||||
|
# Create GitHub PR
|
||||||
|
GitHub.create_pr(
|
||||||
|
branch,
|
||||||
|
f"feat({self.name}): update to version {new_version}",
|
||||||
|
f"""## Description
|
||||||
|
|
||||||
Update for **{self.desc}**: update to version [{new_version}]({status['head_url']}).
|
Update for **{self.desc}**: update to version [{new_version}]({status['head_url']}).
|
||||||
Check out the [list of changes]({status['compare_url']}).
|
Check out the [list of changes]({status['compare_url']}).
|
||||||
"""
|
""",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Clean up repository
|
# Clean up repository
|
||||||
Git.clean_repo()
|
Git.clean_repo()
|
||||||
except (CommandRunner.Exception, shutil.Error) as e:
|
except (CommandRunner.Exception, shutil.Error) as e:
|
||||||
# Handle exception on automatic update
|
# Handle exception on automatic update
|
||||||
match type(e):
|
match type(e):
|
||||||
case CommandRunner.Exception:
|
case CommandRunner.Exception:
|
||||||
# Print error message
|
# Print error message
|
||||||
print(f"Error running {e.stage} command: {e.returncode}", file=sys.stderr)
|
print(
|
||||||
print(e.stderr, file=sys.stderr)
|
f"Error running {e.stage} command: {e.returncode}", # pyright: ignore[reportAttributeAccessIssue]
|
||||||
case shutil.Error:
|
file=sys.stderr,
|
||||||
print(f"Error copying files: {e}", file=sys.stderr)
|
)
|
||||||
|
print(e.stderr, file=sys.stderr) # pyright: ignore[reportAttributeAccessIssue]
|
||||||
|
case shutil.Error:
|
||||||
|
print(f"Error copying files: {e}", file=sys.stderr)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Git.clean_repo()
|
Git.clean_repo()
|
||||||
except CommandRunner.Exception as e:
|
except CommandRunner.Exception as e:
|
||||||
print(f"Error reverting repository to clean state: {e}", file=sys.stderr)
|
print(
|
||||||
sys.exit(1)
|
f"Error reverting repository to clean state: {e}",
|
||||||
|
file=sys.stderr,
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# Create a GitHub issue to notify maintainer
|
# Create a GitHub issue to notify maintainer
|
||||||
title = f"{self.path}: update to {new_version}"
|
title = f"{self.path}: update to {new_version}"
|
||||||
body = (
|
body = f"""## Description
|
||||||
f"""## Description
|
|
||||||
|
|
||||||
There is a new version of `{self.name}` {self.kind} available.
|
There is a new version of `{self.name}` {self.kind} available.
|
||||||
|
|
||||||
New version: [{new_version}]({status['head_url']})
|
New version: [{new_version}]({status['head_url']})
|
||||||
Check out the [list of changes]({status['compare_url']}).
|
Check out the [list of changes]({status['compare_url']}).
|
||||||
"""
|
"""
|
||||||
)
|
|
||||||
|
|
||||||
print(f"Creating GitHub issue", file=sys.stderr)
|
print("Creating GitHub issue", file=sys.stderr)
|
||||||
print(f"{title}\n\n{body}", file=sys.stderr)
|
print(f"{title}\n\n{body}", file=sys.stderr)
|
||||||
GitHub.create_issue(title, body)
|
GitHub.create_issue(title, body)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e, file=sys.stderr)
|
print(e, file=sys.stderr)
|
||||||
|
|
||||||
def __update_yaml(self, new_version: str) -> None:
|
def __update_yaml(self, new_version: str) -> None:
|
||||||
dep_yaml = DependencyStore.update_dependency_version(self.path, new_version)
|
dep_yaml = DependencyStore.update_dependency_version(self.path, new_version)
|
||||||
DependencyStore.write_store(DEPS_YAML_FILE, dep_yaml)
|
DependencyStore.write_store(DEPS_YAML_FILE, dep_yaml)
|
||||||
|
|
||||||
def __apply_upstream_changes(self) -> None:
|
def __apply_upstream_changes(self) -> None:
|
||||||
# Patterns to ignore in copying files from upstream repo
|
# Patterns to ignore in copying files from upstream repo
|
||||||
GLOBAL_IGNORE = [
|
GLOBAL_IGNORE = [".git", ".github", ".gitignore"]
|
||||||
".git",
|
|
||||||
".github",
|
|
||||||
".gitignore"
|
|
||||||
]
|
|
||||||
|
|
||||||
path = os.path.abspath(self.path)
|
path = os.path.abspath(self.path)
|
||||||
precopy = self.values.get("precopy")
|
precopy = self.values.get("precopy")
|
||||||
postcopy = self.values.get("postcopy")
|
postcopy = self.values.get("postcopy")
|
||||||
|
|
||||||
repo = self.values["repo"]
|
repo = self.values["repo"]
|
||||||
branch = self.values["branch"]
|
branch = self.values["branch"]
|
||||||
remote_url = f"https://github.com/{repo}.git"
|
remote_url = f"https://github.com/{repo}.git"
|
||||||
repo_dir = os.path.join(TMP_DIR, repo)
|
repo_dir = os.path.join(TMP_DIR, repo)
|
||||||
|
|
||||||
# Clone repository
|
# Clone repository
|
||||||
Git.clone(remote_url, branch, repo_dir, reclone=True)
|
Git.clone(remote_url, branch, repo_dir, reclone=True)
|
||||||
|
|
||||||
# Run precopy on tmp repo
|
# Run precopy on tmp repo
|
||||||
if precopy is not None:
|
if precopy is not None:
|
||||||
print("Running precopy script:", end="\n ", file=sys.stderr)
|
print("Running precopy script:", end="\n ", file=sys.stderr)
|
||||||
print(precopy.replace("\n", "\n ", precopy.count("\n") - 1), file=sys.stderr)
|
print(
|
||||||
CommandRunner.run_or_fail(["bash", "-c", precopy], cwd=repo_dir, stage="Precopy")
|
precopy.replace("\n", "\n ", precopy.count("\n") - 1), file=sys.stderr
|
||||||
|
)
|
||||||
|
CommandRunner.run_or_fail(
|
||||||
|
["bash", "-c", precopy], cwd=repo_dir, stage="Precopy"
|
||||||
|
)
|
||||||
|
|
||||||
# Copy files from upstream repo
|
# Copy files from upstream repo
|
||||||
print(f"Copying files from {repo_dir} to {path}", file=sys.stderr)
|
print(f"Copying files from {repo_dir} to {path}", file=sys.stderr)
|
||||||
shutil.copytree(repo_dir, path, dirs_exist_ok=True, ignore=shutil.ignore_patterns(*GLOBAL_IGNORE))
|
shutil.copytree(
|
||||||
|
repo_dir,
|
||||||
|
path,
|
||||||
|
dirs_exist_ok=True,
|
||||||
|
ignore=shutil.ignore_patterns(*GLOBAL_IGNORE),
|
||||||
|
)
|
||||||
|
|
||||||
# Run postcopy on our repository
|
# Run postcopy on our repository
|
||||||
if postcopy is not None:
|
if postcopy is not None:
|
||||||
print("Running postcopy script:", end="\n ", file=sys.stderr)
|
print("Running postcopy script:", end="\n ", file=sys.stderr)
|
||||||
print(postcopy.replace("\n", "\n ", postcopy.count("\n") - 1), file=sys.stderr)
|
print(
|
||||||
CommandRunner.run_or_fail(["bash", "-c", postcopy], cwd=path, stage="Postcopy")
|
postcopy.replace("\n", "\n ", postcopy.count("\n") - 1),
|
||||||
|
file=sys.stderr,
|
||||||
|
)
|
||||||
|
CommandRunner.run_or_fail(
|
||||||
|
["bash", "-c", postcopy], cwd=path, stage="Postcopy"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Git:
|
class Git:
|
||||||
default_branch = "master"
|
default_branch = "master"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clone(remote_url: str, branch: str, repo_dir: str, reclone=False):
|
def clone(remote_url: str, branch: str, repo_dir: str, reclone=False):
|
||||||
# If repo needs to be fresh
|
# If repo needs to be fresh
|
||||||
if reclone and os.path.exists(repo_dir):
|
if reclone and os.path.exists(repo_dir):
|
||||||
shutil.rmtree(repo_dir)
|
shutil.rmtree(repo_dir)
|
||||||
|
|
||||||
# Clone repo in tmp directory and checkout branch
|
# Clone repo in tmp directory and checkout branch
|
||||||
if not os.path.exists(repo_dir):
|
if not os.path.exists(repo_dir):
|
||||||
print(f"Cloning {remote_url} to {repo_dir} and checking out {branch}", file=sys.stderr)
|
print(
|
||||||
CommandRunner.run_or_fail(["git", "clone", "--depth=1", "-b", branch, remote_url, repo_dir], stage="Clone")
|
f"Cloning {remote_url} to {repo_dir} and checking out {branch}",
|
||||||
|
file=sys.stderr,
|
||||||
|
)
|
||||||
|
CommandRunner.run_or_fail(
|
||||||
|
["git", "clone", "--depth=1", "-b", branch, remote_url, repo_dir],
|
||||||
|
stage="Clone",
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_branch(path: str, version: str):
|
def checkout_or_create_branch(branch_name: str):
|
||||||
# Get current branch name
|
# Get current branch name
|
||||||
result = CommandRunner.run_or_fail(["git", "rev-parse", "--abbrev-ref", "HEAD"], stage="GetDefaultBranch")
|
result = CommandRunner.run_or_fail(
|
||||||
Git.default_branch = result.stdout.decode("utf-8").strip()
|
["git", "rev-parse", "--abbrev-ref", "HEAD"], stage="GetDefaultBranch"
|
||||||
|
)
|
||||||
|
Git.default_branch = result.stdout.decode("utf-8").strip()
|
||||||
|
|
||||||
# Create new branch and return created branch name
|
# Create new branch and return created branch name
|
||||||
branch_name = f"update/{path}/{version}"
|
try:
|
||||||
CommandRunner.run_or_fail(["git", "checkout", "-b", branch_name], stage="CreateBranch")
|
# try to checkout already existing branch
|
||||||
return branch_name
|
CommandRunner.run_or_fail(
|
||||||
|
["git", "checkout", branch_name], stage="CreateBranch"
|
||||||
|
)
|
||||||
|
except CommandRunner.Exception:
|
||||||
|
# otherwise create new branch
|
||||||
|
CommandRunner.run_or_fail(
|
||||||
|
["git", "checkout", "-b", branch_name], stage="CreateBranch"
|
||||||
|
)
|
||||||
|
return branch_name
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_and_commit(scope: str, version: str):
|
def add_and_commit(scope: str, version: str) -> bool:
|
||||||
user_name = os.environ.get("GIT_APP_NAME")
|
"""
|
||||||
user_email = os.environ.get("GIT_APP_EMAIL")
|
Returns `True` if there were changes and were indeed commited.
|
||||||
|
Returns `False` if the repo was clean and no changes were commited.
|
||||||
|
"""
|
||||||
|
# check if repo is clean (clean => no error, no commit)
|
||||||
|
try:
|
||||||
|
CommandRunner.run_or_fail(
|
||||||
|
["git", "diff", "--exit-code"], stage="CheckRepoClean"
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
except CommandRunner.Exception:
|
||||||
|
# if it's other kind of error just throw!
|
||||||
|
pass
|
||||||
|
|
||||||
# Add all files to git staging
|
user_name = os.environ.get("GIT_APP_NAME")
|
||||||
CommandRunner.run_or_fail(["git", "add", "-A", "-v"], stage="AddFiles")
|
user_email = os.environ.get("GIT_APP_EMAIL")
|
||||||
|
|
||||||
# Reset environment and git config
|
# Add all files to git staging
|
||||||
clean_env = os.environ.copy()
|
CommandRunner.run_or_fail(["git", "add", "-A", "-v"], stage="AddFiles")
|
||||||
clean_env["LANG"]="C.UTF-8"
|
|
||||||
clean_env["GIT_CONFIG_GLOBAL"]="/dev/null"
|
|
||||||
clean_env["GIT_CONFIG_NOSYSTEM"]="1"
|
|
||||||
|
|
||||||
# Commit with settings above
|
# Reset environment and git config
|
||||||
CommandRunner.run_or_fail([
|
clean_env = os.environ.copy()
|
||||||
"git",
|
clean_env["LANG"] = "C.UTF-8"
|
||||||
"-c", f"user.name={user_name}",
|
clean_env["GIT_CONFIG_GLOBAL"] = "/dev/null"
|
||||||
"-c", f"user.email={user_email}",
|
clean_env["GIT_CONFIG_NOSYSTEM"] = "1"
|
||||||
"commit",
|
|
||||||
"-m", f"feat({scope}): update to {version}"
|
|
||||||
], stage="CreateCommit", env=clean_env)
|
|
||||||
|
|
||||||
@staticmethod
|
# Commit with settings above
|
||||||
def push(branch: str):
|
CommandRunner.run_or_fail(
|
||||||
CommandRunner.run_or_fail(["git", "push", "-u", "origin", branch], stage="PushBranch")
|
[
|
||||||
|
"git",
|
||||||
|
"-c",
|
||||||
|
f"user.name={user_name}",
|
||||||
|
"-c",
|
||||||
|
f"user.email={user_email}",
|
||||||
|
"commit",
|
||||||
|
"-m",
|
||||||
|
f"feat({scope}): update to {version}",
|
||||||
|
],
|
||||||
|
stage="CreateCommit",
|
||||||
|
env=clean_env,
|
||||||
|
)
|
||||||
|
return True
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clean_repo():
|
def push(branch: str):
|
||||||
CommandRunner.run_or_fail(["git", "reset", "--hard", "HEAD"], stage="ResetRepository")
|
CommandRunner.run_or_fail(
|
||||||
CommandRunner.run_or_fail(["git", "checkout", Git.default_branch], stage="CheckoutDefaultBranch")
|
["git", "push", "-u", "origin", branch], stage="PushBranch"
|
||||||
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def clean_repo():
|
||||||
|
CommandRunner.run_or_fail(
|
||||||
|
["git", "reset", "--hard", "HEAD"], stage="ResetRepository"
|
||||||
|
)
|
||||||
|
CommandRunner.run_or_fail(
|
||||||
|
["git", "checkout", Git.default_branch], stage="CheckoutDefaultBranch"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class GitHub:
|
class GitHub:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_newer_tag(repo, current_tag) -> UpdateStatus:
|
def check_newer_tag(repo, current_tag) -> UpdateStatusFalse | UpdateStatusTrue:
|
||||||
# GET /repos/:owner/:repo/git/refs/tags
|
# GET /repos/:owner/:repo/git/refs/tags
|
||||||
url = f"https://api.github.com/repos/{repo}/git/refs/tags"
|
url = f"https://api.github.com/repos/{repo}/git/refs/tags"
|
||||||
|
|
||||||
# Send a GET request to the GitHub API
|
# Send a GET request to the GitHub API
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
|
current_version = coerce(current_tag)
|
||||||
|
if current_version is None:
|
||||||
|
raise ValueError(
|
||||||
|
f"Stored {current_version} from {repo} does not follow semver"
|
||||||
|
)
|
||||||
|
|
||||||
# If the request was successful
|
# If the request was successful
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
# Parse the JSON response
|
# Parse the JSON response
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
|
||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
return {
|
return {
|
||||||
"has_updates": False,
|
"has_updates": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
latest_ref = data[-1]
|
latest_ref = None
|
||||||
latest_tag = latest_ref["ref"].replace("refs/tags/", "")
|
latest_version: Optional[Version] = None
|
||||||
|
for ref in data:
|
||||||
|
# we find the tag since GitHub returns it as plain git ref
|
||||||
|
tag_version = coerce(ref["ref"].replace("refs/tags/", ""))
|
||||||
|
if tag_version is None:
|
||||||
|
# we skip every tag that is not semver-complaint
|
||||||
|
continue
|
||||||
|
if latest_version is None or tag_version.compare(latest_version) > 0:
|
||||||
|
# if we have a "greater" semver version, set it as latest
|
||||||
|
latest_version = tag_version
|
||||||
|
latest_ref = ref
|
||||||
|
|
||||||
if latest_tag == current_tag:
|
# raise if no valid semver tag is found
|
||||||
return {
|
if latest_ref is None or latest_version is None:
|
||||||
"has_updates": False,
|
raise ValueError(f"No tags following semver found in {repo}")
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
# we get the tag since GitHub returns it as plain git ref
|
||||||
"has_updates": True,
|
latest_tag = latest_ref["ref"].replace("refs/tags/", "")
|
||||||
"version": latest_tag,
|
|
||||||
"compare_url": f"https://github.com/{repo}/compare/{current_tag}...{latest_tag}",
|
|
||||||
"head_ref": latest_ref["object"]["sha"],
|
|
||||||
"head_url": f"https://github.com/{repo}/releases/tag/{latest_tag}",
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
# If the request was not successful, raise an exception
|
|
||||||
raise Exception(f"GitHub API request failed with status code {response.status_code}: {response.json()}")
|
|
||||||
|
|
||||||
@staticmethod
|
if latest_version.compare(current_version) <= 0:
|
||||||
def check_updates(repo, branch, version) -> UpdateStatus:
|
return {
|
||||||
# TODO: add support for semver updating (based on tags)
|
"has_updates": False,
|
||||||
# Check if upstream github repo has a new version
|
}
|
||||||
# GitHub API URL for comparing two commits
|
|
||||||
url = f"https://api.github.com/repos/{repo}/compare/{version}...{branch}"
|
|
||||||
|
|
||||||
# Send a GET request to the GitHub API
|
return {
|
||||||
response = requests.get(url)
|
"has_updates": True,
|
||||||
|
"version": latest_tag,
|
||||||
|
"compare_url": f"https://github.com/{repo}/compare/{current_tag}...{latest_tag}",
|
||||||
|
"head_ref": latest_ref["object"]["sha"],
|
||||||
|
"head_url": f"https://github.com/{repo}/releases/tag/{latest_tag}",
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# If the request was not successful, raise an exception
|
||||||
|
raise Exception(
|
||||||
|
f"GitHub API request failed with status code {response.status_code}: {response.json()}"
|
||||||
|
)
|
||||||
|
|
||||||
# If the request was successful
|
@staticmethod
|
||||||
if response.status_code == 200:
|
def check_updates(repo, branch, version) -> UpdateStatusFalse | UpdateStatusTrue:
|
||||||
# Parse the JSON response
|
url = f"https://api.github.com/repos/{repo}/compare/{version}...{branch}"
|
||||||
data = response.json()
|
|
||||||
|
|
||||||
# If the base is behind the head, there is a newer version
|
# Send a GET request to the GitHub API
|
||||||
has_updates = data["status"] != "identical"
|
response = requests.get(url)
|
||||||
|
|
||||||
if not has_updates:
|
# If the request was successful
|
||||||
return {
|
if response.status_code == 200:
|
||||||
"has_updates": False,
|
# Parse the JSON response
|
||||||
}
|
data = response.json()
|
||||||
|
|
||||||
return {
|
# If the base is behind the head, there is a newer version
|
||||||
"has_updates": data["status"] != "identical",
|
has_updates = data["status"] != "identical"
|
||||||
"version": data["commits"][-1]["sha"],
|
|
||||||
"compare_url": data["permalink_url"],
|
|
||||||
"head_ref": data["commits"][-1]["sha"],
|
|
||||||
"head_url": data["commits"][-1]["html_url"]
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
# If the request was not successful, raise an exception
|
|
||||||
raise Exception(f"GitHub API request failed with status code {response.status_code}: {response.json()}")
|
|
||||||
|
|
||||||
@staticmethod
|
if not has_updates:
|
||||||
def create_issue(title: str, body: str) -> None:
|
return {
|
||||||
cmd = [
|
"has_updates": False,
|
||||||
"gh",
|
}
|
||||||
"issue",
|
|
||||||
"create",
|
|
||||||
"-t", title,
|
|
||||||
"-b", body
|
|
||||||
]
|
|
||||||
CommandRunner.run_or_fail(cmd, stage="CreateIssue")
|
|
||||||
|
|
||||||
@staticmethod
|
return {
|
||||||
def create_pr(branch: str, title: str, body: str) -> None:
|
"has_updates": data["status"] != "identical",
|
||||||
cmd = [
|
"version": data["commits"][-1]["sha"],
|
||||||
"gh",
|
"compare_url": data["permalink_url"],
|
||||||
"pr",
|
"head_ref": data["commits"][-1]["sha"],
|
||||||
"create",
|
"head_url": data["commits"][-1]["html_url"],
|
||||||
"-B", Git.default_branch,
|
}
|
||||||
"-H", branch,
|
else:
|
||||||
"-t", title,
|
# If the request was not successful, raise an exception
|
||||||
"-b", body
|
raise Exception(
|
||||||
]
|
f"GitHub API request failed with status code {response.status_code}: {response.json()}"
|
||||||
CommandRunner.run_or_fail(cmd, stage="CreatePullRequest")
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def create_issue(title: str, body: str) -> None:
|
||||||
|
cmd = ["gh", "issue", "create", "-t", title, "-b", body]
|
||||||
|
CommandRunner.run_or_fail(cmd, stage="CreateIssue")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def create_pr(branch: str, title: str, body: str) -> None:
|
||||||
|
# first of all let's check if PR is already open
|
||||||
|
check_cmd = [
|
||||||
|
"gh",
|
||||||
|
"pr",
|
||||||
|
"list",
|
||||||
|
"--state",
|
||||||
|
"open",
|
||||||
|
"--head",
|
||||||
|
branch,
|
||||||
|
"--json",
|
||||||
|
"title",
|
||||||
|
]
|
||||||
|
# returncode is 0 also if no PRs are found
|
||||||
|
output = json.loads(
|
||||||
|
CommandRunner.run_or_fail(check_cmd, stage="CheckPullRequestOpen")
|
||||||
|
.stdout.decode("utf-8")
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
# we have PR in this case!
|
||||||
|
if len(output) > 0:
|
||||||
|
return
|
||||||
|
cmd = [
|
||||||
|
"gh",
|
||||||
|
"pr",
|
||||||
|
"create",
|
||||||
|
"-B",
|
||||||
|
Git.default_branch,
|
||||||
|
"-H",
|
||||||
|
branch,
|
||||||
|
"-t",
|
||||||
|
title,
|
||||||
|
"-b",
|
||||||
|
body,
|
||||||
|
]
|
||||||
|
CommandRunner.run_or_fail(cmd, stage="CreatePullRequest")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Load the YAML file
|
# Load the YAML file
|
||||||
with open(DEPS_YAML_FILE, "r") as yaml_file:
|
with open(DEPS_YAML_FILE, "r") as yaml_file:
|
||||||
data: DependencyYAML = yaml.safe_load(yaml_file)
|
data: DependencyYAML = yaml.safe_load(yaml_file)
|
||||||
|
|
||||||
if "dependencies" not in data:
|
if "dependencies" not in data:
|
||||||
raise Exception(f"dependencies.yml not properly formatted")
|
raise Exception("dependencies.yml not properly formatted")
|
||||||
|
|
||||||
# Cache YAML version
|
# Cache YAML version
|
||||||
DependencyStore.set(data)
|
DependencyStore.set(data)
|
||||||
|
|
||||||
|
dependencies = data["dependencies"]
|
||||||
|
for path in dependencies:
|
||||||
|
dependency = Dependency(path, dependencies[path])
|
||||||
|
dependency.update_or_notify()
|
||||||
|
|
||||||
dependencies = data["dependencies"]
|
|
||||||
for path in dependencies:
|
|
||||||
dependency = Dependency(path, dependencies[path])
|
|
||||||
dependency.update_or_notify()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
4
.github/workflows/installer.yml
vendored
4
.github/workflows/installer.yml
vendored
|
|
@ -26,7 +26,7 @@ jobs:
|
||||||
- macos-latest
|
- macos-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Set up git repository
|
- name: Set up git repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- 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,7 +42,7 @@ jobs:
|
||||||
- test
|
- test
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Install Vercel CLI
|
- name: Install Vercel CLI
|
||||||
run: npm install -g vercel
|
run: npm install -g vercel
|
||||||
- name: Setup project and deploy
|
- name: Setup project and deploy
|
||||||
|
|
|
||||||
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
|
@ -24,7 +24,7 @@ jobs:
|
||||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
steps:
|
steps:
|
||||||
- name: Set up git repository
|
- name: Set up git repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- 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
|
||||||
|
|
|
||||||
24
README.md
24
README.md
|
|
@ -43,6 +43,7 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi
|
||||||
- [Custom Plugins And Themes](#custom-plugins-and-themes)
|
- [Custom Plugins And Themes](#custom-plugins-and-themes)
|
||||||
- [Enable GNU ls In macOS And freeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems)
|
- [Enable GNU ls In macOS And freeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems)
|
||||||
- [Skip Aliases](#skip-aliases)
|
- [Skip Aliases](#skip-aliases)
|
||||||
|
- [Disable async git prompt](#disable-async-git-prompt)
|
||||||
- [Getting Updates](#getting-updates)
|
- [Getting Updates](#getting-updates)
|
||||||
- [Updates Verbosity](#updates-verbosity)
|
- [Updates Verbosity](#updates-verbosity)
|
||||||
- [Manual Updates](#manual-updates)
|
- [Manual Updates](#manual-updates)
|
||||||
|
|
@ -88,7 +89,7 @@ Oh My Zsh is installed by running one of the following commands in your terminal
|
||||||
| **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
|
| **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
|
||||||
| **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
|
| **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
|
||||||
|
|
||||||
Alternatively, the installer is also mirrored outside GitHub. Using this URL instead may be required if you're in a country like India or China, that blocks `raw.githubusercontent.com`:
|
Alternatively, the installer is also mirrored outside GitHub. Using this URL instead may be required if you're in a country like China or India (for certain ISPs), that blocks `raw.githubusercontent.com`:
|
||||||
|
|
||||||
| Method | Command |
|
| Method | Command |
|
||||||
| :-------- | :------------------------------------------------------------------------------------------------ |
|
| :-------- | :------------------------------------------------------------------------------------------------ |
|
||||||
|
|
@ -234,7 +235,7 @@ If you're in China, India, or another country that blocks `raw.githubusercontent
|
||||||
|
|
||||||
#### Installing From A Forked Repository
|
#### Installing From A Forked Repository
|
||||||
|
|
||||||
The install script also accepts these variables to allow installation of a different repository:
|
The install script also accepts these variables to allow the installation of a different repository:
|
||||||
|
|
||||||
- `REPO` (default: `ohmyzsh/ohmyzsh`): this takes the form of `owner/repository`. If you set
|
- `REPO` (default: `ohmyzsh/ohmyzsh`): this takes the form of `owner/repository`. If you set
|
||||||
this variable, the installer will look for a repository at `https://github.com/{owner}/{repository}`.
|
this variable, the installer will look for a repository at `https://github.com/{owner}/{repository}`.
|
||||||
|
|
@ -308,7 +309,7 @@ If you would like to override the functionality of a plugin distributed with Oh
|
||||||
|
|
||||||
<a name="enable-gnu-ls"></a>
|
<a name="enable-gnu-ls"></a>
|
||||||
|
|
||||||
The default behaviour in Oh My Zsh is to use BSD `ls` in macOS and freeBSD systems. If GNU `ls` is installed
|
The default behaviour in Oh My Zsh is to use BSD `ls` in macOS and FreeBSD systems. If GNU `ls` is installed
|
||||||
(as `gls` command), you can choose to use it instead. To do it, you can use zstyle-based config before
|
(as `gls` command), you can choose to use it instead. To do it, you can use zstyle-based config before
|
||||||
sourcing `oh-my-zsh.sh`:
|
sourcing `oh-my-zsh.sh`:
|
||||||
|
|
||||||
|
|
@ -341,7 +342,7 @@ zstyle ':omz:plugins:*' aliases no
|
||||||
zstyle ':omz:plugins:git' aliases no
|
zstyle ':omz:plugins:git' aliases no
|
||||||
```
|
```
|
||||||
|
|
||||||
You can combine these in other ways taking into account that more specific scopes takes precedence:
|
You can combine these in other ways taking into account that more specific scopes take precedence:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Skip all plugin aliases, except for the git plugin
|
# Skip all plugin aliases, except for the git plugin
|
||||||
|
|
@ -361,6 +362,17 @@ Instead, you can now use the following:
|
||||||
zstyle ':omz:lib:directories' aliases no
|
zstyle ':omz:lib:directories' aliases no
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Disable async git prompt
|
||||||
|
|
||||||
|
Async prompt functions are an experimental feature (included on April 3, 2024) that allows Oh My Zsh to render prompt information
|
||||||
|
asynchronously. This can improve prompt rendering performance, but it might not work well with some setups. We hope that's not an
|
||||||
|
issue, but if you're seeing problems with this new feature, you can turn it off by setting the following in your .zshrc file,
|
||||||
|
before Oh My Zsh is sourced:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zstyle ':omz:alpha:lib:git' async-prompt no
|
||||||
|
```
|
||||||
|
|
||||||
#### Notice <!-- omit in toc -->
|
#### Notice <!-- omit in toc -->
|
||||||
|
|
||||||
> This feature is currently in a testing phase and it may be subject to change in the future.
|
> This feature is currently in a testing phase and it may be subject to change in the future.
|
||||||
|
|
@ -449,6 +461,10 @@ Oh My Zsh has a vibrant community of happy users and delightful contributors. Wi
|
||||||
|
|
||||||
Thank you so much!
|
Thank you so much!
|
||||||
|
|
||||||
|
<a href="https://github.com/ohmyzsh/ohmyzsh/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=ohmyzsh/ohmyzsh" width="100%"/>
|
||||||
|
</a>
|
||||||
|
|
||||||
## Follow Us
|
## Follow Us
|
||||||
|
|
||||||
We're on social media:
|
We're on social media:
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
# Put files in this folder to add your own custom functionality.
|
# Put files in this folder to add your own custom functionality.
|
||||||
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization
|
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization
|
||||||
#
|
#
|
||||||
# Files in the custom/ directory will be:
|
# Files in the custom/ directory will be:
|
||||||
# - loaded automatically by the init script, in alphabetical order
|
# - loaded automatically by the init script, in alphabetical order
|
||||||
# - loaded last, after all built-ins in the lib/ directory, to override them
|
# - loaded last, after all built-ins in the lib/ directory, to override them
|
||||||
# - ignored by git by default
|
# - ignored by git by default
|
||||||
#
|
#
|
||||||
# Example: add custom/shortcuts.zsh for shortcuts to your local projects
|
# Example: add custom/shortcuts.zsh for shortcuts to your local projects
|
||||||
#
|
#
|
||||||
# brainstormr=~/Projects/development/planetargon/brainstormr
|
# brainstormr=~/Projects/development/planetargon/brainstormr
|
||||||
# cd $brainstormr
|
# cd $brainstormr
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Put your custom themes in this folder.
|
# Put your custom themes in this folder.
|
||||||
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes
|
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
|
|
||||||
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
|
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
|
||||||
|
|
|
||||||
144
lib/async_prompt.zsh
Normal file
144
lib/async_prompt.zsh
Normal file
|
|
@ -0,0 +1,144 @@
|
||||||
|
# The async code is taken from
|
||||||
|
# https://github.com/zsh-users/zsh-autosuggestions/blob/master/src/async.zsh
|
||||||
|
# https://github.com/woefe/git-prompt.zsh/blob/master/git-prompt.zsh
|
||||||
|
|
||||||
|
zmodload zsh/system
|
||||||
|
autoload -Uz is-at-least
|
||||||
|
|
||||||
|
# For now, async prompt function handlers are set up like so:
|
||||||
|
# First, define the async function handler and register the handler
|
||||||
|
# with _omz_register_handler:
|
||||||
|
#
|
||||||
|
# function _git_prompt_status_async {
|
||||||
|
# # Do some expensive operation that outputs to stdout
|
||||||
|
# }
|
||||||
|
# _omz_register_handler _git_prompt_status_async
|
||||||
|
#
|
||||||
|
# Then add a stub prompt function in `$PROMPT` or similar prompt variables,
|
||||||
|
# which will show the output of "$_OMZ_ASYNC_OUTPUT[handler_name]":
|
||||||
|
#
|
||||||
|
# function git_prompt_status {
|
||||||
|
# echo -n $_OMZ_ASYNC_OUTPUT[_git_prompt_status_async]
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# RPROMPT='$(git_prompt_status)'
|
||||||
|
#
|
||||||
|
# This API is subject to change and optimization. Rely on it at your own risk.
|
||||||
|
|
||||||
|
function _omz_register_handler {
|
||||||
|
setopt localoptions noksharrays
|
||||||
|
typeset -ga _omz_async_functions
|
||||||
|
# we want to do nothing if there's no $1 function or we already set it up
|
||||||
|
if [[ -z "$1" ]] || (( ! ${+functions[$1]} )) \
|
||||||
|
|| (( ${_omz_async_functions[(Ie)$1]} )); then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
_omz_async_functions+=("$1")
|
||||||
|
# let's add the hook to async_request if it's not there yet
|
||||||
|
if (( ! ${precmd_functions[(Ie)_omz_async_request]} )) \
|
||||||
|
&& (( ${+functions[_omz_async_request]})); then
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
|
add-zsh-hook precmd _omz_async_request
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set up async handlers and callbacks
|
||||||
|
function _omz_async_request {
|
||||||
|
local -i ret=$?
|
||||||
|
typeset -gA _OMZ_ASYNC_FDS _OMZ_ASYNC_PIDS _OMZ_ASYNC_OUTPUT
|
||||||
|
|
||||||
|
# executor runs a subshell for all async requests based on key
|
||||||
|
local handler
|
||||||
|
for handler in ${_omz_async_functions}; do
|
||||||
|
(( ${+functions[$handler]} )) || continue
|
||||||
|
|
||||||
|
local fd=${_OMZ_ASYNC_FDS[$handler]:--1}
|
||||||
|
local pid=${_OMZ_ASYNC_PIDS[$handler]:--1}
|
||||||
|
|
||||||
|
# If we've got a pending request, cancel it
|
||||||
|
if (( fd != -1 && pid != -1 )) && { true <&$fd } 2>/dev/null; then
|
||||||
|
# Close the file descriptor and remove the handler
|
||||||
|
exec {fd}<&-
|
||||||
|
zle -F $fd
|
||||||
|
|
||||||
|
# Zsh will make a new process group for the child process only if job
|
||||||
|
# control is enabled (MONITOR option)
|
||||||
|
if [[ -o MONITOR ]]; then
|
||||||
|
# Send the signal to the process group to kill any processes that may
|
||||||
|
# have been forked by the async function handler
|
||||||
|
kill -TERM -$pid 2>/dev/null
|
||||||
|
else
|
||||||
|
# Kill just the child process since it wasn't placed in a new process
|
||||||
|
# group. If the async function handler forked any child processes they may
|
||||||
|
# be orphaned and left behind.
|
||||||
|
kill -TERM $pid 2>/dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Define global variables to store the file descriptor, PID and output
|
||||||
|
_OMZ_ASYNC_FDS[$handler]=-1
|
||||||
|
_OMZ_ASYNC_PIDS[$handler]=-1
|
||||||
|
|
||||||
|
# Fork a process to fetch the git status and open a pipe to read from it
|
||||||
|
exec {fd}< <(
|
||||||
|
# Tell parent process our PID
|
||||||
|
builtin echo ${sysparams[pid]}
|
||||||
|
# Set exit code for the handler if used
|
||||||
|
() { return $ret }
|
||||||
|
# Run the async function handler
|
||||||
|
$handler
|
||||||
|
)
|
||||||
|
|
||||||
|
# Save FD for handler
|
||||||
|
_OMZ_ASYNC_FDS[$handler]=$fd
|
||||||
|
|
||||||
|
# There's a weird bug here where ^C stops working unless we force a fork
|
||||||
|
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364
|
||||||
|
# and https://github.com/zsh-users/zsh-autosuggestions/pull/612
|
||||||
|
is-at-least 5.8 || command true
|
||||||
|
|
||||||
|
# Save the PID from the handler child process
|
||||||
|
read -u $fd "_OMZ_ASYNC_PIDS[$handler]"
|
||||||
|
|
||||||
|
# When the fd is readable, call the response handler
|
||||||
|
zle -F "$fd" _omz_async_callback
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Called when new data is ready to be read from the pipe
|
||||||
|
function _omz_async_callback() {
|
||||||
|
emulate -L zsh
|
||||||
|
|
||||||
|
local fd=$1 # First arg will be fd ready for reading
|
||||||
|
local err=$2 # Second arg will be passed in case of error
|
||||||
|
|
||||||
|
if [[ -z "$err" || "$err" == "hup" ]]; then
|
||||||
|
# Get handler name from fd
|
||||||
|
local handler="${(k)_OMZ_ASYNC_FDS[(r)$fd]}"
|
||||||
|
|
||||||
|
# Store old output which is supposed to be already printed
|
||||||
|
local old_output="${_OMZ_ASYNC_OUTPUT[$handler]}"
|
||||||
|
|
||||||
|
# Read output from fd
|
||||||
|
IFS= read -r -u $fd -d '' "_OMZ_ASYNC_OUTPUT[$handler]"
|
||||||
|
|
||||||
|
# Repaint prompt if output has changed
|
||||||
|
if [[ "$old_output" != "${_OMZ_ASYNC_OUTPUT[$handler]}" ]]; then
|
||||||
|
zle .reset-prompt
|
||||||
|
zle -R
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Close the fd
|
||||||
|
exec {fd}<&-
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Always remove the handler
|
||||||
|
zle -F "$fd"
|
||||||
|
|
||||||
|
# Unset global FD variable to prevent closing user created FDs in the precmd hook
|
||||||
|
_OMZ_ASYNC_FDS[$handler]=-1
|
||||||
|
_OMZ_ASYNC_PIDS[$handler]=-1
|
||||||
|
}
|
||||||
|
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
|
add-zsh-hook precmd _omz_async_request
|
||||||
28
lib/cli.zsh
28
lib/cli.zsh
|
|
@ -241,10 +241,18 @@ function _omz::plugin::disable {
|
||||||
|
|
||||||
# Remove plugins substitution awk script
|
# Remove plugins substitution awk script
|
||||||
local awk_subst_plugins="\
|
local awk_subst_plugins="\
|
||||||
gsub(/[ \t]+(${(j:|:)dis_plugins})/, \"\") # with spaces before
|
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
|
||||||
gsub(/(${(j:|:)dis_plugins})[ \t]+/, \"\") # with spaces after
|
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
|
||||||
gsub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin)
|
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
|
||||||
|
|
||||||
|
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
|
||||||
"
|
"
|
||||||
|
|
||||||
# Disable plugins awk script
|
# Disable plugins awk script
|
||||||
local awk_script="
|
local awk_script="
|
||||||
# if plugins=() is in oneline form, substitute disabled plugins and go to next line
|
# if plugins=() is in oneline form, substitute disabled plugins and go to next line
|
||||||
|
|
@ -448,7 +456,7 @@ function _omz::plugin::load {
|
||||||
if [[ ! -f "$base/_$plugin" && ! -f "$base/$plugin.plugin.zsh" ]]; then
|
if [[ ! -f "$base/_$plugin" && ! -f "$base/$plugin.plugin.zsh" ]]; then
|
||||||
_omz::log warn "'$plugin' is not a valid plugin"
|
_omz::log warn "'$plugin' is not a valid plugin"
|
||||||
continue
|
continue
|
||||||
# It it is a valid plugin, add its directory to $fpath unless it is already there
|
# It is a valid plugin, add its directory to $fpath unless it is already there
|
||||||
elif (( ! ${fpath[(Ie)$base]} )); then
|
elif (( ! ${fpath[(Ie)$base]} )); then
|
||||||
fpath=("$base" $fpath)
|
fpath=("$base" $fpath)
|
||||||
fi
|
fi
|
||||||
|
|
@ -773,7 +781,17 @@ function _omz::theme::use {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _omz::update {
|
function _omz::update {
|
||||||
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD)
|
# Check if git command is available
|
||||||
|
(( $+commands[git] )) || {
|
||||||
|
_omz::log error "git is not installed. Aborting..."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)
|
||||||
|
[[ $? -eq 0 ]] || {
|
||||||
|
_omz::log error "\`$ZSH\` is not a git directory. Aborting..."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# Run update script
|
# Run update script
|
||||||
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
|
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ function handle_completion_insecurities() {
|
||||||
# /usr/share/zsh/5.0.6
|
# /usr/share/zsh/5.0.6
|
||||||
#
|
#
|
||||||
# Since the ignorable first line is printed to stderr and thus not captured,
|
# Since the ignorable first line is printed to stderr and thus not captured,
|
||||||
# stderr is squelched to prevent this output from leaking to the user.
|
# stderr is squelched to prevent this output from leaking to the user.
|
||||||
local -aU insecure_dirs
|
local -aU insecure_dirs
|
||||||
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
|
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ zstyle ':completion:*:*:*:users' ignored-patterns \
|
||||||
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
|
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
|
||||||
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
|
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
|
||||||
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
|
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
|
||||||
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
|
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
|
||||||
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
|
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
|
||||||
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
|
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
|
||||||
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
|
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
#
|
#
|
||||||
# This is written in a defensive style so it still works (and can detect) cases when
|
# This is written in a defensive style so it still works (and can detect) cases when
|
||||||
# basic functionality like echo and which have been redefined. In particular, almost
|
# basic functionality like echo and which have been redefined. In particular, almost
|
||||||
# everything is invoked with "builtin" or "command", to work in the face of user
|
# everything is invoked with "builtin" or "command", to work in the face of user
|
||||||
# redefinitions.
|
# redefinitions.
|
||||||
#
|
#
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
|
|
@ -59,7 +59,7 @@ function omz_diagnostic_dump() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
|
|
||||||
builtin echo "Generating diagnostic dump; please be patient..."
|
builtin echo "Generating diagnostic dump; please be patient..."
|
||||||
|
|
||||||
local thisfcn=omz_diagnostic_dump
|
local thisfcn=omz_diagnostic_dump
|
||||||
local -A opts
|
local -A opts
|
||||||
local opt_verbose opt_noverbose opt_outfile
|
local opt_verbose opt_noverbose opt_outfile
|
||||||
|
|
@ -90,7 +90,7 @@ function omz_diagnostic_dump() {
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo Diagnostic dump file created at: "$outfile"
|
builtin echo Diagnostic dump file created at: "$outfile"
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo To share this with OMZ developers, post it as a gist on GitHub
|
builtin echo To share this with OMZ developers, post it as a gist on GitHub
|
||||||
builtin echo at "https://gist.github.com" and share the link to the gist.
|
builtin echo at "https://gist.github.com" and share the link to the gist.
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo "WARNING: This dump file contains all your zsh and omz configuration files,"
|
builtin echo "WARNING: This dump file contains all your zsh and omz configuration files,"
|
||||||
|
|
@ -105,8 +105,8 @@ function _omz_diag_dump_one_big_text() {
|
||||||
builtin echo oh-my-zsh diagnostic dump
|
builtin echo oh-my-zsh diagnostic dump
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo $outfile
|
builtin echo $outfile
|
||||||
builtin echo
|
builtin echo
|
||||||
|
|
||||||
# Basic system and zsh information
|
# Basic system and zsh information
|
||||||
command date
|
command date
|
||||||
command uname -a
|
command uname -a
|
||||||
|
|
@ -151,7 +151,7 @@ function _omz_diag_dump_one_big_text() {
|
||||||
|
|
||||||
# Core command definitions
|
# Core command definitions
|
||||||
_omz_diag_dump_check_core_commands || return 1
|
_omz_diag_dump_check_core_commands || return 1
|
||||||
builtin echo
|
builtin echo
|
||||||
|
|
||||||
# ZSH Process state
|
# ZSH Process state
|
||||||
builtin echo Process state:
|
builtin echo Process state:
|
||||||
|
|
@ -167,7 +167,7 @@ function _omz_diag_dump_one_big_text() {
|
||||||
#TODO: Should this include `env` instead of or in addition to `export`?
|
#TODO: Should this include `env` instead of or in addition to `export`?
|
||||||
builtin echo Exported:
|
builtin echo Exported:
|
||||||
builtin echo $(builtin export | command sed 's/=.*//')
|
builtin echo $(builtin export | command sed 's/=.*//')
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo Locale:
|
builtin echo Locale:
|
||||||
command locale
|
command locale
|
||||||
builtin echo
|
builtin echo
|
||||||
|
|
@ -181,7 +181,7 @@ function _omz_diag_dump_one_big_text() {
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo 'compaudit output:'
|
builtin echo 'compaudit output:'
|
||||||
compaudit
|
compaudit
|
||||||
builtin echo
|
builtin echo
|
||||||
builtin echo '$fpath directories:'
|
builtin echo '$fpath directories:'
|
||||||
command ls -lad $fpath
|
command ls -lad $fpath
|
||||||
builtin echo
|
builtin echo
|
||||||
|
|
@ -224,7 +224,7 @@ function _omz_diag_dump_one_big_text() {
|
||||||
local cfgfile cfgfiles
|
local cfgfile cfgfiles
|
||||||
# Some files for bash that zsh does not use are intentionally included
|
# Some files for bash that zsh does not use are intentionally included
|
||||||
# to help with diagnosing behavior differences between bash and zsh
|
# to help with diagnosing behavior differences between bash and zsh
|
||||||
cfgfiles=( /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin /etc/zlogout
|
cfgfiles=( /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin /etc/zlogout
|
||||||
$zdotdir/.zshenv $zdotdir/.zprofile $zdotdir/.zshrc $zdotdir/.zlogin $zdotdir/.zlogout
|
$zdotdir/.zshenv $zdotdir/.zprofile $zdotdir/.zshrc $zdotdir/.zlogin $zdotdir/.zlogout
|
||||||
~/.zsh.pre-oh-my-zsh
|
~/.zsh.pre-oh-my-zsh
|
||||||
/etc/bashrc /etc/profile ~/.bashrc ~/.profile ~/.bash_profile ~/.bash_logout )
|
/etc/bashrc /etc/profile ~/.bashrc ~/.profile ~/.bash_profile ~/.bash_logout )
|
||||||
|
|
@ -258,8 +258,8 @@ function _omz_diag_dump_check_core_commands() {
|
||||||
# (For back-compatibility, if any of these are newish, they should be removed,
|
# (For back-compatibility, if any of these are newish, they should be removed,
|
||||||
# or at least made conditional on the version of the current running zsh.)
|
# or at least made conditional on the version of the current running zsh.)
|
||||||
# "history" is also excluded because OMZ is known to redefine that
|
# "history" is also excluded because OMZ is known to redefine that
|
||||||
reserved_words=( do done esac then elif else fi for case if while function
|
reserved_words=( do done esac then elif else fi for case if while function
|
||||||
repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
|
repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
|
||||||
)
|
)
|
||||||
builtins=( alias autoload bg bindkey break builtin bye cd chdir command
|
builtins=( alias autoload bg bindkey break builtin bye cd chdir command
|
||||||
comparguments compcall compctl compdescribe compfiles compgroups compquote comptags
|
comparguments compcall compctl compdescribe compfiles compgroups compquote comptags
|
||||||
|
|
@ -331,7 +331,7 @@ function _omz_diag_dump_os_specific_version() {
|
||||||
case "$OSTYPE" in
|
case "$OSTYPE" in
|
||||||
darwin*)
|
darwin*)
|
||||||
osname=$(command sw_vers -productName)
|
osname=$(command sw_vers -productName)
|
||||||
osver=$(command sw_vers -productVersion)
|
osver=$(command sw_vers -productVersion)
|
||||||
builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)"
|
builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)"
|
||||||
;;
|
;;
|
||||||
cygwin)
|
cygwin)
|
||||||
|
|
|
||||||
58
lib/git.zsh
58
lib/git.zsh
|
|
@ -1,3 +1,5 @@
|
||||||
|
autoload -Uz is-at-least
|
||||||
|
|
||||||
# The git prompt's git commands are read-only and should not interfere with
|
# The git prompt's git commands are read-only and should not interfere with
|
||||||
# other processes. This environment variable is equivalent to running with `git
|
# other processes. This environment variable is equivalent to running with `git
|
||||||
# --no-optional-locks`, but falls back gracefully for older versions of git.
|
# --no-optional-locks`, but falls back gracefully for older versions of git.
|
||||||
|
|
@ -9,14 +11,18 @@ function __git_prompt_git() {
|
||||||
GIT_OPTIONAL_LOCKS=0 command git "$@"
|
GIT_OPTIONAL_LOCKS=0 command git "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_prompt_info() {
|
function _omz_git_prompt_info() {
|
||||||
# If we are on a folder not tracked by git, get out.
|
# If we are on a folder not tracked by git, get out.
|
||||||
# Otherwise, check for hide-info at global and local repository level
|
# Otherwise, check for hide-info at global and local repository level
|
||||||
if ! __git_prompt_git rev-parse --git-dir &> /dev/null \
|
if ! __git_prompt_git rev-parse --git-dir &> /dev/null \
|
||||||
|| [[ "$(__git_prompt_git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then
|
|| [[ "$(__git_prompt_git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get either:
|
||||||
|
# - the current branch name
|
||||||
|
# - the tag name if we are on a tag
|
||||||
|
# - the short SHA of the current commit
|
||||||
local ref
|
local ref
|
||||||
ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \
|
ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \
|
||||||
|| ref=$(__git_prompt_git describe --tags --exact-match HEAD 2> /dev/null) \
|
|| ref=$(__git_prompt_git describe --tags --exact-match HEAD 2> /dev/null) \
|
||||||
|
|
@ -33,6 +39,52 @@ function git_prompt_info() {
|
||||||
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Use async version if setting is enabled or undefined
|
||||||
|
if zstyle -T ':omz:alpha:lib:git' async-prompt; then
|
||||||
|
function git_prompt_info() {
|
||||||
|
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}" ]]; then
|
||||||
|
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function git_prompt_status() {
|
||||||
|
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}" ]]; then
|
||||||
|
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Conditionally register the async handler, only if it's needed in $PROMPT
|
||||||
|
# or any of the other prompt variables
|
||||||
|
function _defer_async_git_register() {
|
||||||
|
# Check if git_prompt_info is used in a prompt variable
|
||||||
|
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
|
||||||
|
*(\$\(git_prompt_info\)|\`git_prompt_info\`)*)
|
||||||
|
_omz_register_handler _omz_git_prompt_info
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
|
||||||
|
*(\$\(git_prompt_status\)|\`git_prompt_status\`)*)
|
||||||
|
_omz_register_handler _omz_git_prompt_status
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
add-zsh-hook -d precmd _defer_async_git_register
|
||||||
|
unset -f _defer_async_git_register
|
||||||
|
}
|
||||||
|
|
||||||
|
# Register the async handler first. This needs to be done before
|
||||||
|
# the async request prompt is run
|
||||||
|
precmd_functions=(_defer_async_git_register $precmd_functions)
|
||||||
|
else
|
||||||
|
function git_prompt_info() {
|
||||||
|
_omz_git_prompt_info
|
||||||
|
}
|
||||||
|
function git_prompt_status() {
|
||||||
|
_omz_git_prompt_status
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
# Checks if working tree is dirty
|
# Checks if working tree is dirty
|
||||||
function parse_git_dirty() {
|
function parse_git_dirty() {
|
||||||
local STATUS
|
local STATUS
|
||||||
|
|
@ -161,7 +213,7 @@ function git_prompt_long_sha() {
|
||||||
SHA=$(__git_prompt_git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
SHA=$(__git_prompt_git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_prompt_status() {
|
function _omz_git_prompt_status() {
|
||||||
[[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
|
[[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
|
||||||
|
|
||||||
# Maps a git status prefix to an internal constant
|
# Maps a git status prefix to an internal constant
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,20 @@
|
||||||
## History wrapper
|
## History wrapper
|
||||||
function omz_history {
|
function omz_history {
|
||||||
local clear list
|
# parse arguments and remove from $@
|
||||||
zparseopts -E c=clear l=list
|
local clear list stamp
|
||||||
|
zparseopts -E -D c=clear l=list f=stamp E=stamp i=stamp t:=stamp
|
||||||
|
|
||||||
if [[ -n "$clear" ]]; then
|
if [[ -n "$clear" ]]; then
|
||||||
# if -c provided, clobber the history file
|
# if -c provided, clobber the history file
|
||||||
echo -n >| "$HISTFILE"
|
echo -n >| "$HISTFILE"
|
||||||
fc -p "$HISTFILE"
|
fc -p "$HISTFILE"
|
||||||
echo >&2 History file deleted.
|
echo >&2 History file deleted.
|
||||||
elif [[ -n "$list" ]]; then
|
elif [[ $# -eq 0 ]]; then
|
||||||
# if -l provided, run as if calling `fc' directly
|
# if no arguments provided, show full history starting from 1
|
||||||
builtin fc "$@"
|
builtin fc $stamp -l 1
|
||||||
else
|
else
|
||||||
# unless a number is provided, show all history events (starting from 1)
|
# otherwise, run `fc -l` with a custom format
|
||||||
[[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
|
builtin fc $stamp -l "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,19 +32,26 @@ if [[ -n "${terminfo[knp]}" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start typing + [Up-Arrow] - fuzzy find history forward
|
# Start typing + [Up-Arrow] - fuzzy find history forward
|
||||||
if [[ -n "${terminfo[kcuu1]}" ]]; then
|
autoload -U up-line-or-beginning-search
|
||||||
autoload -U up-line-or-beginning-search
|
zle -N up-line-or-beginning-search
|
||||||
zle -N up-line-or-beginning-search
|
|
||||||
|
|
||||||
|
bindkey -M emacs "^[[A" up-line-or-beginning-search
|
||||||
|
bindkey -M viins "^[[A" up-line-or-beginning-search
|
||||||
|
bindkey -M vicmd "^[[A" up-line-or-beginning-search
|
||||||
|
if [[ -n "${terminfo[kcuu1]}" ]]; then
|
||||||
bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
|
bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||||
bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
|
bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||||
bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
|
bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||||
fi
|
fi
|
||||||
# Start typing + [Down-Arrow] - fuzzy find history backward
|
|
||||||
if [[ -n "${terminfo[kcud1]}" ]]; then
|
|
||||||
autoload -U down-line-or-beginning-search
|
|
||||||
zle -N down-line-or-beginning-search
|
|
||||||
|
|
||||||
|
# Start typing + [Down-Arrow] - fuzzy find history backward
|
||||||
|
autoload -U down-line-or-beginning-search
|
||||||
|
zle -N down-line-or-beginning-search
|
||||||
|
|
||||||
|
bindkey -M emacs "^[[B" down-line-or-beginning-search
|
||||||
|
bindkey -M viins "^[[B" down-line-or-beginning-search
|
||||||
|
bindkey -M vicmd "^[[B" down-line-or-beginning-search
|
||||||
|
if [[ -n "${terminfo[kcud1]}" ]]; then
|
||||||
bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search
|
bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||||
bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
|
bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||||
bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search
|
bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||||
|
|
|
||||||
|
|
@ -40,5 +40,5 @@ ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
|
||||||
# use this to enable users to see their ruby version, no matter which
|
# use this to enable users to see their ruby version, no matter which
|
||||||
# version management system they use
|
# version management system they use
|
||||||
function ruby_prompt_info() {
|
function ruby_prompt_info() {
|
||||||
echo $(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info)
|
echo "$(rvm_prompt_info || rbenv_prompt_info || chruby_prompt_info)"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ typeset -AHg FX FG BG
|
||||||
FX=(
|
FX=(
|
||||||
reset "%{[00m%}"
|
reset "%{[00m%}"
|
||||||
bold "%{[01m%}" no-bold "%{[22m%}"
|
bold "%{[01m%}" no-bold "%{[22m%}"
|
||||||
|
dim "%{[02m%}" no-dim "%{[22m%}"
|
||||||
italic "%{[03m%}" no-italic "%{[23m%}"
|
italic "%{[03m%}" no-italic "%{[23m%}"
|
||||||
underline "%{[04m%}" no-underline "%{[24m%}"
|
underline "%{[04m%}" no-underline "%{[24m%}"
|
||||||
blink "%{[05m%}" no-blink "%{[25m%}"
|
blink "%{[05m%}" no-blink "%{[25m%}"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ function title {
|
||||||
: ${2=$1}
|
: ${2=$1}
|
||||||
|
|
||||||
case "$TERM" in
|
case "$TERM" in
|
||||||
cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|st*|foot*|contour*)
|
cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty*|st*|foot*|contour*)
|
||||||
print -Pn "\e]2;${2:q}\a" # set window name
|
print -Pn "\e]2;${2:q}\a" # set window name
|
||||||
print -Pn "\e]1;${1:q}\a" # set tab name
|
print -Pn "\e]1;${1:q}\a" # set tab name
|
||||||
;;
|
;;
|
||||||
|
|
@ -129,7 +129,7 @@ fi
|
||||||
# Don't define the function if we're in an unsupported terminal
|
# Don't define the function if we're in an unsupported terminal
|
||||||
case "$TERM" in
|
case "$TERM" in
|
||||||
# all of these either process OSC 7 correctly or ignore entirely
|
# all of these either process OSC 7 correctly or ignore entirely
|
||||||
xterm*|putty*|rxvt*|konsole*|mlterm*|alacritty|screen*|tmux*) ;;
|
xterm*|putty*|rxvt*|konsole*|mlterm*|alacritty*|screen*|tmux*) ;;
|
||||||
contour*|foot*) ;;
|
contour*|foot*) ;;
|
||||||
*)
|
*)
|
||||||
# Terminal.app and iTerm2 process OSC 7 correctly
|
# Terminal.app and iTerm2 process OSC 7 correctly
|
||||||
|
|
|
||||||
169
lib/tests/cli.test.zsh
Normal file
169
lib/tests/cli.test.zsh
Normal file
|
|
@ -0,0 +1,169 @@
|
||||||
|
#!/usr/bin/zsh -df
|
||||||
|
|
||||||
|
run_awk() {
|
||||||
|
local -a dis_plugins=(${=1})
|
||||||
|
local input_text="$2"
|
||||||
|
|
||||||
|
(( ! 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
|
||||||
|
|
||||||
|
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
|
||||||
|
"
|
||||||
|
# Disable plugins awk script
|
||||||
|
local awk_script="
|
||||||
|
# if plugins=() is in oneline form, substitute disabled plugins and go to next line
|
||||||
|
/^[ \t]*plugins=\([^#]+\).*\$/ {
|
||||||
|
$awk_subst_plugins
|
||||||
|
print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
# if plugins=() is in multiline form, enable multi flag and disable plugins if they're there
|
||||||
|
/^[ \t]*plugins=\(/ {
|
||||||
|
multi=1
|
||||||
|
$awk_subst_plugins
|
||||||
|
print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
# if multi flag is enabled and we find a valid closing parenthesis, remove plugins and disable multi flag
|
||||||
|
multi == 1 && /^[^#]*\)/ {
|
||||||
|
multi=0
|
||||||
|
$awk_subst_plugins
|
||||||
|
print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
multi == 1 && length(\$0) > 0 {
|
||||||
|
$awk_subst_plugins
|
||||||
|
if (length(\$0) > 0) print \$0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
{ print \$0 }
|
||||||
|
"
|
||||||
|
|
||||||
|
command awk "$awk_script" <<< "$input_text"
|
||||||
|
|
||||||
|
(( ! DEBUG )) || set +xv
|
||||||
|
}
|
||||||
|
|
||||||
|
# runs awk against stdin, checks if the resulting file is not empty and then checks if the file has valid zsh syntax
|
||||||
|
run_awk_and_test() {
|
||||||
|
local description="$1"
|
||||||
|
local plugins_to_disable="$2"
|
||||||
|
local input_text="$3"
|
||||||
|
local expected_output="$4"
|
||||||
|
|
||||||
|
local tmpfile==(:)
|
||||||
|
|
||||||
|
{
|
||||||
|
print -u2 "Test: $description"
|
||||||
|
DEBUG=0 run_awk "$plugins_to_disable" "$input_text" >| $tmpfile
|
||||||
|
|
||||||
|
if [[ ! -s "$tmpfile" ]]; then
|
||||||
|
print -u2 "\e[31mError\e[0m: output file empty"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! zsh -n $tmpfile; then
|
||||||
|
print -u2 "\e[31mError\e[0m: zsh syntax error"
|
||||||
|
diff -u $tmpfile <(echo "$expected_output")
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! diff -u --color=always $tmpfile <(echo "$expected_output"); then
|
||||||
|
if (( DEBUG )); then
|
||||||
|
print -u2 ""
|
||||||
|
DEBUG=1 run_awk "$plugins_to_disable" "$input_text"
|
||||||
|
print -u2 ""
|
||||||
|
fi
|
||||||
|
print -u2 "\e[31mError\e[0m: output file does not match expected output"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
print -u2 "\e[32mSuccess\e[0m"
|
||||||
|
} always {
|
||||||
|
print -u2 ""
|
||||||
|
command rm -f "$tmpfile"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# These tests are for the `omz plugin disable` command
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete a single plugin in oneline format" \
|
||||||
|
"git" \
|
||||||
|
"plugins=(git)" \
|
||||||
|
"plugins=()"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete a single plugin in multiline format" \
|
||||||
|
"github" \
|
||||||
|
"plugins=(
|
||||||
|
github
|
||||||
|
)" \
|
||||||
|
"plugins=(
|
||||||
|
)"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete multiple plugins in oneline format" \
|
||||||
|
"github git z" \
|
||||||
|
"plugins=(github git z)" \
|
||||||
|
"plugins=()"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete multiple plugins in multiline format" \
|
||||||
|
"github git z" \
|
||||||
|
"plugins=(
|
||||||
|
github
|
||||||
|
git
|
||||||
|
z
|
||||||
|
)" \
|
||||||
|
"plugins=(
|
||||||
|
)"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete a single plugin among multiple in oneline format" \
|
||||||
|
"git" \
|
||||||
|
"plugins=(github git z)" \
|
||||||
|
"plugins=(github z)"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete a single plugin among multiple in multiline format" \
|
||||||
|
"git" \
|
||||||
|
"plugins=(
|
||||||
|
github
|
||||||
|
git
|
||||||
|
z
|
||||||
|
)" \
|
||||||
|
"plugins=(
|
||||||
|
github
|
||||||
|
z
|
||||||
|
)"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete multiple plugins in mixed format" \
|
||||||
|
"git z" \
|
||||||
|
"plugins=(github
|
||||||
|
git z)" \
|
||||||
|
"plugins=(github
|
||||||
|
)"
|
||||||
|
|
||||||
|
run_awk_and_test \
|
||||||
|
"it should delete multiple plugins in mixed format 2" \
|
||||||
|
"github z" \
|
||||||
|
"plugins=(github
|
||||||
|
git
|
||||||
|
z)" \
|
||||||
|
"plugins=(
|
||||||
|
git
|
||||||
|
)"
|
||||||
|
|
@ -152,7 +152,7 @@ unset zcompdump_revision zcompdump_fpath zcompdump_refresh
|
||||||
# zcompile the completion dump file if the .zwc is older or missing.
|
# zcompile the completion dump file if the .zwc is older or missing.
|
||||||
if command mkdir "${ZSH_COMPDUMP}.lock" 2>/dev/null; then
|
if command mkdir "${ZSH_COMPDUMP}.lock" 2>/dev/null; then
|
||||||
zrecompile -q -p "$ZSH_COMPDUMP"
|
zrecompile -q -p "$ZSH_COMPDUMP"
|
||||||
command rm -rf "$ZSH_COMPDUMP.zwc.old" "${ZSH_COMPDUMP}.lock"
|
command rm -rf "$ZSH_COMPDUMP.zwc.old" "${ZSH_COMPDUMP}.lock"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_omz_source() {
|
_omz_source() {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ plugins=(... ansible)
|
||||||
| `acon` | command `ansible-console` |
|
| `acon` | command `ansible-console` |
|
||||||
| `ainv` | command `ansible-inventory` |
|
| `ainv` | command `ansible-inventory` |
|
||||||
| `aplaybook` | command `ansible-playbook` |
|
| `aplaybook` | command `ansible-playbook` |
|
||||||
| `ainv` | command `ansible-inventory` |
|
|
||||||
| `adoc` | command `ansible-doc` |
|
| `adoc` | command `ansible-doc` |
|
||||||
| `agal` | command `ansible-galaxy` |
|
| `agal` | command `ansible-galaxy` |
|
||||||
| `apull` | command `ansible-pull` |
|
| `apull` | command `ansible-pull` |
|
||||||
|
|
@ -29,6 +28,6 @@ plugins=(... ansible)
|
||||||
|
|
||||||
## Maintainer
|
## Maintainer
|
||||||
|
|
||||||
### [Deepankumar](https://github.com/deepan10)
|
### [Deepankumar](https://github.com/deepan10)
|
||||||
|
|
||||||
[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin)
|
[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin)
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,8 @@ fi
|
||||||
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
|
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
|
||||||
function upgrade() {
|
function upgrade() {
|
||||||
echo ":: Checking Arch Linux PGP Keyring..."
|
echo ":: Checking Arch Linux PGP Keyring..."
|
||||||
local installedver="$(sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||||
local currentver="$(sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
local currentver="$(LANG= sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||||
if [ $installedver != $currentver ]; then
|
if [ $installedver != $currentver ]; then
|
||||||
echo " Arch Linux PGP Keyring is out of date."
|
echo " Arch Linux PGP Keyring is out of date."
|
||||||
echo " Updating before full system upgrade."
|
echo " Updating before full system upgrade."
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@ autojump_paths=(
|
||||||
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
|
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
|
||||||
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
|
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
|
||||||
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
|
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
|
||||||
|
/opt/pkg/share/autojump/autojump.zsh # macOS with pkgsrc
|
||||||
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
|
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
|
||||||
|
/nix/var/nix/gcroots/current-system/sw/share/zsh/site-functions/autojump.zsh # macOS Nix, nix-darwin
|
||||||
)
|
)
|
||||||
|
|
||||||
for file in $autojump_paths; do
|
for file in $autojump_paths; do
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,11 @@ plugins=(... aws)
|
||||||
Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
|
Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
|
||||||
see the AWS profile/region prompt.
|
see the AWS profile/region prompt.
|
||||||
|
|
||||||
|
* Set `AWS_PROFILE_STATE_ENABLED=true` in your zshrc file if you want the aws profile to persist between shell sessions.
|
||||||
|
This option might slow down your shell startup time.
|
||||||
|
By default the state file path is `/tmp/.aws_current_profile`. This means that the state won't survive a reboot or otherwise GC.
|
||||||
|
You can control the state file path using the `AWS_STATE_FILE` environment variable.
|
||||||
|
|
||||||
## Theme
|
## Theme
|
||||||
|
|
||||||
The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
|
The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,26 @@ function agr() {
|
||||||
echo $AWS_REGION
|
echo $AWS_REGION
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Update state file if enabled
|
||||||
|
function _aws_update_state() {
|
||||||
|
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||||
|
test -d $(dirname ${AWS_STATE_FILE}) || exit 1
|
||||||
|
echo "${AWS_PROFILE} ${AWS_REGION}" > "${AWS_STATE_FILE}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function _aws_clear_state() {
|
||||||
|
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||||
|
test -d $(dirname ${AWS_STATE_FILE}) || exit 1
|
||||||
|
echo -n > "${AWS_STATE_FILE}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# AWS profile selection
|
# AWS profile selection
|
||||||
function asp() {
|
function asp() {
|
||||||
if [[ -z "$1" ]]; then
|
if [[ -z "$1" ]]; then
|
||||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE AWS_PROFILE_REGION
|
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE AWS_PROFILE_REGION
|
||||||
|
_aws_clear_state
|
||||||
echo AWS profile cleared.
|
echo AWS profile cleared.
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -28,6 +44,8 @@ function asp() {
|
||||||
|
|
||||||
export AWS_PROFILE_REGION=$(aws configure get region)
|
export AWS_PROFILE_REGION=$(aws configure get region)
|
||||||
|
|
||||||
|
_aws_update_state
|
||||||
|
|
||||||
if [[ "$2" == "login" ]]; then
|
if [[ "$2" == "login" ]]; then
|
||||||
if [[ -n "$3" ]]; then
|
if [[ -n "$3" ]]; then
|
||||||
aws sso login --sso-session $3
|
aws sso login --sso-session $3
|
||||||
|
|
@ -43,6 +61,7 @@ function asp() {
|
||||||
function asr() {
|
function asr() {
|
||||||
if [[ -z "$1" ]]; then
|
if [[ -z "$1" ]]; then
|
||||||
unset AWS_DEFAULT_REGION AWS_REGION
|
unset AWS_DEFAULT_REGION AWS_REGION
|
||||||
|
_aws_update_state
|
||||||
echo AWS region cleared.
|
echo AWS region cleared.
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -56,6 +75,7 @@ function asr() {
|
||||||
|
|
||||||
export AWS_REGION=$1
|
export AWS_REGION=$1
|
||||||
export AWS_DEFAULT_REGION=$1
|
export AWS_DEFAULT_REGION=$1
|
||||||
|
_aws_update_state
|
||||||
}
|
}
|
||||||
|
|
||||||
# AWS profile switch
|
# AWS profile switch
|
||||||
|
|
@ -202,8 +222,17 @@ function aws_change_access_key() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function aws_regions() {
|
function aws_regions() {
|
||||||
|
local region
|
||||||
|
if [[ $AWS_DEFAULT_REGION ]];then
|
||||||
|
region="$AWS_DEFAULT_REGION"
|
||||||
|
elif [[ $AWS_REGION ]];then
|
||||||
|
region="$AWS_REGION"
|
||||||
|
else
|
||||||
|
region="us-west-1"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $AWS_DEFAULT_PROFILE || $AWS_PROFILE ]];then
|
if [[ $AWS_DEFAULT_PROFILE || $AWS_PROFILE ]];then
|
||||||
aws ec2 describe-regions |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
|
aws ec2 describe-regions --region $region |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
|
||||||
else
|
else
|
||||||
echo "You must specify a AWS profile."
|
echo "You must specify a AWS profile."
|
||||||
fi
|
fi
|
||||||
|
|
@ -246,6 +275,22 @@ if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; th
|
||||||
RPROMPT='$(aws_prompt_info)'"$RPROMPT"
|
RPROMPT='$(aws_prompt_info)'"$RPROMPT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||||
|
AWS_STATE_FILE="${AWS_STATE_FILE:-/tmp/.aws_current_profile}"
|
||||||
|
test -s "${AWS_STATE_FILE}" || return
|
||||||
|
|
||||||
|
aws_state=($(cat $AWS_STATE_FILE))
|
||||||
|
|
||||||
|
export AWS_DEFAULT_PROFILE="${aws_state[1]}"
|
||||||
|
export AWS_PROFILE="$AWS_DEFAULT_PROFILE"
|
||||||
|
export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE"
|
||||||
|
|
||||||
|
test -z "${aws_state[2]}" && AWS_REGION=$(aws configure get region)
|
||||||
|
|
||||||
|
export AWS_REGION=${AWS_REGION:-$aws_state[2]}
|
||||||
|
export AWS_DEFAULT_REGION="$AWS_REGION"
|
||||||
|
fi
|
||||||
|
|
||||||
# Load awscli completions
|
# Load awscli completions
|
||||||
|
|
||||||
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
|
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
# Bazel plugin
|
# Bazel plugin
|
||||||
|
|
||||||
This plugin adds completion for [bazel](https://bazel.build), an open-source build and
|
This plugin adds completion and aliases for [bazel](https://bazel.build), an open-source build and test tool that scalably supports multi-language and multi-platform projects.
|
||||||
test tool that scalably supports multi-language and multi-platform projects.
|
|
||||||
|
|
||||||
To use it, add `bazel` to the plugins array in your zshrc file:
|
To use it, add `bazel` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
|
@ -12,3 +11,12 @@ plugins=(... bazel)
|
||||||
The plugin has a copy of [the completion script from the git repository][1].
|
The plugin has a copy of [the completion script from the git repository][1].
|
||||||
|
|
||||||
[1]: https://github.com/bazelbuild/bazel/blob/master/scripts/zsh_completion/_bazel
|
[1]: https://github.com/bazelbuild/bazel/blob/master/scripts/zsh_completion/_bazel
|
||||||
|
|
||||||
|
## Aliases
|
||||||
|
|
||||||
|
| Alias | Command | Description |
|
||||||
|
| ------- | -------------------------------------- | ------------------------------------------------------ |
|
||||||
|
| bzb | `bazel build` | The `bazel build` command |
|
||||||
|
| bzt | `bazel test` | The `bazel test` command |
|
||||||
|
| bzr | `bazel run` | The `bazel run` command |
|
||||||
|
| bzq | `bazel query` | The `bazel query` command |
|
||||||
|
|
|
||||||
5
plugins/bazel/bazel.plugin.zsh
Normal file
5
plugins/bazel/bazel.plugin.zsh
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Aliases for bazel
|
||||||
|
alias bzb='bazel build'
|
||||||
|
alias bzt='bazel test'
|
||||||
|
alias bzr='bazel run'
|
||||||
|
alias bzq='bazel query'
|
||||||
|
|
@ -117,7 +117,7 @@ function bgnotify {
|
||||||
local icon="$3"
|
local icon="$3"
|
||||||
if (( ${+commands[terminal-notifier]} )); then # macOS
|
if (( ${+commands[terminal-notifier]} )); then # macOS
|
||||||
local term_id=$(bgnotify_programid)
|
local term_id=$(bgnotify_programid)
|
||||||
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id" -sender "$term_id"} &>/dev/null
|
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id"} &>/dev/null
|
||||||
elif (( ${+commands[growlnotify]} )); then # macOS growl
|
elif (( ${+commands[growlnotify]} )); then # macOS growl
|
||||||
growlnotify -m "$title" "$message"
|
growlnotify -m "$title" "$message"
|
||||||
elif (( ${+commands[notify-send]} )); then
|
elif (( ${+commands[notify-send]} )); then
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ index 2fd5f2cd..9d89a464 100644
|
||||||
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
|
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
|
||||||
-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
|
-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
|
||||||
+PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)'
|
+PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)'
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ fi
|
||||||
|
|
||||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
alias bcubc='brew upgrade --cask && brew cleanup'
|
||||||
alias bcubo='brew update && brew outdated --cask'
|
alias bcubo='brew update && brew outdated --cask'
|
||||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
|
||||||
alias brewp='brew pin'
|
alias brewp='brew pin'
|
||||||
alias brewsp='brew list --pinned'
|
alias brewsp='brew list --pinned'
|
||||||
alias bubc='brew upgrade && brew cleanup'
|
alias bubc='brew upgrade && brew cleanup'
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#compdef bundle
|
#compdef bundle bundler
|
||||||
|
|
||||||
local curcontext="$curcontext" state line _gems _opts ret=1
|
local curcontext="$curcontext" state line _gems _opts ret=1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# catimg
|
# catimg
|
||||||
|
|
||||||
Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
|
Plugin for displaying images on the terminal using the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
|
||||||
|
|
||||||
To use it, add `catimg` to the plugins array in your zshrc file:
|
To use it, add `catimg` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
_source-from-omz-settings() {
|
_source-from-omz-settings() {
|
||||||
local _chruby_path _chruby_auto
|
local _chruby_path _chruby_auto
|
||||||
|
|
||||||
zstyle -s :omz:plugins:chruby path _chruby_path || return 1
|
zstyle -s :omz:plugins:chruby path _chruby_path || return 1
|
||||||
zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1
|
zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@ _source-from-homebrew() {
|
||||||
if [[ -h /usr/local/opt/chruby ]];then
|
if [[ -h /usr/local/opt/chruby ]];then
|
||||||
_brew_prefix="/usr/local/opt/chruby"
|
_brew_prefix="/usr/local/opt/chruby"
|
||||||
else
|
else
|
||||||
# ok , it is not default prefix
|
# ok , it is not default prefix
|
||||||
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
|
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
|
||||||
_brew_prefix=$(brew --prefix chruby)
|
_brew_prefix=$(brew --prefix chruby)
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ Alternatively, seek out the [online documentation][3]. And don't forget, there a
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
Contributed to `oh_my_zsh` by [benwilcock][2].
|
Contributed to `oh_my_zsh` by [benwilcock][2].
|
||||||
|
|
||||||
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
|
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
|
||||||
[2]: https://github.com/benwilcock
|
[2]: https://github.com/benwilcock
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ Also provides the following aliases:
|
||||||
* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want
|
* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want
|
||||||
to run the code in a JS console.
|
to run the code in a JS console.
|
||||||
|
|
||||||
* **cfp:** Compiles from your currently copied clipboard. Useful when you want
|
* **cfp:** Compiles from your currently copied clipboard. Useful when you want
|
||||||
to compile large/multi-line snippets
|
to compile large/multi-line snippets
|
||||||
|
|
||||||
* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the
|
* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
if (( ${+commands[compleat]} )); then
|
if (( ${+commands[compleat]} )); then
|
||||||
local prefix="${commands[compleat]:h:h}"
|
local prefix="${commands[compleat]:h:h}"
|
||||||
local setup="${prefix}/share/compleat-1.0/compleat_setup"
|
local setup="${prefix}/share/compleat-1.0/compleat_setup"
|
||||||
|
|
||||||
if [[ -f "$setup" ]]; then
|
if [[ -f "$setup" ]]; then
|
||||||
if ! bashcompinit >/dev/null 2>&1; then
|
if ! bashcompinit >/dev/null 2>&1; then
|
||||||
|
|
@ -15,6 +15,6 @@ if (( ${+commands[compleat]} )); then
|
||||||
bashcompinit -i
|
bashcompinit -i
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source "$setup"
|
source "$setup"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
# copy the active line from the command line buffer
|
# copy the active line from the command line buffer
|
||||||
# onto the system clipboard
|
# onto the system clipboard
|
||||||
|
|
||||||
copybuffer () {
|
copybuffer () {
|
||||||
if which clipcopy &>/dev/null; then
|
if builtin which clipcopy &>/dev/null; then
|
||||||
printf "%s" "$BUFFER" | clipcopy
|
printf "%s" "$BUFFER" | clipcopy
|
||||||
else
|
else
|
||||||
zle -M "clipcopy not found. Please make sure you have Oh My Zsh installed correctly."
|
zle -M "clipcopy not found. Please make sure you have Oh My Zsh installed correctly."
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ dash
|
||||||
|
|
||||||
- Query for something in dash app: `dash query`
|
- Query for something in dash app: `dash query`
|
||||||
```
|
```
|
||||||
dash golang
|
dash golang
|
||||||
```
|
```
|
||||||
|
|
||||||
- You can optionally provide a keyword: `dash [keyword:]query`
|
- You can optionally provide a keyword: `dash [keyword:]query`
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ __docker-compose_subcommand() {
|
||||||
'--resolve-image-digests[Pin image tags to digests.]' \
|
'--resolve-image-digests[Pin image tags to digests.]' \
|
||||||
'--services[Print the service names, one per line.]' \
|
'--services[Print the service names, one per line.]' \
|
||||||
'--volumes[Print the volume names, one per line.]' \
|
'--volumes[Print the volume names, one per line.]' \
|
||||||
'--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0
|
'--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' && ret=0
|
||||||
;;
|
;;
|
||||||
(create)
|
(create)
|
||||||
_arguments \
|
_arguments \
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,6 @@ fi
|
||||||
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
|
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
|
||||||
command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
|
command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
|
||||||
else
|
else
|
||||||
command docker completion zsh >| "$ZSH_CACHE_DIR/completions/_docker"
|
command docker completion zsh | tee "$ZSH_CACHE_DIR/completions/_docker" > /dev/null
|
||||||
fi
|
fi
|
||||||
} &|
|
} &|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ _dotnet_completion() {
|
||||||
compdef _dotnet_completion dotnet
|
compdef _dotnet_completion dotnet
|
||||||
|
|
||||||
# Aliases bellow are here for backwards compatibility
|
# Aliases bellow are here for backwards compatibility
|
||||||
# added by Shaun Tabone (https://github.com/xontab)
|
# added by Shaun Tabone (https://github.com/xontab)
|
||||||
|
|
||||||
alias dn='dotnet new'
|
alias dn='dotnet new'
|
||||||
alias dr='dotnet run'
|
alias dr='dotnet run'
|
||||||
|
|
|
||||||
|
|
@ -27,4 +27,4 @@ The plugin uses a custom launcher (which we'll call here `$EMACS_LAUNCHER`) that
|
||||||
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
|
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
|
||||||
| eframe | `emacsclient --alternate-editor="" --create-frame` | Create new X frame |
|
| eframe | `emacsclient --alternate-editor="" --create-frame` | Create new X frame |
|
||||||
| efile | - | Print the path to the file open in the current buffer |
|
| efile | - | Print the path to the file open in the current buffer |
|
||||||
| ecd | - | Print the directory of the file open in the the current buffer |
|
| ecd | - | Print the directory of the file open in the current buffer |
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ function efile {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Write to standard output the directory of the file
|
# Write to standard output the directory of the file
|
||||||
# opened in the the current buffer
|
# opened in the current buffer
|
||||||
function ecd {
|
function ecd {
|
||||||
local file
|
local file
|
||||||
file="$(efile)" || return $?
|
file="$(efile)" || return $?
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ unset _omz_emoji_plugin_dir
|
||||||
|
|
||||||
# This is a combining character that can be placed after any other character to surround
|
# This is a combining character that can be placed after any other character to surround
|
||||||
# it in a "keycap" symbol.
|
# it in a "keycap" symbol.
|
||||||
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
|
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
|
||||||
# It's unclear whether this should be in the $emoji array, because those characters are all ones
|
# It's unclear whether this should be in the $emoji array, because those characters are all ones
|
||||||
# which can be displayed on their own.
|
# which can be displayed on their own.
|
||||||
|
|
||||||
|
|
@ -63,9 +63,9 @@ function random_emoji() {
|
||||||
[[ $list_size -eq 0 ]] && return 1
|
[[ $list_size -eq 0 ]] && return 1
|
||||||
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
|
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
|
||||||
local name=${names[$random_index]}
|
local name=${names[$random_index]}
|
||||||
if [[ "$group" == "flags" ]]; then
|
if [[ "$group" == "flags" ]]; then
|
||||||
echo ${emoji_flags[$name]}
|
echo ${emoji_flags[$name]}
|
||||||
else
|
else
|
||||||
echo ${emoji[$name]}
|
echo ${emoji[$name]}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -86,22 +86,22 @@ function display_emoji() {
|
||||||
# terminals treat these emoji chars as single-width.
|
# terminals treat these emoji chars as single-width.
|
||||||
local counter=1
|
local counter=1
|
||||||
for i in $names; do
|
for i in $names; do
|
||||||
if [[ "$group" == "flags" ]]; then
|
if [[ "$group" == "flags" ]]; then
|
||||||
printf '%s ' "$emoji_flags[$i]"
|
printf '%s ' "$emoji_flags[$i]"
|
||||||
else
|
else
|
||||||
printf '%s ' "$emoji[$i]"
|
printf '%s ' "$emoji[$i]"
|
||||||
fi
|
fi
|
||||||
# New line every 20 emoji, to avoid weirdnesses
|
# New line every 20 emoji, to avoid weirdnesses
|
||||||
if (($counter % 20 == 0)); then
|
if (($counter % 20 == 0)); then
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
fi
|
||||||
let counter=$counter+1
|
let counter=$counter+1
|
||||||
done
|
done
|
||||||
print
|
print
|
||||||
for i in $names; do
|
for i in $names; do
|
||||||
if [[ "$group" == "flags" ]]; then
|
if [[ "$group" == "flags" ]]; then
|
||||||
echo "${emoji_flags[$i]} = $i"
|
echo "${emoji_flags[$i]} = $i"
|
||||||
else
|
else
|
||||||
echo "${emoji[$i]} = $i"
|
echo "${emoji[$i]} = $i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
|
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
|
||||||
# VERSION: 1.0.0
|
# VERSION: 1.0.0
|
||||||
# DEPENDS: emoji plugin
|
# DEPENDS: emoji plugin
|
||||||
#
|
#
|
||||||
# There are different sets of emoji characters available, to choose a different
|
# There are different sets of emoji characters available, to choose a different
|
||||||
# set export emotty_set to the name of the set you would like to use, e.g.:
|
# set export emotty_set to the name of the set you would like to use, e.g.:
|
||||||
# % export emotty_set=nature
|
# % export emotty_set=nature
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ plugins=(... encode64)
|
||||||
|
|
||||||
### Encoding a file
|
### Encoding a file
|
||||||
|
|
||||||
Encode a file's contents to base64 and save output to text file.
|
Encode a file's contents to base64 and save output to text file.
|
||||||
**NOTE:** Takes provided file and saves encoded content as new file with `.txt` extension
|
**NOTE:** Takes provided file and saves encoded content as new file with `.txt` extension
|
||||||
|
|
||||||
- From parameter
|
- From parameter
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ EOF
|
||||||
(*.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" ;;
|
||||||
(*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;;
|
(*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;;
|
||||||
(*.bz2) bunzip2 "$full_path" ;;
|
(*.bz2) (( $+commands[pbzip2] )) && pbzip2 -d "$full_path" || bunzip2 "$full_path" ;;
|
||||||
(*.xz) unxz "$full_path" ;;
|
(*.xz) unxz "$full_path" ;;
|
||||||
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
|
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
|
||||||
(*.lz4) lz4 -d "$full_path" ;;
|
(*.lz4) lz4 -d "$full_path" ;;
|
||||||
|
|
@ -80,14 +80,14 @@ EOF
|
||||||
(*.rar) unrar x -ad "$full_path" ;;
|
(*.rar) unrar x -ad "$full_path" ;;
|
||||||
(*.rpm)
|
(*.rpm)
|
||||||
rpm2cpio "$full_path" | cpio --quiet -id ;;
|
rpm2cpio "$full_path" | cpio --quiet -id ;;
|
||||||
(*.7z) 7za x "$full_path" ;;
|
(*.7z | *.7z.[0-9]*) 7za x "$full_path" ;;
|
||||||
(*.deb)
|
(*.deb)
|
||||||
command mkdir -p "control" "data"
|
command mkdir -p "control" "data"
|
||||||
ar vx "$full_path" > /dev/null
|
ar vx "$full_path" > /dev/null
|
||||||
builtin cd -q control; extract ../control.tar.*
|
builtin cd -q control; extract ../control.tar.*
|
||||||
builtin cd -q ../data; extract ../data.tar.*
|
builtin cd -q ../data; extract ../data.tar.*
|
||||||
builtin cd -q ..; command rm *.tar.* debian-binary ;;
|
builtin cd -q ..; command rm *.tar.* debian-binary ;;
|
||||||
(*.zst) unzstd "$full_path" ;;
|
(*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;;
|
||||||
(*.cab|*.exe) cabextract "$full_path" ;;
|
(*.cab|*.exe) cabextract "$full_path" ;;
|
||||||
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
|
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
|
||||||
(*.zpaq) zpaq x "$full_path" ;;
|
(*.zpaq) zpaq x "$full_path" ;;
|
||||||
|
|
|
||||||
111
plugins/eza/README.md
Normal file
111
plugins/eza/README.md
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
# eza plugin
|
||||||
|
|
||||||
|
This provides aliases that invoke the [`eza`](https://github.com/eza-community/eza) utility rather than `ls`
|
||||||
|
|
||||||
|
To use it add `eza` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... eza)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
All configurations are done using the `zstyle` command in the `:omz:plugins:eza` namespace.
|
||||||
|
|
||||||
|
**NOTE:** The configuring needs to be done prior to OMZ loading the plugins. When the plugin is loaded,
|
||||||
|
changing the `zstyle` won't have any effect.
|
||||||
|
|
||||||
|
### `dirs-first`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'dirs-first' yes|no
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yes`, directories will be grouped first.
|
||||||
|
|
||||||
|
Default: `no`
|
||||||
|
|
||||||
|
### `git-status`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'git-status' yes|no
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yes`, always add `--git` flag to indicate git status (if tracked / in a git repo).
|
||||||
|
|
||||||
|
Default: `no`
|
||||||
|
|
||||||
|
### `header`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'header' yes|no
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yes`, always add `-h` flag to add a header row for each column.
|
||||||
|
|
||||||
|
Default: `no`
|
||||||
|
|
||||||
|
### `show-group`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'show-group' yes|no
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yes` (default), always add `-g` flag to show the group ownership.
|
||||||
|
|
||||||
|
Default: `yes`
|
||||||
|
|
||||||
|
### `icons`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'icons' yes|no
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yes`, sets the `--icons` option of `eza`, adding icons for files and folders.
|
||||||
|
|
||||||
|
Default: `no`
|
||||||
|
|
||||||
|
### `size-prefix`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'size-prefix' (binary|none|si)
|
||||||
|
```
|
||||||
|
|
||||||
|
Choose the prefix to be used in displaying file size:
|
||||||
|
|
||||||
|
- `binary` -- use [binary prefixes](https://en.wikipedia.org/wiki/Binary_prefix) such as "Ki", "Mi", "Gi" and
|
||||||
|
so on
|
||||||
|
- `none` -- don't use any prefix, show size in bytes
|
||||||
|
- `si` (default) -- use [Metric/S.I. prefixes](https://en.wikipedia.org/wiki/Metric_prefix)
|
||||||
|
|
||||||
|
Default: `si`
|
||||||
|
|
||||||
|
### `time-style`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'time-style' $TIME_STYLE
|
||||||
|
```
|
||||||
|
|
||||||
|
Sets the `--time-style` option of `eza`. (See `man eza` for the options)
|
||||||
|
|
||||||
|
Default: Not set, which means the default behavior of `eza` will take place.
|
||||||
|
|
||||||
|
## Aliases
|
||||||
|
|
||||||
|
**Notes:**
|
||||||
|
|
||||||
|
- Aliases may be modified by Configuration
|
||||||
|
- The term "files" without "only" qualifier means both files & directories
|
||||||
|
|
||||||
|
| Alias | Command | Description |
|
||||||
|
| ------ | ----------------- | -------------------------------------------------------------------------- |
|
||||||
|
| `la` | `eza -la` | List all files (except . and ..) as a long list |
|
||||||
|
| `ldot` | `eza -ld .*` | List dotfiles only (directories shown as entries instead of recursed into) |
|
||||||
|
| `lD` | `eza -lD` | List only directories (excluding dotdirs) as a long list |
|
||||||
|
| `lDD` | `eza -laD` | List only directories (including dotdirs) as a long list |
|
||||||
|
| `ll` | `eza -l` | List files as a long list |
|
||||||
|
| `ls` | `eza` | Plain eza call |
|
||||||
|
| `lsd` | `eza -d` | List specified files with directories as entries, in a grid |
|
||||||
|
| `lsdl` | `eza -dl` | List specified files with directories as entries, in a long list |
|
||||||
|
| `lS` | `eza -l -ssize` | List files as a long list, sorted by size |
|
||||||
|
| `lT` | `eza -l -snewest` | List files as a long list, sorted by date (newest last) |
|
||||||
65
plugins/eza/eza.plugin.zsh
Normal file
65
plugins/eza/eza.plugin.zsh
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
if ! (( $+commands[eza] )); then
|
||||||
|
print "zsh eza plugin: eza not found. Please install eza before using this plugin." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
typeset -a _EZA_HEAD
|
||||||
|
typeset -a _EZA_TAIL
|
||||||
|
|
||||||
|
function _configure_eza() {
|
||||||
|
local _val
|
||||||
|
# Get the head flags
|
||||||
|
if zstyle -T ':omz:plugins:eza' 'show-group'; then
|
||||||
|
_EZA_HEAD+=("g")
|
||||||
|
fi
|
||||||
|
if zstyle -t ':omz:plugins:eza' 'header'; then
|
||||||
|
_EZA_HEAD+=("h")
|
||||||
|
fi
|
||||||
|
zstyle -s ':omz:plugins:eza' 'size-prefix' _val
|
||||||
|
case "${_val:l}" in
|
||||||
|
binary)
|
||||||
|
_EZA_HEAD+=("b")
|
||||||
|
;;
|
||||||
|
none)
|
||||||
|
_EZA_HEAD+=("B")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# Get the tail long-options
|
||||||
|
if zstyle -t ':omz:plugins:eza' 'dirs-first'; then
|
||||||
|
_EZA_TAIL+=("--group-directories-first")
|
||||||
|
fi
|
||||||
|
if zstyle -t ':omz:plugins:eza' 'git-status'; then
|
||||||
|
_EZA_TAIL+=("--git")
|
||||||
|
fi
|
||||||
|
if zstyle -t ':omz:plugins:eza' 'icons'; then
|
||||||
|
_EZA_TAIL+=("--icons=auto")
|
||||||
|
fi
|
||||||
|
zstyle -s ':omz:plugins:eza' 'time-style' _val
|
||||||
|
if [[ $_val ]]; then
|
||||||
|
_EZA_TAIL+=("--time-style='$_val'")
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_configure_eza
|
||||||
|
|
||||||
|
function _alias_eza() {
|
||||||
|
local _head="${(j::)_EZA_HEAD}$2"
|
||||||
|
local _tail="${(j: :)_EZA_TAIL}"
|
||||||
|
alias "$1"="eza${_head:+ -}${_head}${_tail:+ }${_tail}${3:+ }$3"
|
||||||
|
}
|
||||||
|
|
||||||
|
_alias_eza la la
|
||||||
|
_alias_eza ldot ld ".*"
|
||||||
|
_alias_eza lD lD
|
||||||
|
_alias_eza lDD lDa
|
||||||
|
_alias_eza ll l
|
||||||
|
_alias_eza ls
|
||||||
|
_alias_eza lsd d
|
||||||
|
_alias_eza lsdl dl
|
||||||
|
_alias_eza lS "l -ssize"
|
||||||
|
_alias_eza lT "l -snewest"
|
||||||
|
|
||||||
|
unfunction _alias_eza
|
||||||
|
unfunction _configure_eza
|
||||||
|
unset _EZA_HEAD
|
||||||
|
unset _EZA_TAIL
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
# Use Ctrl-Z to switch back to Vim
|
# Use Ctrl-Z to switch back to Vim
|
||||||
|
|
||||||
I frequently need to execute random commands in my shell. To achieve it I pause
|
I frequently need to execute random commands in my shell. To achieve it I pause
|
||||||
Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim.
|
Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim.
|
||||||
The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
|
The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
|
||||||
to Vim. I could not find a solution, so I developed one on my own that
|
to Vim. I could not find a solution, so I developed one on my own that
|
||||||
works wonderfully with ZSH.
|
works wonderfully with ZSH.
|
||||||
|
|
||||||
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
|
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
|
||||||
|
|
||||||
Credits:
|
Credits:
|
||||||
- original idea by @sheerun
|
- original idea by @sheerun
|
||||||
- added to OMZ by @mbologna
|
- added to OMZ by @mbologna
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,13 +71,13 @@ them, add `<variable>=<value>` to your zshrc file, before Oh My Zsh is sourced.
|
||||||
For example: `fastfile_var_prefix='@'`.
|
For example: `fastfile_var_prefix='@'`.
|
||||||
|
|
||||||
- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
|
- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
|
||||||
created global aliases.
|
created global aliases.
|
||||||
**Default:** `§` (section sign), easy to type in a german keyboard via the combination
|
**Default:** `§` (section sign), easy to type in a german keyboard via the combination
|
||||||
[`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
|
[`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
|
||||||
or using `⌥ Option`+`6` in macOS.
|
or using `⌥ Option`+`6` in macOS.
|
||||||
|
|
||||||
- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
|
- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
|
||||||
with a trailing slash.
|
with a trailing slash.
|
||||||
**Default:** `$HOME/.fastfile/`.
|
**Default:** `$HOME/.fastfile/`.
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
|
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
|
||||||
# Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
|
# Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
|
||||||
# Updated to support ForkLift from Setapp by Paul Rudkin
|
# Updated to support ForkLift from Setapp by Paul Rudkin
|
||||||
|
# Updated to support ForkLift 4 by Michal Szymanski (misiektoja)
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# fl [<folder>]
|
# fl [<folder>]
|
||||||
|
|
@ -58,7 +59,7 @@ function fl {
|
||||||
tell application forkLiftSetapp
|
tell application forkLiftSetapp
|
||||||
activate
|
activate
|
||||||
set forkLiftVersion to version
|
set forkLiftVersion to version
|
||||||
end tell
|
end tell
|
||||||
else if forkLift3 is not null and application forkLift3 is running then
|
else if forkLift3 is not null and application forkLift3 is running then
|
||||||
tell application forkLift3
|
tell application forkLift3
|
||||||
activate
|
activate
|
||||||
|
|
@ -84,7 +85,7 @@ function fl {
|
||||||
else if forkLift is not null then
|
else if forkLift is not null then
|
||||||
set appName to forkLift
|
set appName to forkLift
|
||||||
end if
|
end if
|
||||||
|
|
||||||
tell application appName
|
tell application appName
|
||||||
activate
|
activate
|
||||||
set forkLiftVersion to version
|
set forkLiftVersion to version
|
||||||
|
|
@ -110,6 +111,11 @@ function fl {
|
||||||
tell pop over of list of group of splitter group of splitter group of topWindow
|
tell pop over of list of group of splitter group of splitter group of topWindow
|
||||||
set value of text field 1 to "$PWD"
|
set value of text field 1 to "$PWD"
|
||||||
end tell
|
end tell
|
||||||
|
else if forkLiftVersion starts with "4" then
|
||||||
|
tell pop over of list of group of splitter group of splitter group of topWindow
|
||||||
|
keystroke "$PWD"
|
||||||
|
delay 0.1
|
||||||
|
end tell
|
||||||
else
|
else
|
||||||
tell sheet 1 of topWindow
|
tell sheet 1 of topWindow
|
||||||
set value of text field 1 to "$PWD"
|
set value of text field 1 to "$PWD"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,16 @@
|
||||||
|
function fzf_setup_using_fzf() {
|
||||||
|
(( ${+commands[fzf]} )) || return 1
|
||||||
|
|
||||||
|
# we remove "fzf " prefix, this fixes really old fzf versions behaviour
|
||||||
|
# see https://github.com/ohmyzsh/ohmyzsh/issues/12387
|
||||||
|
local fzf_ver=${"$(fzf --version)"#fzf }
|
||||||
|
|
||||||
|
autoload -Uz is-at-least
|
||||||
|
is-at-least 0.48.0 ${${(s: :)fzf_ver}[1]} || return 1
|
||||||
|
|
||||||
|
eval "$(fzf --zsh)"
|
||||||
|
}
|
||||||
|
|
||||||
function fzf_setup_using_base_dir() {
|
function fzf_setup_using_base_dir() {
|
||||||
local fzf_base fzf_shell fzfdirs dir
|
local fzf_base fzf_shell fzfdirs dir
|
||||||
|
|
||||||
|
|
@ -8,6 +21,7 @@ function fzf_setup_using_base_dir() {
|
||||||
"${HOME}/.fzf"
|
"${HOME}/.fzf"
|
||||||
"${HOME}/.nix-profile/share/fzf"
|
"${HOME}/.nix-profile/share/fzf"
|
||||||
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
|
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
|
||||||
|
"${MSYSTEM_PREFIX}/share/fzf"
|
||||||
"/usr/local/opt/fzf"
|
"/usr/local/opt/fzf"
|
||||||
"/opt/homebrew/opt/fzf"
|
"/opt/homebrew/opt/fzf"
|
||||||
"/usr/share/fzf"
|
"/usr/share/fzf"
|
||||||
|
|
@ -61,7 +75,7 @@ function fzf_setup_using_base_dir() {
|
||||||
|
|
||||||
function fzf_setup_using_debian() {
|
function fzf_setup_using_debian() {
|
||||||
if (( ! $+commands[apt] && ! $+commands[apt-get] )); then
|
if (( ! $+commands[apt] && ! $+commands[apt-get] )); then
|
||||||
# Not a debian based distro
|
# Not a debian based distro
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -134,6 +148,27 @@ function fzf_setup_using_opensuse() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fzf_setup_using_fedora() {
|
||||||
|
(( $+commands[fzf] )) || return 1
|
||||||
|
|
||||||
|
local completions="/usr/share/zsh/site-functions/fzf"
|
||||||
|
local key_bindings="/usr/share/fzf/shell/key-bindings.zsh"
|
||||||
|
|
||||||
|
if [[ ! -f "$completions" || ! -f "$key_bindings" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
|
||||||
|
source "$completions" 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
|
||||||
|
source "$key_bindings" 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
function fzf_setup_using_openbsd() {
|
function fzf_setup_using_openbsd() {
|
||||||
# openBSD installs fzf in /usr/local/bin/fzf
|
# openBSD installs fzf in /usr/local/bin/fzf
|
||||||
if [[ "$OSTYPE" != openbsd* ]] || (( ! $+commands[fzf] )); then
|
if [[ "$OSTYPE" != openbsd* ]] || (( ! $+commands[fzf] )); then
|
||||||
|
|
@ -216,9 +251,11 @@ Please add `export FZF_BASE=/path/to/fzf/install/dir` to your .zshrc
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
fzf_setup_using_openbsd \
|
fzf_setup_using_fzf \
|
||||||
|
|| fzf_setup_using_openbsd \
|
||||||
|| fzf_setup_using_debian \
|
|| fzf_setup_using_debian \
|
||||||
|| fzf_setup_using_opensuse \
|
|| fzf_setup_using_opensuse \
|
||||||
|
|| fzf_setup_using_fedora \
|
||||||
|| fzf_setup_using_cygwin \
|
|| fzf_setup_using_cygwin \
|
||||||
|| fzf_setup_using_macports \
|
|| fzf_setup_using_macports \
|
||||||
|| fzf_setup_using_base_dir \
|
|| fzf_setup_using_base_dir \
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
||||||
"/usr/local/share/google-cloud-sdk"
|
"/usr/local/share/google-cloud-sdk"
|
||||||
"/usr/local/Caskroom/google-cloud-sdk/latest/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/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
||||||
|
"/opt/homebrew/share/google-cloud-sdk"
|
||||||
"/usr/share/google-cloud-sdk"
|
"/usr/share/google-cloud-sdk"
|
||||||
"/snap/google-cloud-sdk/current"
|
"/snap/google-cloud-sdk/current"
|
||||||
"/snap/google-cloud-cli/current"
|
"/snap/google-cloud-cli/current"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
# git-commit plugin
|
# 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 [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
|
The git-commit plugin adds several
|
||||||
|
[git aliases](https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-alias) 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:
|
To use it, add `git-commit` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
|
@ -11,11 +13,9 @@ plugins=(... git-commit)
|
||||||
## Syntax
|
## Syntax
|
||||||
|
|
||||||
```zsh
|
```zsh
|
||||||
git <type> [(-s, --scope) "<scope>"] "<message>"
|
git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] "<message>"
|
||||||
```
|
```
|
||||||
|
|
||||||
> ⚠️ Single/Double quotes around the scope and message are required
|
|
||||||
|
|
||||||
Where `type` is one of the following:
|
Where `type` is one of the following:
|
||||||
|
|
||||||
- `build`
|
- `build`
|
||||||
|
|
@ -29,14 +29,19 @@ Where `type` is one of the following:
|
||||||
- `rev`
|
- `rev`
|
||||||
- `style`
|
- `style`
|
||||||
- `test`
|
- `test`
|
||||||
|
- `wip`
|
||||||
|
|
||||||
> NOTE: the alias for `revert` type is `rev`, as otherwise it conflicts with the git command of the same name.
|
> 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>`
|
> It will still generate a commit message in the format `revert: <message>`
|
||||||
|
|
||||||
|
> ⚠️ Enabling this plugin will (potentially) overwrite all `alias.<type>` that you manually set. Use with
|
||||||
|
> care!
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
| Git alias | Command |
|
| Git alias | Command |
|
||||||
| --------------------------------------------- | ---------------------------------------------------- |
|
| --------------------------------------------- | ---------------------------------------------------- |
|
||||||
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
|
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
|
||||||
|
| `git wip "work in progress"` | `git commit -m "work in progress"` |
|
||||||
| `git fix -s "router" "correct redirect link"` | `git commit -m "fix(router): correct redirect link"` |
|
| `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 rev -s "api" "rollback v2"` | `git commit -m "revert(api): rollback v2"` |
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
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"
|
||||||
|
|
||||||
local -a _git_commit_aliases
|
local -a _git_commit_aliases
|
||||||
_git_commit_aliases=(
|
_git_commit_aliases=(
|
||||||
'build'
|
'build'
|
||||||
|
|
@ -11,21 +17,42 @@ _git_commit_aliases=(
|
||||||
'revert'
|
'revert'
|
||||||
'style'
|
'style'
|
||||||
'test'
|
'test'
|
||||||
|
'wip'
|
||||||
)
|
)
|
||||||
|
|
||||||
local alias type
|
local _alias _type
|
||||||
for type in "${_git_commit_aliases[@]}"; do
|
for _type in "${_git_commit_aliases[@]}"; do
|
||||||
# an alias can't be named "revert" because the git command takes precedence
|
# an alias can't be named "revert" because the git command takes precedence
|
||||||
# https://stackoverflow.com/a/3538791
|
# https://stackoverflow.com/a/3538791
|
||||||
case "$type" in
|
case "$_type" in
|
||||||
revert) alias=rev ;;
|
revert) _alias=rev ;;
|
||||||
*) alias=$type ;;
|
*) _alias=$_type ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
local func='!a() { if [ "$1" = "-s" ] || [ "$1" = "--scope" ]; then local scope="$2"; shift 2; git commit -m "'$type'(${scope}): ${@}"; else git commit -m "'$type': ${@}"; fi }; a'
|
local _func='!a() {
|
||||||
if ! git config --global --get-all alias.${alias} >/dev/null 2>&1; then
|
local _scope _attention _message
|
||||||
git config --global alias.${alias} "$func"
|
while [ $# -ne 0 ]; do
|
||||||
fi
|
case $1 in
|
||||||
|
-s | --scope )
|
||||||
|
if [ -z $2 ]; then
|
||||||
|
echo "Missing scope!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_scope="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-a | --attention )
|
||||||
|
_attention="!"
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
_message="${_message} $1"
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
git commit -m "'$_type'${_scope:+(${_scope})}${_attention}:${_message}"
|
||||||
|
}; a'
|
||||||
|
|
||||||
unset _git_commit_aliases alias type func
|
git config --global alias.$_alias "$_func"
|
||||||
|
done
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ To use it, add `git-prompt` to the plugins array in your zshrc file:
|
||||||
plugins=(... git-prompt)
|
plugins=(... git-prompt)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You may also need to [customize your theme](https://github.com/ohmyzsh/ohmyzsh/issues/9395#issuecomment-1027130429)
|
||||||
|
to change the way the prompt is built. See the
|
||||||
|
[OMZ wiki on customizing themes](https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes).
|
||||||
|
|
||||||
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
|
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@ plugins=(... git)
|
||||||
| `gba` | `git branch --all` |
|
| `gba` | `git branch --all` |
|
||||||
| `gbd` | `git branch --delete` |
|
| `gbd` | `git branch --delete` |
|
||||||
| `gbD` | `git branch --delete --force` |
|
| `gbD` | `git branch --delete --force` |
|
||||||
| `gbgd` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| awk '"'"'{print $1}'"'"' \| xargs git branch -d` |
|
| `gbgd` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| cut -c 3- \| awk '"'"'{print $1}'"'"' \| xargs git branch -d` |
|
||||||
| `gbgD` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| awk '"'"'{print $1}'"'"' \| xargs git branch -D` |
|
| `gbgD` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| cut -c 3- \| awk '"'"'{print $1}'"'"' \| xargs git branch -D` |
|
||||||
| `gbm` | `git branch --move` |
|
| `gbm` | `git branch --move` |
|
||||||
| `gbnm` | `git branch --no-merged` |
|
| `gbnm` | `git branch --no-merged` |
|
||||||
| `gbr` | `git branch --remote` |
|
| `gbr` | `git branch --remote` |
|
||||||
|
|
@ -111,6 +111,7 @@ plugins=(... git)
|
||||||
| `gfg` | `git ls-files \| grep` |
|
| `gfg` | `git ls-files \| grep` |
|
||||||
| `gm` | `git merge` |
|
| `gm` | `git merge` |
|
||||||
| `gma` | `git merge --abort` |
|
| `gma` | `git merge --abort` |
|
||||||
|
| `gmc` | `git merge --continue` |
|
||||||
| `gms` | `git merge --squash` |
|
| `gms` | `git merge --squash` |
|
||||||
| `gmom` | `git merge origin/$(git_main_branch)` |
|
| `gmom` | `git merge origin/$(git_main_branch)` |
|
||||||
| `gmum` | `git merge upstream/$(git_main_branch)` |
|
| `gmum` | `git merge upstream/$(git_main_branch)` |
|
||||||
|
|
@ -152,6 +153,7 @@ plugins=(... git)
|
||||||
| `grbd` | `git rebase $(git_develop_branch)` |
|
| `grbd` | `git rebase $(git_develop_branch)` |
|
||||||
| `grbm` | `git rebase $(git_main_branch)` |
|
| `grbm` | `git rebase $(git_main_branch)` |
|
||||||
| `grbom` | `git rebase origin/$(git_main_branch)` |
|
| `grbom` | `git rebase origin/$(git_main_branch)` |
|
||||||
|
| `grf` | `git reflog` |
|
||||||
| `gr` | `git remote` |
|
| `gr` | `git remote` |
|
||||||
| `grv` | `git remote --verbose` |
|
| `grv` | `git remote --verbose` |
|
||||||
| `gra` | `git remote add` |
|
| `gra` | `git remote add` |
|
||||||
|
|
@ -165,6 +167,7 @@ plugins=(... git)
|
||||||
| `grhk` | `git reset --keep` |
|
| `grhk` | `git reset --keep` |
|
||||||
| `grhs` | `git reset --soft` |
|
| `grhs` | `git reset --soft` |
|
||||||
| `gpristine` | `git reset --hard && git clean --force -dfx` |
|
| `gpristine` | `git reset --hard && git clean --force -dfx` |
|
||||||
|
| `gwipe` | `git reset --hard && git clean --force -df` |
|
||||||
| `groh` | `git reset origin/$(git_current_branch) --hard` |
|
| `groh` | `git reset origin/$(git_current_branch) --hard` |
|
||||||
| `grs` | `git restore` |
|
| `grs` | `git restore` |
|
||||||
| `grss` | `git restore --source` |
|
| `grss` | `git restore --source` |
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ function git_develop_branch() {
|
||||||
function git_main_branch() {
|
function git_main_branch() {
|
||||||
command git rev-parse --git-dir &>/dev/null || return
|
command git rev-parse --git-dir &>/dev/null || return
|
||||||
local ref
|
local ref
|
||||||
for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default,master}; do
|
for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default,stable,master}; do
|
||||||
if command git show-ref -q --verify $ref; then
|
if command git show-ref -q --verify $ref; then
|
||||||
echo ${ref:t}
|
echo ${ref:t}
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -147,8 +147,8 @@ function gbds() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
alias gbgd='LANG=C git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -d'
|
alias gbgd='LANG=C git branch --no-color -vv | grep ": gone\]" | cut -c 3- | awk '"'"'{print $1}'"'"' | xargs git branch -d'
|
||||||
alias gbgD='LANG=C git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -D'
|
alias gbgD='LANG=C git branch --no-color -vv | grep ": gone\]" | cut -c 3- | awk '"'"'{print $1}'"'"' | xargs git branch -D'
|
||||||
alias gbm='git branch --move'
|
alias gbm='git branch --move'
|
||||||
alias gbnm='git branch --no-merged'
|
alias gbnm='git branch --no-merged'
|
||||||
alias gbr='git branch --remote'
|
alias gbr='git branch --remote'
|
||||||
|
|
@ -252,6 +252,7 @@ alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
||||||
alias gfg='git ls-files | grep'
|
alias gfg='git ls-files | grep'
|
||||||
alias gm='git merge'
|
alias gm='git merge'
|
||||||
alias gma='git merge --abort'
|
alias gma='git merge --abort'
|
||||||
|
alias gmc='git merge --continue'
|
||||||
alias gms="git merge --squash"
|
alias gms="git merge --squash"
|
||||||
alias gmom='git merge origin/$(git_main_branch)'
|
alias gmom='git merge origin/$(git_main_branch)'
|
||||||
alias gmum='git merge upstream/$(git_main_branch)'
|
alias gmum='git merge upstream/$(git_main_branch)'
|
||||||
|
|
@ -335,6 +336,7 @@ alias grbs='git rebase --skip'
|
||||||
alias grbd='git rebase $(git_develop_branch)'
|
alias grbd='git rebase $(git_develop_branch)'
|
||||||
alias grbm='git rebase $(git_main_branch)'
|
alias grbm='git rebase $(git_main_branch)'
|
||||||
alias grbom='git rebase origin/$(git_main_branch)'
|
alias grbom='git rebase origin/$(git_main_branch)'
|
||||||
|
alias grf='git reflog'
|
||||||
alias gr='git remote'
|
alias gr='git remote'
|
||||||
alias grv='git remote --verbose'
|
alias grv='git remote --verbose'
|
||||||
alias gra='git remote add'
|
alias gra='git remote add'
|
||||||
|
|
@ -348,6 +350,7 @@ alias grhh='git reset --hard'
|
||||||
alias grhk='git reset --keep'
|
alias grhk='git reset --keep'
|
||||||
alias grhs='git reset --soft'
|
alias grhs='git reset --soft'
|
||||||
alias gpristine='git reset --hard && git clean --force -dfx'
|
alias gpristine='git reset --hard && git clean --force -dfx'
|
||||||
|
alias gwipe='git reset --hard && git clean --force -df'
|
||||||
alias groh='git reset origin/$(git_current_branch) --hard'
|
alias groh='git reset origin/$(git_current_branch) --hard'
|
||||||
alias grs='git restore'
|
alias grs='git restore'
|
||||||
alias grss='git restore --source'
|
alias grss='git restore --source'
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,3 @@ To use it, add `gitfast` to the plugins array in your zshrc file:
|
||||||
```zsh
|
```zsh
|
||||||
plugins=(... gitfast)
|
plugins=(... gitfast)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Aliases
|
|
||||||
|
|
||||||
An earlier version of the plugin also loaded the git plugin. If you want to keep those
|
|
||||||
aliases enable the [git plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git)
|
|
||||||
as well.
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Handle $0 according to the standard:
|
# Handle $0 according to the standard:
|
||||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}"
|
||||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||||
|
|
||||||
source "${0:A:h}/git-prompt.sh"
|
source "${0:A:h}/git-prompt.sh"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
url="https://raw.githubusercontent.com/felipec/git-completion"
|
|
||||||
version="1.3.7"
|
|
||||||
|
|
||||||
curl -s -o _git "${url}/v${version}/git-completion.zsh" &&
|
|
||||||
curl -s -o git-completion.bash "${url}/v${version}/git-completion.bash" &&
|
|
||||||
curl -s -o git-prompt.sh "${url}/v${version}/git-prompt.sh"
|
|
||||||
|
|
@ -14,7 +14,7 @@ __gnu_utils() {
|
||||||
local -a gcmds
|
local -a gcmds
|
||||||
local gcmd
|
local gcmd
|
||||||
|
|
||||||
# coreutils
|
# coreutils
|
||||||
gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
|
gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
|
||||||
'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
|
'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
|
||||||
'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
|
'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
|
||||||
|
|
@ -41,7 +41,7 @@ __gnu_utils() {
|
||||||
for gcmd in "${gcmds[@]}"; do
|
for gcmd in "${gcmds[@]}"; do
|
||||||
# Do nothing if the command isn't found
|
# Do nothing if the command isn't found
|
||||||
(( ${+commands[$gcmd]} )) || continue
|
(( ${+commands[$gcmd]} )) || continue
|
||||||
|
|
||||||
# This method allows for builtin commands to be primary but it's
|
# This method allows for builtin commands to be primary but it's
|
||||||
# lost if hash -r or rehash is executed, or if $PATH is updated.
|
# lost if hash -r or rehash is executed, or if $PATH is updated.
|
||||||
# Thus, a preexec hook is needed, which will only run if whoami
|
# Thus, a preexec hook is needed, which will only run if whoami
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ plugins=(... golang)
|
||||||
| 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 |
|
||||||
|
| gomt | `go mod tidy` | Tidies up the go.mod file |
|
||||||
| gopa | `cd $GOPATH` | Takes you to `$GOPATH` |
|
| gopa | `cd $GOPATH` | Takes you to `$GOPATH` |
|
||||||
| gopb | `cd $GOPATH/bin` | Takes you to `$GOPATH/bin` |
|
| gopb | `cd $GOPATH/bin` | Takes you to `$GOPATH/bin` |
|
||||||
| gops | `cd $GOPATH/src` | Takes you to `$GOPATH/src` |
|
| gops | `cd $GOPATH/src` | Takes you to `$GOPATH/src` |
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ alias goga='go get ./...'
|
||||||
alias goi='go install'
|
alias goi='go install'
|
||||||
alias gol='go list'
|
alias gol='go list'
|
||||||
alias gom='go mod'
|
alias gom='go mod'
|
||||||
|
alias gomt='go mod tidy'
|
||||||
alias gopa='cd $GOPATH'
|
alias gopa='cd $GOPATH'
|
||||||
alias gopb='cd $GOPATH/bin'
|
alias gopb='cd $GOPATH/bin'
|
||||||
alias gops='cd $GOPATH/src'
|
alias gops='cd $GOPATH/src'
|
||||||
|
|
|
||||||
19
plugins/gradle/LICENSE
Normal file
19
plugins/gradle/LICENSE
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2017 Eric Wendelin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
@ -1,28 +1,4 @@
|
||||||
#compdef gradle gradlew gw
|
#compdef gradle gradlew gw
|
||||||
# THE LINE ABOVE MUST BE THE FIRST LINE OF THIS FILE IN ORDER FOR COMPLETION TO WORK
|
|
||||||
|
|
||||||
#
|
|
||||||
# Taken from https://github.com/gradle/gradle-completion
|
|
||||||
# Copyright (c) 2017 Eric Wendelin
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
# this software and associated documentation files (the "Software"), to deal in
|
|
||||||
# the Software without restriction, including without limitation the rights to
|
|
||||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
# of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
# so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
# Terms
|
|
||||||
|
|
||||||
__gradle-set-project-root-dir() {
|
__gradle-set-project-root-dir() {
|
||||||
local dir=`pwd`
|
local dir=`pwd`
|
||||||
|
|
@ -38,7 +14,7 @@ __gradle-set-project-root-dir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
__gradle-init-cache-dir() {
|
__gradle-init-cache-dir() {
|
||||||
cache_dir="$HOME/.gradle/completion"
|
cache_dir="${GRADLE_USER_HOME:-$HOME/.gradle}/completion"
|
||||||
mkdir -p $cache_dir
|
mkdir -p $cache_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,7 +74,7 @@ __gradle-generate-script-cache() {
|
||||||
zle -R "Generating Gradle build script cache"
|
zle -R "Generating Gradle build script cache"
|
||||||
# Cache all Gradle scripts
|
# Cache all Gradle scripts
|
||||||
local -a gradle_build_scripts
|
local -a gradle_build_scripts
|
||||||
gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern") )
|
gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern") )
|
||||||
printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name
|
printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +101,7 @@ __gradle-generate-tasks-cache() {
|
||||||
local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line
|
local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line
|
||||||
local -a match
|
local -a match
|
||||||
for output_line in ${(f)"$(printf "%s\n" "${gradle_tasks_output[@]}")"}; do
|
for output_line in ${(f)"$(printf "%s\n" "${gradle_tasks_output[@]}")"}; do
|
||||||
if [[ $output_line =~ ^([[:lower:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
|
if [[ $output_line =~ ^([[:alpha:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
|
||||||
local task_name="${match[1]}"
|
local task_name="${match[1]}"
|
||||||
local task_description="${match[3]}"
|
local task_description="${match[3]}"
|
||||||
# Completion for subproject tasks with ':' prefix
|
# Completion for subproject tasks with ':' prefix
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ _enumerateGrailsScripts() {
|
||||||
then
|
then
|
||||||
directories+=(plugins/*/scripts)
|
directories+=(plugins/*/scripts)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enumerate all of the Groovy files
|
# Enumerate all of the Groovy files
|
||||||
files=()
|
files=()
|
||||||
for dir in $directories;
|
for dir in $directories;
|
||||||
|
|
@ -17,13 +17,13 @@ _enumerateGrailsScripts() {
|
||||||
files+=($dir/[^_]*.groovy)
|
files+=($dir/[^_]*.groovy)
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Don't try to basename ()
|
# Don't try to basename ()
|
||||||
if [ ${#files} -eq 0 ];
|
if [ ${#files} -eq 0 ];
|
||||||
then
|
then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
scripts=()
|
scripts=()
|
||||||
for file in $files
|
for file in $files
|
||||||
do
|
do
|
||||||
|
|
@ -42,19 +42,19 @@ _enumerateGrailsScripts() {
|
||||||
done
|
done
|
||||||
echo $scripts
|
echo $scripts
|
||||||
}
|
}
|
||||||
|
|
||||||
_grails() {
|
_grails() {
|
||||||
if (( CURRENT == 2 )); then
|
if (( CURRENT == 2 )); then
|
||||||
scripts=( $(_enumerateGrailsScripts) )
|
scripts=( $(_enumerateGrailsScripts) )
|
||||||
|
|
||||||
if [ ${#scripts} -ne 0 ];
|
if [ ${#scripts} -ne 0 ];
|
||||||
then
|
then
|
||||||
_multi_parts / scripts
|
_multi_parts / scripts
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_files
|
_files
|
||||||
}
|
}
|
||||||
|
|
||||||
compdef _grails grails
|
compdef _grails grails
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,7 @@ _history-substring-search-end() {
|
||||||
|
|
||||||
# For debugging purposes:
|
# For debugging purposes:
|
||||||
# zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches}
|
# zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches}
|
||||||
# read -k -t 200 && zle -U $REPLY
|
# read -k -t 200 && zle -U -- "$REPLY"
|
||||||
|
|
||||||
#
|
#
|
||||||
# When this function returns, z-sy-h runs its line-pre-redraw hook. It has no
|
# When this function returns, z-sy-h runs its line-pre-redraw hook. It has no
|
||||||
|
|
@ -421,7 +421,7 @@ _history-substring-search-end() {
|
||||||
# before removing search highlight and exiting. This ensures no highlights
|
# before removing search highlight and exiting. This ensures no highlights
|
||||||
# are left lingering after search is finished.
|
# are left lingering after search is finished.
|
||||||
#
|
#
|
||||||
read -k -t ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT:-1} && zle -U $REPLY
|
read -k -t ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT:-1} && zle -U -- "$REPLY"
|
||||||
region_highlight=( "${(@)region_highlight:#*${highlight_memo}*}" )
|
region_highlight=( "${(@)region_highlight:#*${highlight_memo}*}" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#compdef http
|
#compdef http https
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Copyright (c) 2015 GitHub zsh-users - http://github.com/zsh-users
|
# Copyright (c) 2015 GitHub zsh-users - http://github.com/zsh-users
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@ alias ih="ionic --help"
|
||||||
alias ist="ionic start"
|
alias ist="ionic start"
|
||||||
alias ii="ionic info"
|
alias ii="ionic info"
|
||||||
alias is="ionic serve"
|
alias is="ionic serve"
|
||||||
alias icba="ionic cordova build android"
|
alias icba="ionic cordova build android"
|
||||||
alias icbi="ionic cordova build ios"
|
alias icbi="ionic cordova build ios"
|
||||||
alias icra="ionic cordova run android"
|
alias icra="ionic cordova run android"
|
||||||
alias icri="ionic cordova run ios"
|
alias icri="ionic cordova run ios"
|
||||||
alias icrsa="ionic cordova resources android"
|
alias icrsa="ionic cordova resources android"
|
||||||
alias icrsi="ionic cordova resources ios"
|
alias icrsi="ionic cordova resources ios"
|
||||||
alias icpaa="ionic cordova platform add android"
|
alias icpaa="ionic cordova platform add android"
|
||||||
alias icpai="ionic cordova platform add ios"
|
alias icpai="ionic cordova platform add ios"
|
||||||
alias icpra="ionic cordova platform rm android"
|
alias icpra="ionic cordova platform rm android"
|
||||||
alias icpri="ionic cordova platform rm ios"
|
alias icpri="ionic cordova platform rm ios"
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ _ipfs_subcommand(){
|
||||||
_arguments \
|
_arguments \
|
||||||
'--resolve[Check if the given path can be resolved before publishing. Default: true.]' \
|
'--resolve[Check if the given path can be resolved before publishing. Default: true.]' \
|
||||||
'(-t --lifetime)'{-t,--lifetime}'[Time duration that the record will be valid for. Default: 24h.]' \
|
'(-t --lifetime)'{-t,--lifetime}'[Time duration that the record will be valid for. Default: 24h.]' \
|
||||||
'--allow-offline[When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing.]' \
|
'--allow-offline[When offline, save the IPNS record to the local datastore without broadcasting to the network instead of simply failing.]' \
|
||||||
'--ttl[Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental).]' \
|
'--ttl[Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental).]' \
|
||||||
'(-k --key)'{-k,--key}"[Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'. Default: self.]" \
|
'(-k --key)'{-k,--key}"[Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'. Default: self.]" \
|
||||||
'(-Q --quieter)'{-Q,--quieter}'[Write only final hash.]' \
|
'(-Q --quieter)'{-Q,--quieter}'[Write only final hash.]' \
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ plugins=(... iterm2)
|
||||||
```
|
```
|
||||||
|
|
||||||
Optionally, the plugin also applies the [Shell Integration Script for iTerm2](https://iterm2.com/documentation-shell-integration.html).
|
Optionally, the plugin also applies the [Shell Integration Script for iTerm2](https://iterm2.com/documentation-shell-integration.html).
|
||||||
You can enable the integration with zstyle. It's important to add this line
|
You can enable the integration with zstyle. It's important to add this line
|
||||||
before the line sourcing oh-my-zsh:
|
before the line sourcing oh-my-zsh:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
if [[ "$OSTYPE" == darwin* ]] && [[ -n "$ITERM_SESSION_ID" ]] ; then
|
if [[ "$OSTYPE" == darwin* ]] && [[ -n "$ITERM_SESSION_ID" ]] ; then
|
||||||
|
|
||||||
# maybe make it the default in the future and allow opting out?
|
# maybe make it the default in the future and allow opting out?
|
||||||
if zstyle -t ':omz:plugins:iterm2' shell-integration; then
|
if zstyle -t ':omz:plugins:iterm2' shell-integration; then
|
||||||
# Handle $0 according to the standard:
|
# Handle $0 according to the standard:
|
||||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
|
||||||
|
|
@ -16,23 +16,26 @@ This plugin supplies one command, `jira`, through which all its features are exp
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
|
`jira help` or `jira usage` will print the below usage instructions
|
||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
| :------------ | :-------------------------------------------------------- |
|
| :------------ | :-------------------------------------------------------- |
|
||||||
| `jira` | Performs the default action |
|
| `jira` | Performs the default action |
|
||||||
| `jira new` | Opens a new Jira issue dialogue |
|
| `jira new` | Opens a new Jira issue dialogue |
|
||||||
| `jira ABC-123` | Opens an existing issue |
|
| `jira ABC-123` | Opens an existing issue |
|
||||||
| `jira ABC-123 m` | Opens an existing issue for adding a comment |
|
| `jira ABC-123 m` | Opens an existing issue for adding a comment |
|
||||||
| `jira dashboard [rapid_view]` | # opens your JIRA dashboard |
|
| `jira dashboard [rapid_view]` | Opens your JIRA dashboard |
|
||||||
| `jira mine` | Queries for your own issues |
|
| `jira mine` | Queries for your own issues |
|
||||||
| `jira tempo` | Opens your JIRA Tempo |
|
| `jira tempo` | Opens your JIRA Tempo |
|
||||||
| `jira reported [username]` | Queries for issues reported by a user |
|
| `jira reported [username]` | Queries for issues reported by a user |
|
||||||
| `jira assigned [username]` | Queries for issues assigned to a user |
|
| `jira assigned [username]` | Queries for issues assigned to a user |
|
||||||
| `jira branch` | Opens an existing issue matching the current branch name |
|
| `jira branch` | Opens an existing issue matching the current branch name |
|
||||||
|
| `jira help` | Prints usage instructions |
|
||||||
|
|
||||||
|
|
||||||
### Jira Branch usage notes
|
### Jira Branch usage notes
|
||||||
|
|
||||||
The branch name may have prefixes ending in "/": "feature/MP-1234", and also suffixes
|
The branch name may have prefixes ending in "/": "feature/MP-1234", and also suffixes
|
||||||
starting with "_": "MP-1234_fix_dashboard". In both these cases, the issue opened will be "MP-1234"
|
starting with "_": "MP-1234_fix_dashboard". In both these cases, the issue opened will be "MP-1234"
|
||||||
|
|
||||||
This is also checks if the prefix is in the name, and adds it if not, so: "MP-1234" opens the issue "MP-1234",
|
This is also checks if the prefix is in the name, and adds it if not, so: "MP-1234" opens the issue "MP-1234",
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ _1st_arguments=(
|
||||||
'assigned:search for issues assigned to a user'
|
'assigned:search for issues assigned to a user'
|
||||||
'branch:open the issue named after the git branch of the current directory'
|
'branch:open the issue named after the git branch of the current directory'
|
||||||
'dumpconfig:display effective jira configuration'
|
'dumpconfig:display effective jira configuration'
|
||||||
|
'help:print usage help to stdout'
|
||||||
)
|
)
|
||||||
|
|
||||||
_arguments -C \
|
_arguments -C \
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,21 @@
|
||||||
#
|
#
|
||||||
# See README.md for details
|
# See README.md for details
|
||||||
|
|
||||||
|
function _jira_usage() {
|
||||||
|
cat <<EOF
|
||||||
|
jira Performs the default action
|
||||||
|
jira new Opens a new Jira issue dialogue
|
||||||
|
jira ABC-123 Opens an existing issue
|
||||||
|
jira ABC-123 m Opens an existing issue for adding a comment
|
||||||
|
jira dashboard [rapid_view] Opens your JIRA dashboard
|
||||||
|
jira mine Queries for your own issues
|
||||||
|
jira tempo Opens your JIRA Tempo
|
||||||
|
jira reported [username] Queries for issues reported by a user
|
||||||
|
jira assigned [username] Queries for issues assigned to a user
|
||||||
|
jira branch Opens an existing issue matching the current branch name
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
function jira() {
|
function jira() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
local action jira_url jira_prefix
|
local action jira_url jira_prefix
|
||||||
|
|
@ -44,6 +59,8 @@ function jira() {
|
||||||
open_command "${jira_url}/secure/CreateIssue!default.jspa"
|
open_command "${jira_url}/secure/CreateIssue!default.jspa"
|
||||||
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
|
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
|
||||||
_jira_query ${@:-$action}
|
_jira_query ${@:-$action}
|
||||||
|
elif [[ "$action" == "help" || "$action" == "usage" ]]; then
|
||||||
|
_jira_usage
|
||||||
elif [[ "$action" == "mine" ]]; then
|
elif [[ "$action" == "mine" ]]; then
|
||||||
echo "Opening my issues"
|
echo "Opening my issues"
|
||||||
open_command "${jira_url}/issues/?filter=-1"
|
open_command "${jira_url}/issues/?filter=-1"
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ jmodel() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local model="$(yq e ".controllers.$(jcontroller).current-model" < ~/.local/share/juju/models.yaml | cut -d/ -f2)"
|
local model="$(yq e ".controllers.$(jcontroller).current-model" < ~/.local/share/juju/models.yaml | cut -d/ -f2)"
|
||||||
|
|
||||||
if [[ -z "$model" ]]; then
|
if [[ -z "$model" ]]; then
|
||||||
echo "--"
|
echo "--"
|
||||||
return 1
|
return 1
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,10 @@
|
||||||
#
|
#
|
||||||
export MARKPATH=$HOME/.marks
|
export MARKPATH=$HOME/.marks
|
||||||
|
|
||||||
|
|
||||||
jump() {
|
jump() {
|
||||||
builtin cd -P "$MARKPATH/$1" 2>/dev/null || {echo "No such mark: $1"; return 1}
|
local markpath="$(readlink $MARKPATH/$1)" || {echo "No such mark: $1"; return 1}
|
||||||
|
builtin cd "$markpath" 2>/dev/null || {echo "Destination does not exist for mark [$1]: $markpath"; return 2}
|
||||||
}
|
}
|
||||||
|
|
||||||
mark() {
|
mark() {
|
||||||
|
|
|
||||||
23
plugins/kitty/README.md
Normal file
23
plugins/kitty/README.md
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Kitty plugin
|
||||||
|
|
||||||
|
This plugin adds a few aliases and functions that are useful for users of the [Kitty](https://sw.kovidgoyal.net/kitty/) terminal.
|
||||||
|
|
||||||
|
To use it, add _kitty_ to the plugins array of your zshrc file:
|
||||||
|
```
|
||||||
|
plugins=(... kitty)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Plugin commands
|
||||||
|
|
||||||
|
* `kssh`
|
||||||
|
Runs a kitten ssh session that ensures your terminfo settings are copied
|
||||||
|
correctly to the remote hose.
|
||||||
|
* `kssh-slow`
|
||||||
|
A slower form of `kssh` that should always work. Use this if `kssh` fails
|
||||||
|
to set terminfo correctly for you on the remote host.
|
||||||
|
* `kitty-theme`
|
||||||
|
Browse and change the theme of your Kitty terminal.
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
- [Ian Chesal](https://github.com/ianchesal)
|
||||||
16
plugins/kitty/kitty.plugin.zsh
Normal file
16
plugins/kitty/kitty.plugin.zsh
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
#####################################################
|
||||||
|
# Kitty plugin for oh-my-zsh #
|
||||||
|
#####################################################
|
||||||
|
|
||||||
|
if [[ "$TERM" == 'xterm-kitty' ]]; then
|
||||||
|
## kssh
|
||||||
|
# Use this when your terminfo isn't recognized on remote hosts.
|
||||||
|
# See: https://sw.kovidgoyal.net/kitty/faq/#i-get-errors-about-the-terminal-being-unknown-or-opening-the-terminal-failing-when-sshing-into-a-different-computer
|
||||||
|
alias kssh="kitty +kitten ssh"
|
||||||
|
compdef kssh='ssh'
|
||||||
|
# Use this if kssh fails
|
||||||
|
alias kssh-slow="infocmp -a xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin"
|
||||||
|
|
||||||
|
# Change the colour theme
|
||||||
|
alias kitty-theme="kitty +kitten themes"
|
||||||
|
fi
|
||||||
|
|
@ -4,5 +4,5 @@
|
||||||
|
|
||||||
if [ $commands[kn] ]; then
|
if [ $commands[kn] ]; then
|
||||||
source <(kn completion zsh)
|
source <(kn completion zsh)
|
||||||
compdef _kn kn
|
compdef _kn kn
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ the following environment variables:
|
||||||
| `KUBE_PS1_SUFFIX` | `)` | Prompt closing character |
|
| `KUBE_PS1_SUFFIX` | `)` | Prompt closing character |
|
||||||
| `KUBE_PS1_CLUSTER_FUNCTION` | No default, must be user supplied | Function to customize how cluster is displayed |
|
| `KUBE_PS1_CLUSTER_FUNCTION` | No default, must be user supplied | Function to customize how cluster is displayed |
|
||||||
| `KUBE_PS1_NAMESPACE_FUNCTION` | No default, must be user supplied | Function to customize how namespace is displayed |
|
| `KUBE_PS1_NAMESPACE_FUNCTION` | No default, must be user supplied | Function to customize how namespace is displayed |
|
||||||
|
| `KUBE_PS1_KUBECONFIG_SYMLINK` | `false` | Treat `KUBECONFIG` and `~/.kube/config` files as symbolic links |
|
||||||
|
|
||||||
For terminals that do not support UTF-8, the symbol will be replaced with the
|
For terminals that do not support UTF-8, the symbol will be replaced with the
|
||||||
string `k8s`.
|
string `k8s`.
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ KUBE_PS1_NS_COLOR="${KUBE_PS1_NS_COLOR-cyan}"
|
||||||
KUBE_PS1_BG_COLOR="${KUBE_PS1_BG_COLOR}"
|
KUBE_PS1_BG_COLOR="${KUBE_PS1_BG_COLOR}"
|
||||||
|
|
||||||
KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
|
KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
|
||||||
|
KUBE_PS1_KUBECONFIG_SYMLINK="${KUBE_PS1_KUBECONFIG_SYMLINK:-false}"
|
||||||
KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled"
|
KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled"
|
||||||
KUBE_PS1_LAST_TIME=0
|
KUBE_PS1_LAST_TIME=0
|
||||||
KUBE_PS1_CLUSTER_FUNCTION="${KUBE_PS1_CLUSTER_FUNCTION}"
|
KUBE_PS1_CLUSTER_FUNCTION="${KUBE_PS1_CLUSTER_FUNCTION}"
|
||||||
|
|
@ -190,14 +191,26 @@ _kube_ps1_file_newer_than() {
|
||||||
local file=$1
|
local file=$1
|
||||||
local check_time=$2
|
local check_time=$2
|
||||||
|
|
||||||
if [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
|
if [[ "${KUBE_PS1_KUBECONFIG_SYMLINK}" == "true" ]]; then
|
||||||
mtime=$(zstat +mtime "${file}")
|
if [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
|
||||||
elif stat -c "%s" /dev/null &> /dev/null; then
|
mtime=$(zstat -L +mtime "${file}")
|
||||||
# GNU stat
|
elif stat -c "%s" /dev/null &> /dev/null; then
|
||||||
mtime=$(stat -L -c %Y "${file}")
|
# GNU stat
|
||||||
|
mtime=$(stat -c %Y "${file}")
|
||||||
|
else
|
||||||
|
# BSD stat
|
||||||
|
mtime=$(stat -f %m "$file")
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# BSD stat
|
if [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
|
||||||
mtime=$(stat -L -f %m "$file")
|
mtime=$(zstat +mtime "${file}")
|
||||||
|
elif stat -c "%s" /dev/null &> /dev/null; then
|
||||||
|
# GNU stat
|
||||||
|
mtime=$(stat -L -c %Y "${file}")
|
||||||
|
else
|
||||||
|
# BSD stat
|
||||||
|
mtime=$(stat -L -f %m "$file")
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ "${mtime}" -gt "${check_time}" ]]
|
[[ "${mtime}" -gt "${check_time}" ]]
|
||||||
|
|
|
||||||
|
|
@ -180,13 +180,11 @@ alias kej='kubectl edit job'
|
||||||
alias kdj='kubectl describe job'
|
alias kdj='kubectl describe job'
|
||||||
alias kdelj='kubectl delete job'
|
alias kdelj='kubectl delete job'
|
||||||
|
|
||||||
# Only run if the user actually has kubectl installed
|
function kj() { kubectl "$@" -o json | jq; }
|
||||||
if (( ${+_comps[kubectl]} )); then
|
function kjx() { kubectl "$@" -o json | fx; }
|
||||||
function kj() { kubectl "$@" -o json | jq; }
|
function ky() { kubectl "$@" -o yaml | yh; }
|
||||||
function kjx() { kubectl "$@" -o json | fx; }
|
if (( ${+functions[compdef]} )); then
|
||||||
function ky() { kubectl "$@" -o yaml | yh; }
|
compdef _kubectl kj
|
||||||
|
compdef _kubectl kjx
|
||||||
compdef kj=kubectl
|
compdef _kubectl ky
|
||||||
compdef kjx=kubectl
|
|
||||||
compdef ky=kubectl
|
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ One can rename default context name for better readability.
|
||||||
|
|
||||||
_Example_. Add to **.zshrc**:
|
_Example_. Add to **.zshrc**:
|
||||||
```
|
```
|
||||||
kubectx_mapping[minikube]="mini"
|
kubectx_mapping["minikube"]="mini"
|
||||||
kubectx_mapping[context_name_from_kubeconfig]="$emoji[wolf_face]"
|
kubectx_mapping["context_name_from_kubeconfig"]="$emoji[wolf_face]"
|
||||||
kubectx_mapping[production_cluster]="%{$fg[yellow]%}prod!%{$reset_color%}"
|
kubectx_mapping["production_cluster"]="%{$fg[yellow]%}prod!%{$reset_color%}"
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,5 @@ function kubectx_prompt_info() {
|
||||||
|
|
||||||
# use value in associative array if it exists
|
# use value in associative array if it exists
|
||||||
# otherwise fall back to the context name
|
# otherwise fall back to the context name
|
||||||
echo "${kubectx_mapping[$current_ctx]:-${current_ctx:gs/%/%%}}"
|
echo "${kubectx_mapping[\"$current_ctx\"]:-${current_ctx:gs/%/%%}}"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ plugins=(... laravel)
|
||||||
|:-:|:-:|
|
|:-:|:-:|
|
||||||
| `artisan` | `php artisan` |
|
| `artisan` | `php artisan` |
|
||||||
| `pas` | `php artisan serve` |
|
| `pas` | `php artisan serve` |
|
||||||
|
| `pats` | `php artisan test` |
|
||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
|
||||||
|
|
@ -35,6 +36,10 @@ plugins=(... laravel)
|
||||||
| `pamj` | `php artisan make:job` |
|
| `pamj` | `php artisan make:job` |
|
||||||
| `paml` | `php artisan make:listener` |
|
| `paml` | `php artisan make:listener` |
|
||||||
| `pamn` | `php artisan make:notification` |
|
| `pamn` | `php artisan make:notification` |
|
||||||
|
| `pamcl` | `php artisan make:class` |
|
||||||
|
| `pamen` | `php artisan make:enum` |
|
||||||
|
| `pami` | `php artisan make:interface` |
|
||||||
|
| `pamtr` | `php artisan make:trait` |
|
||||||
|
|
||||||
## Clears
|
## Clears
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ alias bob='php artisan bob::build'
|
||||||
|
|
||||||
# Development
|
# Development
|
||||||
alias pas='php artisan serve'
|
alias pas='php artisan serve'
|
||||||
|
alias pats='php artisan test'
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
alias pam='php artisan migrate'
|
alias pam='php artisan migrate'
|
||||||
|
|
@ -24,6 +25,10 @@ alias pamj='php artisan make:job'
|
||||||
alias paml='php artisan make:listener'
|
alias paml='php artisan make:listener'
|
||||||
alias pamn='php artisan make:notification'
|
alias pamn='php artisan make:notification'
|
||||||
alias pampp='php artisan make:provider'
|
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'
|
||||||
|
|
||||||
|
|
||||||
# Clears
|
# Clears
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,11 @@ To start using it, add the `macos` plugin to your plugins array in `~/.zshrc`:
|
||||||
plugins=(... macos)
|
plugins=(... macos)
|
||||||
```
|
```
|
||||||
|
|
||||||
Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
|
## Supported Terminals
|
||||||
|
- [iTerm](https://iterm.sourceforge.net/)
|
||||||
|
- [iTerm2](https://iterm2.com/)
|
||||||
|
- [Hyper](https://hyper.is/)
|
||||||
|
- [Tabby](https://tabby.sh/)
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
|
|
@ -17,7 +21,7 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||||
| `tab` | Open the current directory in a new tab |
|
| `tab` | Open the current directory in a new tab |
|
||||||
| `split_tab` | Split the current terminal tab horizontally |
|
| `split_tab` | Split the current terminal tab horizontally |
|
||||||
| `vsplit_tab` | Split the current terminal tab vertically |
|
| `vsplit_tab` | Split the current terminal tab vertically |
|
||||||
| `ofd` | Open the current directory in a Finder window |
|
| `ofd` | Open passed directories (or $PWD by default) in Finder |
|
||||||
| `pfd` | Return the path of the frontmost Finder window |
|
| `pfd` | Return the path of the frontmost Finder window |
|
||||||
| `pfs` | Return the current Finder selection |
|
| `pfs` | Return the current Finder selection |
|
||||||
| `cdf` | `cd` to the current Finder directory |
|
| `cdf` | `cd` to the current Finder directory |
|
||||||
|
|
@ -37,7 +41,9 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||||
|
|
||||||
## Acknowledgements
|
## Acknowledgements
|
||||||
|
|
||||||
This application makes use of the following third party scripts:
|
Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||||
|
|
||||||
|
This application makes use of the following third-party scripts:
|
||||||
|
|
||||||
[shpotify](https://github.com/hnarayanan/shpotify)
|
[shpotify](https://github.com/hnarayanan/shpotify)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,15 @@
|
||||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||||
|
|
||||||
# Open the current directory in a Finder window
|
# Open in Finder the directories passed as arguments, or the current directory if
|
||||||
alias ofd='open_command $PWD'
|
# no directories are passed
|
||||||
|
function ofd {
|
||||||
|
if (( ! $# )); then
|
||||||
|
open_command $PWD
|
||||||
|
else
|
||||||
|
open_command $@
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Show/hide hidden files in the Finder
|
# Show/hide hidden files in the Finder
|
||||||
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
|
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
|
||||||
|
|
@ -72,6 +79,13 @@ EOF
|
||||||
key code 36 #(presses enter)
|
key code 36 #(presses enter)
|
||||||
end tell
|
end tell
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
elif [[ "$the_app" == 'Tabby' ]]; then
|
||||||
|
osascript >/dev/null <<EOF
|
||||||
|
tell application "System Events"
|
||||||
|
tell process "Tabby" to keystroke "t" using command down
|
||||||
|
end tell
|
||||||
|
EOF
|
||||||
else
|
else
|
||||||
echo "$0: unsupported terminal app: $the_app" >&2
|
echo "$0: unsupported terminal app: $the_app" >&2
|
||||||
return 1
|
return 1
|
||||||
|
|
@ -119,6 +133,12 @@ EOF
|
||||||
delay 1
|
delay 1
|
||||||
keystroke "${command} \n"
|
keystroke "${command} \n"
|
||||||
end tell
|
end tell
|
||||||
|
EOF
|
||||||
|
elif [[ "$the_app" == 'Tabby' ]]; then
|
||||||
|
osascript >/dev/null <<EOF
|
||||||
|
tell application "System Events"
|
||||||
|
tell process "Tabby" to keystroke "D" using command down
|
||||||
|
end tell
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
echo "$0: unsupported terminal app: $the_app" >&2
|
echo "$0: unsupported terminal app: $the_app" >&2
|
||||||
|
|
@ -168,6 +188,12 @@ EOF
|
||||||
delay 1
|
delay 1
|
||||||
keystroke "${command} \n"
|
keystroke "${command} \n"
|
||||||
end tell
|
end tell
|
||||||
|
EOF
|
||||||
|
elif [[ "$the_app" == 'Tabby' ]]; then
|
||||||
|
osascript >/dev/null <<EOF
|
||||||
|
tell application "System Events"
|
||||||
|
tell process "Tabby" to keystroke "d" using command down
|
||||||
|
end tell
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
echo "$0: unsupported terminal app: $the_app" >&2
|
echo "$0: unsupported terminal app: $the_app" >&2
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#compdef port
|
#compdef port
|
||||||
|
|
||||||
local subcmds
|
local subcmds
|
||||||
|
|
||||||
# we cache the list of ports
|
# we cache the list of ports
|
||||||
# we shall use some cache policy to avoid problems with new ports
|
# we shall use some cache policy to avoid problems with new ports
|
||||||
|
|
@ -31,8 +31,8 @@ subcmds=(
|
||||||
'file'
|
'file'
|
||||||
'help'
|
'help'
|
||||||
'info'
|
'info'
|
||||||
'install'
|
'install'
|
||||||
'installed'
|
'installed'
|
||||||
'list'
|
'list'
|
||||||
'livecheck'
|
'livecheck'
|
||||||
'location'
|
'location'
|
||||||
|
|
@ -51,7 +51,7 @@ subcmds=(
|
||||||
'test'
|
'test'
|
||||||
'unarchive'
|
'unarchive'
|
||||||
'uninstall'
|
'uninstall'
|
||||||
'upgrade'
|
'upgrade'
|
||||||
'variants'
|
'variants'
|
||||||
'version'
|
'version'
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
## marked2
|
## marked2
|
||||||
|
|
||||||
Plugin for Marked 2, a previewer for Markdown files on Mac OS X
|
Plugin for Marked 2, a previewer for Markdown files on Mac OS X
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
## marktext
|
## marktext
|
||||||
|
|
||||||
Plugin for MarkText, a previewer for Markdown files on Mac OS X
|
Plugin for MarkText, a previewer for Markdown files on Mac OS X
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue