This commit is contained in:
abc 2024-01-15 16:29:15 +08:00
commit 9d709dcddb
50 changed files with 1372 additions and 912 deletions

20
.github/dependencies.yml vendored Normal file
View file

@ -0,0 +1,20 @@
dependencies:
plugins/gitfast:
repo: felipec/git-completion
branch: master
version: tag:v2.0
postcopy: |
set -e
rm -rf git-completion.plugin.zsh Makefile README.adoc t tools
test -e git-completion.zsh && mv -f git-completion.zsh _git
plugins/z:
branch: master
repo: agkozak/zsh-z
version: afaf2965b41fdc6ca66066e09382726aa0b6aa04
precopy: |
set -e
test -e README.md && mv -f README.md MANUAL.md
postcopy: |
set -e
test -e _zshz && mv -f _zshz _z
test -e zsh-z.plugin.zsh && mv -f zsh-z.plugin.zsh z.plugin.zsh

29
.github/workflows/dependencies.yml vendored Normal file
View file

@ -0,0 +1,29 @@
name: Update dependencies
on:
workflow_dispatch: {}
# schedule:
# - cron: '34 3 * * */8'
jobs:
check:
name: Check for updates
runs-on: ubuntu-latest
if: github.repository == 'ohmyzsh/ohmyzsh'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Authenticate as @ohmyzsh
id: generate_token
uses: ohmyzsh/github-app-token@v2
with:
app_id: ${{ secrets.OHMYZSH_APP_ID }}
private_key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
- name: Process dependencies
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
GIT_APP_NAME: ohmyzsh[bot]
GIT_APP_EMAIL: 54982679+ohmyzsh[bot]@users.noreply.github.com
TMP_DIR: ${{ runner.temp }}
run: |
pip install -r .github/workflows/dependencies/requirements.txt
python3 .github/workflows/dependencies/updater.py

View file

@ -0,0 +1,2 @@
PyYAML~=6.0.1
requests~=2.31.0

View file

@ -0,0 +1,450 @@
import os
import subprocess
import sys
import requests
import shutil
import yaml
from copy import deepcopy
from typing import Optional, TypedDict
# Get TMP_DIR variable from environment
TMP_DIR = os.path.join(os.environ.get("TMP_DIR", "/tmp"), "ohmyzsh")
# Relative path to dependencies.yml file
DEPS_YAML_FILE = ".github/dependencies.yml"
# Dry run flag
DRY_RUN = os.environ.get("DRY_RUN", "0") == "1"
import timeit
class CodeTimer:
def __init__(self, name=None):
self.name = " '" + name + "'" if name else ''
def __enter__(self):
self.start = timeit.default_timer()
def __exit__(self, exc_type, exc_value, traceback):
self.took = (timeit.default_timer() - self.start) * 1000.0
print('Code block' + self.name + ' took: ' + str(self.took) + ' ms')
### YAML representation
def str_presenter(dumper, data):
"""
Configures yaml for dumping multiline strings
Ref: https://stackoverflow.com/a/33300001
"""
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)
yaml.add_representer(str, str_presenter)
yaml.representer.SafeRepresenter.add_representer(str, str_presenter)
# Types
class DependencyDict(TypedDict):
repo: str
branch: str
version: str
precopy: Optional[str]
postcopy: Optional[str]
class DependencyYAML(TypedDict):
dependencies: dict[str, DependencyDict]
class UpdateStatus(TypedDict):
has_updates: bool
version: Optional[str]
compare_url: Optional[str]
head_ref: Optional[str]
head_url: Optional[str]
class CommandRunner:
class Exception(Exception):
def __init__(self, message, returncode, stage, stdout, stderr):
super().__init__(message)
self.returncode = returncode
self.stage = stage
self.stdout = stdout
self.stderr = stderr
@staticmethod
def run_or_fail(command: list[str], stage: str, *args, **kwargs):
if DRY_RUN and command[0] == "gh":
command.insert(0, "echo")
result = subprocess.run(command, *args, capture_output=True, **kwargs)
if result.returncode != 0:
raise CommandRunner.Exception(
f"{stage} command failed with exit code {result.returncode}", returncode=result.returncode,
stage=stage,
stdout=result.stdout.decode("utf-8"),
stderr=result.stderr.decode("utf-8")
)
return result
class DependencyStore:
store: DependencyYAML = {
"dependencies": {}
}
@staticmethod
def set(data: DependencyYAML):
DependencyStore.store = data
@staticmethod
def update_dependency_version(path: str, version: str) -> DependencyYAML:
with CodeTimer(f"store deepcopy: {path}"):
store_copy = deepcopy(DependencyStore.store)
dependency = store_copy["dependencies"].get(path, {})
dependency["version"] = version
store_copy["dependencies"][path] = dependency
return store_copy
@staticmethod
def write_store(file: str, data: DependencyYAML):
with open(file, "w") as yaml_file:
yaml.safe_dump(data, yaml_file, sort_keys=False)
class Dependency:
def __init__(self, path: str, values: DependencyDict):
self.path = path
self.values = values
self.name: str = ""
self.desc: str = ""
self.kind: str = ""
match path.split("/"):
case ["plugins", name]:
self.name = name
self.kind = "plugin"
self.desc = f"{name} plugin"
case ["themes", name]:
self.name = name.replace(".zsh-theme", "")
self.kind = "theme"
self.desc = f"{self.name} theme"
case _:
self.name = self.desc = path
def __str__(self):
output: str = ""
for key in DependencyDict.__dict__['__annotations__'].keys():
if key not in self.values:
output += f"{key}: None\n"
continue
value = self.values[key]
if "\n" not in value:
output += f"{key}: {value}\n"
else:
output += f"{key}:\n "
output += value.replace("\n", "\n ", value.count("\n") - 1)
return output
def update_or_notify(self):
# Print dependency settings
print(f"Processing {self.desc}...", file=sys.stderr)
print(self, file=sys.stderr)
# Check for updates
repo = self.values["repo"]
remote_branch = self.values["branch"]
version = self.values["version"]
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:
# Create new branch
branch = Git.create_branch(self.path, new_version)
# Update dependencies.yml file
self.__update_yaml(f"tag:{new_version}" if is_tag else status["version"])
# Update dependency files
self.__apply_upstream_changes()
# Add all changes and commit
Git.add_and_commit(self.name, short_sha)
# 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']}).
Check out the [list of changes]({status['compare_url']}).
"""
)
# Clean up repository
Git.clean_repo()
except (CommandRunner.Exception, shutil.Error) as e:
# Handle exception on automatic update
match type(e):
case CommandRunner.Exception:
# Print error message
print(f"Error running {e.stage} command: {e.returncode}", file=sys.stderr)
print(e.stderr, file=sys.stderr)
case shutil.Error:
print(f"Error copying files: {e}", file=sys.stderr)
try:
Git.clean_repo()
except CommandRunner.Exception as e:
print(f"Error reverting repository to clean state: {e}", file=sys.stderr)
sys.exit(1)
# Create a GitHub issue to notify maintainer
title = f"{self.path}: update to {new_version}"
body = (
f"""## Description
There is a new version of `{self.name}` {self.kind} available.
New version: [{new_version}]({status['head_url']})
Check out the [list of changes]({status['compare_url']}).
"""
)
print(f"Creating GitHub issue", file=sys.stderr)
print(f"{title}\n\n{body}", file=sys.stderr)
GitHub.create_issue(title, body)
except Exception as e:
print(e, file=sys.stderr)
def __update_yaml(self, new_version: str) -> None:
dep_yaml = DependencyStore.update_dependency_version(self.path, new_version)
DependencyStore.write_store(DEPS_YAML_FILE, dep_yaml)
def __apply_upstream_changes(self) -> None:
# Patterns to ignore in copying files from upstream repo
GLOBAL_IGNORE = [
".git",
".github",
".gitignore"
]
path = os.path.abspath(self.path)
precopy = self.values.get("precopy")
postcopy = self.values.get("postcopy")
repo = self.values["repo"]
branch = self.values["branch"]
remote_url = f"https://github.com/{repo}.git"
repo_dir = os.path.join(TMP_DIR, repo)
# Clone repository
Git.clone(remote_url, branch, repo_dir, reclone=True)
# Run precopy on tmp repo
if precopy is not None:
print("Running precopy script:", end="\n ", file=sys.stderr)
print(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
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))
# Run postcopy on our repository
if postcopy is not None:
print("Running postcopy script:", end="\n ", file=sys.stderr)
print(postcopy.replace("\n", "\n ", postcopy.count("\n") - 1), file=sys.stderr)
CommandRunner.run_or_fail(["bash", "-c", postcopy], cwd=path, stage="Postcopy")
class Git:
default_branch = "master"
@staticmethod
def clone(remote_url: str, branch: str, repo_dir: str, reclone=False):
# If repo needs to be fresh
if reclone and os.path.exists(repo_dir):
shutil.rmtree(repo_dir)
# Clone repo in tmp directory and checkout branch
if not os.path.exists(repo_dir):
print(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
def create_branch(path: str, version: str):
# Get current branch name
result = CommandRunner.run_or_fail(["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
branch_name = f"update/{path}/{version}"
CommandRunner.run_or_fail(["git", "checkout", "-b", branch_name], stage="CreateBranch")
return branch_name
@staticmethod
def add_and_commit(scope: str, version: str):
user_name = os.environ.get("GIT_APP_NAME")
user_email = os.environ.get("GIT_APP_EMAIL")
# Add all files to git staging
CommandRunner.run_or_fail(["git", "add", "-A", "-v"], stage="AddFiles")
# Reset environment and git config
clean_env = os.environ.copy()
clean_env["LANG"]="C.UTF-8"
clean_env["GIT_CONFIG_GLOBAL"]="/dev/null"
clean_env["GIT_CONFIG_NOSYSTEM"]="1"
# Commit with settings above
CommandRunner.run_or_fail([
"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)
@staticmethod
def push(branch: str):
CommandRunner.run_or_fail(["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:
@staticmethod
def check_newer_tag(repo, current_tag) -> UpdateStatus:
# GET /repos/:owner/:repo/git/refs/tags
url = f"https://api.github.com/repos/{repo}/git/refs/tags"
# Send a GET request to the GitHub API
response = requests.get(url)
# If the request was successful
if response.status_code == 200:
# Parse the JSON response
data = response.json()
if len(data) == 0:
return {
"has_updates": False,
}
latest_ref = data[-1]
latest_tag = latest_ref["ref"].replace("refs/tags/", "")
if latest_tag == current_tag:
return {
"has_updates": False,
}
return {
"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()}")
@staticmethod
def check_updates(repo, branch, version) -> UpdateStatus:
# TODO: add support for semver updating (based on tags)
# 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
response = requests.get(url)
# If the request was successful
if response.status_code == 200:
# Parse the JSON response
data = response.json()
# If the base is behind the head, there is a newer version
has_updates = data["status"] != "identical"
if not has_updates:
return {
"has_updates": False,
}
return {
"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
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:
cmd = [
"gh",
"pr",
"create",
"-B", Git.default_branch,
"-H", branch,
"-t", title,
"-b", body
]
CommandRunner.run_or_fail(cmd, stage="CreatePullRequest")
def main():
# Load the YAML file
with open(DEPS_YAML_FILE, "r") as yaml_file:
data: DependencyYAML = yaml.safe_load(yaml_file)
if "dependencies" not in data:
raise Exception(f"dependencies.yml not properly formatted")
# Cache YAML version
DependencyStore.set(data)
dependencies = data["dependencies"]
for path in dependencies:
dependency = Dependency(path, dependencies[path])
dependency.update_or_notify()
if __name__ == "__main__":
main()

View file

@ -17,6 +17,7 @@ permissions:
jobs: jobs:
test: test:
name: Test installer name: Test installer
if: github.repository == 'ohmyzsh/ohmyzsh'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@ -48,7 +49,8 @@ jobs:
env: env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
run: | run: |
cp tools/install.sh .github/workflows/installer/install.sh cp tools/install.sh .github/workflows/installer/install.sh
cd .github/workflows/installer cd .github/workflows/installer
vc deploy --prod -t ${{ secrets.VERCEL_TOKEN }} vc deploy --prod -t "$VERCEL_TOKEN"

View file

@ -15,9 +15,15 @@ jobs:
name: Add to project name: Add to project
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
env:
GITHUB_TOKEN: ${{ secrets.PROJECT_TOKEN }}
steps: steps:
- name: Authenticate as @ohmyzsh
id: generate_token
uses: ohmyzsh/github-app-token@v2
with:
app_id: ${{ secrets.OHMYZSH_APP_ID }}
private_key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
- name: Store app token
run: echo "GH_TOKEN=${{ steps.generate_token.outputs.token }}" >> "$GITHUB_ENV"
- name: Read project data - name: Read project data
env: env:
ORGANIZATION: ohmyzsh ORGANIZATION: ohmyzsh

View file

@ -115,6 +115,14 @@ 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`:
| Method | Command |
| :-------- | :------------------------------------------------------------------------------------------------ |
| **curl** | `sh -c "$(curl -fsSL https://install.ohmyz.sh/)"` |
| **wget** | `sh -c "$(wget -O- https://install.ohmyz.sh/)"` |
| **fetch** | `sh -c "$(fetch -o - https://install.ohmyz.sh/)"` |
_Note that any previous `.zshrc` will be renamed to `.zshrc.pre-oh-my-zsh`. After installation, you can move the configuration you want to preserve into the new `.zshrc`._ _Note that any previous `.zshrc` will be renamed to `.zshrc.pre-oh-my-zsh`. After installation, you can move the configuration you want to preserve into the new `.zshrc`._
#### Manual Inspection #### Manual Inspection
@ -128,6 +136,8 @@ wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
sh install.sh sh install.sh
``` ```
If the above URL times out or otherwise fails, you may have to substitute the URL for `https://install.ohmyz.sh` to be able to get the script.
## Using Oh My Zsh ## Using Oh My Zsh
### Plugins ### Plugins
@ -247,6 +257,8 @@ the default shell, and it also won't run `zsh` when the installation has finishe
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
``` ```
If you're in China, India, or another country that blocks `raw.githubusercontent.com`, you may have to substitute the URL for `https://install.ohmyz.sh` for it to install.
#### 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 installation of a different repository:

View file

@ -62,7 +62,7 @@ function detect-clipboard() {
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; } function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; } function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; }
function clippaste() { wl-paste; } function clippaste() { wl-paste --no-newline; }
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
function clipcopy() { cat "${1:-/dev/stdin}" | xsel --clipboard --input; } function clipcopy() { cat "${1:-/dev/stdin}" | xsel --clipboard --input; }
function clippaste() { xsel --clipboard --output; } function clippaste() { xsel --clipboard --output; }

View file

@ -182,6 +182,8 @@ function omz_urlencode() {
fi fi
# Use LC_CTYPE=C to process text byte-by-byte # Use LC_CTYPE=C to process text byte-by-byte
# Note that this doesn't work in Termux, as it only has UTF-8 locale.
# Characters will be processed as UTF-8, which is fine for URLs.
local i byte ord LC_ALL=C local i byte ord LC_ALL=C
export LC_ALL export LC_ALL
local reserved=';/?:@&=+$,' local reserved=';/?:@&=+$,'
@ -206,6 +208,9 @@ function omz_urlencode() {
else else
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
url_str+="+" url_str+="+"
elif [[ "$PREFIX" = *com.termux* ]]; then
# Termux does not have non-UTF8 locales, so just send the UTF-8 character directly
url_str+="$byte"
else else
ord=$(( [##16] #byte )) ord=$(( [##16] #byte ))
url_str+="%$ord" url_str+="%$ord"

View file

@ -19,8 +19,13 @@ setopt multios # enable redirect to multiple streams: echo >file1 >
setopt long_list_jobs # show long list format job notifications setopt long_list_jobs # show long list format job notifications
setopt interactivecomments # recognize comments setopt interactivecomments # recognize comments
env_default 'PAGER' 'less' # define pager dependant on what is available (less or more)
env_default 'LESS' '-R' if (( ${+commands[less]} )); then
env_default 'PAGER' 'less'
env_default 'LESS' '-R'
elif (( ${+commands[more]} )); then
env_default 'PAGER' 'more'
fi
## super user alias ## super user alias
alias _='sudo ' alias _='sudo '

View file

@ -16,6 +16,8 @@ plugins=(... aws)
It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. It sets `$AWS_PROFILE_REGION` for display in `aws_prompt_info`. It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. It sets `$AWS_PROFILE_REGION` for display in `aws_prompt_info`.
Run `asp` without arguments to clear the profile. Run `asp` without arguments to clear the profile.
* `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection. * `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection.
* `asp [<profile>] login [<sso_session>]`: In addition to `asp [<profile>] login`, if SSO session has been configured in your aws profile, it will run the `aws sso login --sso-session <sso_session>` command following profile selection.
* `asp [<profile>] logout`: If AWS SSO has been configured in your aws profile, it will run the `aws sso logout` command following profile selection.
* `asr [<region>]`: sets `$AWS_REGION` and `$AWS_DEFAULT_REGION` (legacy) to `<region>`. * `asr [<region>]`: sets `$AWS_REGION` and `$AWS_DEFAULT_REGION` (legacy) to `<region>`.
Run `asr` without arguments to clear the profile. Run `asr` without arguments to clear the profile.

View file

@ -29,7 +29,13 @@ function asp() {
export AWS_PROFILE_REGION=$(aws configure get region) export AWS_PROFILE_REGION=$(aws configure get region)
if [[ "$2" == "login" ]]; then if [[ "$2" == "login" ]]; then
aws sso login if [[ -n "$3" ]]; then
aws sso login --sso-session $3
else
aws sso login
fi
elif [[ "$2" == "logout" ]]; then
aws sso logout
fi fi
} }

View file

@ -1,19 +1,19 @@
# bgnotify zsh plugin # bgnotify zsh plugin
cross-platform background notifications for long running commands! Supports OSX and Ubuntu linux. cross-platform background notifications for long running commands! Supports OSX and Linux.
Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify) Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify)
---------------------------------- ---
## How to use! ## How to use
Just add bgnotify to your plugins list in your `.zshrc` Just add bgnotify to your plugins list in your `.zshrc`
- On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier) - On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier)
* `brew install terminal-notifier` (or `gem install terminal-notifier`) * `brew install terminal-notifier` (or `gem install terminal-notifier`)
- On ubuntu you're already all set! - On Linux, make sure you have `notify-send` or `kdialog` installed. If you're using Ubuntu you should already be all set!
- On windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package - On Windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
## Screenshots ## Screenshots
@ -35,20 +35,29 @@ Just add bgnotify to your plugins list in your `.zshrc`
One can configure a few things: One can configure a few things:
- `bgnotify_bell` enabled or disables the terminal bell (default true)
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds) - `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
- `function bgnotify_formatted` lets you change the notification - `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon.
Use these by adding a function definition before the your call to source. Example: Use these by adding a function definition before the your call to source. Example:
~~~ sh ```sh
bgnotify_bell=false ## disable terminal bell
bgnotify_threshold=4 ## set your own notification threshold bgnotify_threshold=4 ## set your own notification threshold
function bgnotify_formatted { function bgnotify_formatted {
## $1=exit_status, $2=command, $3=elapsed_time ## $1=exit_status, $2=command, $3=elapsed_time
[ $1 -eq 0 ] && title="Holy Smokes Batman!" || title="Holy Graf Zeppelin!"
bgnotify "$title -- after $3 s" "$2"; # Humanly readable elapsed time
local elapsed="$(( $3 % 60 ))s"
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
[ $1 -eq 0 ] && title="Holy Smokes Batman" || title="Holy Graf Zeppelin"
[ $1 -eq 0 ] && icon="$HOME/icons/success.png" || icon="$HOME/icons/fail.png"
bgnotify "$title - took ${elapsed}" "$2" "$icon"
} }
plugins=(git bgnotify) ## add to plugins list plugins=(git bgnotify) ## add to plugins list
source $ZSH/oh-my-zsh.sh ## existing source call source $ZSH/oh-my-zsh.sh ## existing source call
~~~ ```

View file

@ -21,13 +21,12 @@ function bgnotify_end {
local elapsed=$(( EPOCHSECONDS - bgnotify_timestamp )) local elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
# check time elapsed # check time elapsed
[[ $bgnotify_timestamp -gt 0 ]] || return [[ $bgnotify_timestamp -gt 0 ]] || return 0
[[ $elapsed -ge $bgnotify_threshold ]] || return [[ $elapsed -ge $bgnotify_threshold ]] || return 0
# check if Terminal app is not active # check if Terminal app is not active
[[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return [[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return 0
printf '\a' # beep sound
bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed" bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed"
} always { } always {
bgnotify_timestamp=0 bgnotify_timestamp=0
@ -52,61 +51,89 @@ function bgnotify_formatted {
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed" (( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed" (( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
if [[ $1 -eq 0 ]]; then [[ $bgnotify_bell = true ]] && printf '\a' # beep sound
bgnotify "#win (took $elapsed)" "$2" if [[ $exit_status -eq 0 ]]; then
bgnotify "#win (took $elapsed)" "$cmd"
else else
bgnotify "#fail (took $elapsed)" "$2" bgnotify "#fail (took $elapsed)" "$cmd"
fi fi
} }
function bgnotify_appid { function bgnotify_appid {
if (( ${+commands[osascript]} )); then if (( ${+commands[osascript]} )); then
# output is "app ID, window ID" (com.googlecode.iterm2, 116) osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )); then # wayland+sway
elif [[ -n $WAYLAND_DISPLAY && ${+commands[swaymsg]} && ${+commands[jq]} ]]; then # wayland+sway local app_id=$(bgnotify_find_sway_appid)
# output is "app_id, container id" (Alacritty, 1694) [[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(", ")' elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
elif [[ -n $DISPLAY && ${+commands[xprop]} ]]; then
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5 xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
else else
echo $EPOCHSECONDS echo $EPOCHSECONDS
fi fi
} }
function bgnotify_find_sway_appid {
# output is "app_id,container_id", for example "Alacritty,1694"
# see example swaymsg output: https://github.com/ohmyzsh/ohmyzsh/files/13463939/output.json
if (( ${+commands[jq]} )); then
swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(",")'
else
swaymsg -t get_tree | awk '
BEGIN { Id = ""; Appid = ""; FocusNesting = -1; Nesting = 0 }
{
# Enter a block
if ($0 ~ /.*{$/) Nesting++
# Exit a block. If Nesting is now less than FocusNesting, we have the data we are looking for
if ($0 ~ /^[[:blank:]]*}.*/) { Nesting--; if (FocusNesting > 0 && Nesting < FocusNesting) exit 0 }
# Save the Id, it is potentially what we are looking for
if ($0 ~ /^[[:blank:]]*"id": [0-9]*,?$/) { sub(/^[[:blank:]]*"id": /, ""); sub(/,$/, ""); Id = $0 }
# Save the Appid, it is potentially what we are looking for
if ($0 ~ /^[[:blank:]]*"app_id": ".*",?$/) { sub(/^[[:blank:]]*"app_id": "/, ""); sub(/",$/, ""); Appid = $0 }
# Window is focused, this nesting block contains the Id and Appid we want!
if ($0 ~ /^[[:blank:]]*"focused": true,?$/) { FocusNesting = Nesting }
}
END {
if (Appid != "" && Id != "" && FocusNesting != -1) print Appid "," Id
else print ""
}'
fi
}
function bgnotify_programid {
case "$TERM_PROGRAM" in
iTerm.app) echo 'com.googlecode.iterm2' ;;
Apple_Terminal) echo 'com.apple.terminal' ;;
esac
}
function bgnotify { function bgnotify {
local title="$1" local title="$1"
local message="$2" local message="$2"
local icon="$3"
if (( ${+commands[terminal-notifier]} )); then # macOS if (( ${+commands[terminal-notifier]} )); then # macOS
local term_id="${bgnotify_termid%%,*}" # remove window id local term_id=$(bgnotify_programid)
if [[ -z "$term_id" ]]; then terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id" -sender "$term_id"} &>/dev/null
case "$TERM_PROGRAM" in
iTerm.app) term_id='com.googlecode.iterm2' ;;
Apple_Terminal) term_id='com.apple.terminal' ;;
esac
fi
if [[ -z "$term_id" ]]; then
terminal-notifier -message "$message" -title "$title" &>/dev/null
else
terminal-notifier -message "$message" -title "$title" -activate "$term_id" -sender "$term_id" &>/dev/null
fi
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
if [[ -n $ALACRITTY_WINDOW_ID ]]; then notify-send "$title" "$message" ${=icon:+--icon "$icon"}
notify-send -i Alacritty "$title" "$message"
else
notify-send "$title" "$message"
fi
elif (( ${+commands[kdialog]} )); then # KDE elif (( ${+commands[kdialog]} )); then # KDE
kdialog --title "$title" --passivepopup "$message" 5 kdialog --title "$title" --passivepopup "$message" 5
elif (( ${+commands[notifu]} )); then # cygwin elif (( ${+commands[notifu]} )); then # cygwin
notifu /m "$message" /p "$title" notifu /m "$message" /p "$title" ${=icon:+/i "$icon"}
fi fi
} }
## Defaults ## Defaults
# enable terminal bell on notify by default
bgnotify_bell=${bgnotify_bell:-true}
# notify if command took longer than 5s by default # notify if command took longer than 5s by default
bgnotify_threshold=${bgnotify_threshold:-5} bgnotify_threshold=${bgnotify_threshold:-5}

View file

@ -11,23 +11,24 @@ plugins=(... docker-compose)
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
|-----------|--------------------------------|----------------------------------------------------------------------------------| |-----------|----------------------------------|----------------------------------------------------------------------------------|
| dco | `docker-compose` | Docker-compose main command | | dco | `docker-compose` | Docker-compose main command |
| dcb | `docker-compose build` | Build containers | | dcb | `docker-compose build` | Build containers |
| dce | `docker-compose exec` | Execute command inside a container | | dce | `docker-compose exec` | Execute command inside a container |
| dcps | `docker-compose ps` | List containers | | dcps | `docker-compose ps` | List containers |
| dcrestart | `docker-compose restart` | Restart container | | dcrestart | `docker-compose restart` | Restart container |
| dcrm | `docker-compose rm` | Remove container | | dcrm | `docker-compose rm` | Remove container |
| dcr | `docker-compose run` | Run a command in container | | dcr | `docker-compose run` | Run a command in container |
| dcstop | `docker-compose stop` | Stop a container | | dcstop | `docker-compose stop` | Stop a container |
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service | | dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers | | dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon | | dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon | | dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
| dcdn | `docker-compose down` | Stop and remove containers | | dcdn | `docker-compose down` | Stop and remove containers |
| dcl | `docker-compose logs` | Show logs of container | | dcl | `docker-compose logs` | Show logs of container |
| dclf | `docker-compose logs -f` | Show logs and follow output | | dclf | `docker-compose logs -f` | Show logs and follow output |
| dcpull | `docker-compose pull` | Pull image of a service | | dclF | `docker-compose logs -f --tail0` | Just follow recent logs |
| dcstart | `docker-compose start` | Start a container | | dcpull | `docker-compose pull` | Pull image of a service |
| dck | `docker-compose kill` | Kills containers | | dcstart | `docker-compose start` | Start a container |
| dck | `docker-compose kill` | Kills containers |

View file

@ -16,6 +16,7 @@ alias dcupdb="$dccmd up -d --build"
alias dcdn="$dccmd down" alias dcdn="$dccmd down"
alias dcl="$dccmd logs" alias dcl="$dccmd logs"
alias dclf="$dccmd logs -f" alias dclf="$dccmd logs -f"
alias dclF="$dccmd logs -f --tail 0"
alias dcpull="$dccmd pull" alias dcpull="$dccmd pull"
alias dcstart="$dccmd start" alias dcstart="$dccmd start"
alias dck="$dccmd kill" alias dck="$dccmd kill"

View file

@ -1,22 +1,14 @@
# This scripts is copied from (MIT License): # This scripts is copied from (MIT License):
# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh # https://raw.githubusercontent.com/dotnet/sdk/main/scripts/register-completions.zsh
_dotnet_zsh_complete() #compdef dotnet
{ _dotnet_completion() {
local completions=("$(dotnet complete "$words")") local -a completions=("${(@f)$(dotnet complete "${words}")}")
compadd -a completions
# If the completion list is empty, just continue with filename selection _files
if [ -z "$completions" ]
then
_arguments '*::arguments: _normal'
return
fi
# This is not a variable assignment, don't remove spaces!
_values = "${(ps:\n:)completions}"
} }
compdef _dotnet_zsh_complete 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)

View file

@ -60,12 +60,22 @@ Available search contexts are:
| typescript | `https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=` | | typescript | `https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=` |
| unheap | `http://www.unheap.com/?s=` | | unheap | `http://www.unheap.com/?s=` |
| vuejs | `https://www.google.com/search?as_sitesearch=vuejs.org&as_q=` | | vuejs | `https://www.google.com/search?as_sitesearch=vuejs.org&as_q=` |
| nextjs | `https://www.google.com/search?as_sitesearch=nextjs.org&as_q=` |
If you want to have another context, open an Issue and tell us! If you want to have another context, open an Issue and tell us!
## Fallback search behaviour ## Fallback search behaviour
The plugin will use Google as a fallback if the docs site for a search context does not have a search function. You can set the fallback search engine to DuckDuckGo by setting `FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced. The plugin will use Google as a fallback if the docs site for a search context does not have a search
function. You can set the fallback search engine to DuckDuckGo by setting
`FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
## DuckDuckGo Lucky Search
Enable DuckDuckGo's "ducky" (lucky) search feature to automatically access the top search result. This feature
is optimized for DuckDuckGo, as Google redirects to an intermediate page. The FRONTEND_SEARCH_FALLBACK_LUCKY
environment variable triggers the use of DuckDuckGo's lucky search, rendering the FRONTEND_SEARCH_FALLBACK
setting unnecessary in this context.
## Author ## Author

View file

@ -27,12 +27,19 @@ alias stackoverflow='frontend stackoverflow'
alias typescript='frontend typescript' alias typescript='frontend typescript'
alias unheap='frontend unheap' alias unheap='frontend unheap'
alias vuejs='frontend vuejs' alias vuejs='frontend vuejs'
alias nextjs='frontend nextjs'
function _frontend_fallback() { function _frontend_fallback() {
case "$FRONTEND_SEARCH_FALLBACK" in if [[ "$FRONTEND_SEARCH_FALLBACK_LUCKY" == "true" ]]; then
duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;; case true in
*) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;; *) echo "https://duckduckgo.com/?q=!ducky+site%3A$1+" ;;
esac esac
else
case "$FRONTEND_SEARCH_FALLBACK" in
duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;;
*) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;;
esac
fi
} }
function frontend() { function frontend() {
@ -70,6 +77,7 @@ function frontend() {
typescript $(_frontend_fallback 'www.typescriptlang.org/docs') typescript $(_frontend_fallback 'www.typescriptlang.org/docs')
unheap 'http://www.unheap.com/?s=' unheap 'http://www.unheap.com/?s='
vuejs $(_frontend_fallback 'vuejs.org') vuejs $(_frontend_fallback 'vuejs.org')
nextjs $(_frontend_fallback 'nextjs.org')
) )
# show help for command list # show help for command list
@ -81,7 +89,7 @@ function frontend() {
print -P "" print -P ""
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia" print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash," print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia" print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs"
print -P "" print -P ""
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)." print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
print -P "" print -P ""
@ -96,7 +104,7 @@ function frontend() {
echo "" echo ""
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia" echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash," echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia" echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs"
echo "" echo ""
return 1 return 1
fi fi

View file

@ -17,6 +17,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
"/opt/google-cloud-sdk" "/opt/google-cloud-sdk"
"/opt/google-cloud-cli" "/opt/google-cloud-cli"
"/opt/local/libexec/google-cloud-sdk" "/opt/local/libexec/google-cloud-sdk"
"$HOME/.asdf/installs/gcloud/*/"
) )
for gcloud_sdk_location in $search_locations; do for gcloud_sdk_location in $search_locations; do

View file

@ -51,6 +51,7 @@ plugins=(... git)
| `gco` | `git checkout` | | `gco` | `git checkout` |
| `gcor` | `git checkout --recurse-submodules` | | `gcor` | `git checkout --recurse-submodules` |
| `gcb` | `git checkout -b` | | `gcb` | `git checkout -b` |
| `gcB` | `git checkout -B` |
| `gcd` | `git checkout $(git_develop_branch)` | | `gcd` | `git checkout $(git_develop_branch)` |
| `gcm` | `git checkout $(git_main_branch)` | | `gcm` | `git checkout $(git_main_branch)` |
| `gcp` | `git cherry-pick` | | `gcp` | `git cherry-pick` |
@ -69,6 +70,7 @@ plugins=(... git)
| `gca!` | `git commit --verbose --all --amend` | | `gca!` | `git commit --verbose --all --amend` |
| `gcan!` | `git commit --verbose --all --no-edit --amend` | | `gcan!` | `git commit --verbose --all --no-edit --amend` |
| `gcans!` | `git commit --verbose --all --signoff --no-edit --amend` | | `gcans!` | `git commit --verbose --all --signoff --no-edit --amend` |
| `gcann!` | `git commit --verbose --all --date=now --no-edit --amend` |
| `gc!` | `git commit --verbose --amend` | | `gc!` | `git commit --verbose --amend` |
| `gcn!` | `git commit --verbose --no-edit --amend` | | `gcn!` | `git commit --verbose --no-edit --amend` |
| `gcs` | `git commit -S` | | `gcs` | `git commit -S` |
@ -162,7 +164,7 @@ plugins=(... git)
| `grhh` | `git reset --hard` | | `grhh` | `git reset --hard` |
| `grhk` | `git reset --keep` | | `grhk` | `git reset --keep` |
| `grhs` | `git reset --soft` | | `grhs` | `git reset --soft` |
| `gpristine` | `git reset --hard && git clean -dffx` | | `gpristine` | `git reset --hard && git clean --force -dfx` |
| `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` |

View file

@ -157,6 +157,7 @@ alias gbg='LANG=C git branch -vv | grep ": gone\]"'
alias gco='git checkout' alias gco='git checkout'
alias gcor='git checkout --recurse-submodules' alias gcor='git checkout --recurse-submodules'
alias gcb='git checkout -b' alias gcb='git checkout -b'
alias gcB='git checkout -B'
alias gcd='git checkout $(git_develop_branch)' alias gcd='git checkout $(git_develop_branch)'
alias gcm='git checkout $(git_main_branch)' alias gcm='git checkout $(git_main_branch)'
alias gcp='git cherry-pick' alias gcp='git cherry-pick'
@ -193,6 +194,7 @@ alias gca='git commit --verbose --all'
alias gca!='git commit --verbose --all --amend' alias gca!='git commit --verbose --all --amend'
alias gcan!='git commit --verbose --all --no-edit --amend' alias gcan!='git commit --verbose --all --no-edit --amend'
alias gcans!='git commit --verbose --all --signoff --no-edit --amend' alias gcans!='git commit --verbose --all --signoff --no-edit --amend'
alias gcann!='git commit --verbose --all --date=now --no-edit --amend'
alias gc!='git commit --verbose --amend' alias gc!='git commit --verbose --amend'
alias gcn!='git commit --verbose --no-edit --amend' alias gcn!='git commit --verbose --no-edit --amend'
alias gcf='git config --list' alias gcf='git config --list'
@ -352,6 +354,8 @@ alias grss='git restore --source'
alias grst='git restore --staged' alias grst='git restore --staged'
alias gunwip='git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1' alias gunwip='git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1'
alias grev='git revert' alias grev='git revert'
alias greva='git revert --abort'
alias grevc='git revert --continue'
alias grm='git rm' alias grm='git rm'
alias grmc='git rm --cached' alias grmc='git rm --cached'
alias gcount='git shortlog --summary --numbered' alias gcount='git shortlog --summary --numbered'

View file

@ -58,6 +58,12 @@
# #
# When set to "1" suggest all options, including options which are # When set to "1" suggest all options, including options which are
# typically hidden (e.g. '--allow-empty' for 'git commit'). # typically hidden (e.g. '--allow-empty' for 'git commit').
#
# GIT_COMPLETION_IGNORE_CASE
#
# When set, uses for-each-ref '--ignore-case' to find refs that match
# case insensitively, even on systems with case sensitive file systems
# (e.g., completing tag name "FOO" on "git checkout f<TAB>").
# The following functions are meant to modify COMPREPLY, which should not be # The following functions are meant to modify COMPREPLY, which should not be
# modified directly. The purpose is to localize the modifications so it's # modified directly. The purpose is to localize the modifications so it's
@ -320,116 +326,6 @@ else
unset $(compgen -v __gitcomp_builtin_) unset $(compgen -v __gitcomp_builtin_)
fi fi
__gitcomp_builtin_add_default=" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-removal --refresh --ignore-errors --ignore-missing --sparse --chmod= --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit --no-force --no-update --no-renormalize --no-intent-to-add --no-all --no-ignore-removal --no-refresh --no-ignore-errors --no-ignore-missing --no-sparse --no-chmod --no-pathspec-from-file --no-pathspec-file-nul"
__gitcomp_builtin_am_default=" --interactive --3way --quiet --signoff --utf8 --keep --keep-non-patch --message-id --keep-cr --no-keep-cr --scissors --quoted-cr= --whitespace= --ignore-space-change --ignore-whitespace --directory= --exclude= --include= --patch-format= --reject --resolvemsg= --continue --resolved --skip --abort --quit --show-current-patch --allow-empty --committer-date-is-author-date --ignore-date --rerere-autoupdate --gpg-sign --empty= -- --no-interactive --no-3way --no-quiet --no-signoff --no-utf8 --no-keep --no-keep-non-patch --no-message-id --no-scissors --no-whitespace --no-ignore-space-change --no-ignore-whitespace --no-directory --no-exclude --no-include --no-patch-format --no-reject --no-resolvemsg --no-committer-date-is-author-date --no-ignore-date --no-rerere-autoupdate --no-gpg-sign"
__gitcomp_builtin_apply_default=" --exclude= --include= --no-add --stat --numstat --summary --check --index --intent-to-add --cached --apply --3way --build-fake-ancestor= --whitespace= --ignore-space-change --ignore-whitespace --reverse --unidiff-zero --reject --allow-overlap --verbose --quiet --inaccurate-eof --recount --directory= --allow-empty --add -- --no-stat --no-numstat --no-summary --no-check --no-index --no-intent-to-add --no-cached --no-apply --no-3way --no-build-fake-ancestor --no-whitespace --no-ignore-space-change --no-ignore-whitespace --no-reverse --no-unidiff-zero --no-reject --no-allow-overlap --no-verbose --no-quiet --no-inaccurate-eof --no-recount --no-directory --no-allow-empty"
__gitcomp_builtin_archive_default=" --output= --remote= --exec= --no-output -- --no-remote --no-exec"
__gitcomp_builtin_bisect__helper_default=" --bisect-reset --bisect-next-check --bisect-terms --bisect-start --bisect-next --bisect-state --bisect-log --bisect-replay --bisect-skip --bisect-visualize --bisect-run --no-log --log"
__gitcomp_builtin_blame_default=" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --ignore-rev= --ignore-revs-file= --color-lines --color-by-age --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-ignore-rev --no-ignore-revs-file --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev"
__gitcomp_builtin_branch_default=" --verbose --quiet --track --set-upstream-to= --unset-upstream --color --remotes --contains --no-contains --abbrev --all --delete --move --copy --list --show-current --create-reflog --edit-description --merged --no-merged --column --sort= --points-at= --ignore-case --recurse-submodules --format= -- --no-verbose --no-quiet --no-track --no-set-upstream-to --no-unset-upstream --no-color --no-remotes --no-abbrev --no-all --no-delete --no-move --no-copy --no-list --no-show-current --no-create-reflog --no-edit-description --no-column --no-sort --no-points-at --no-ignore-case --no-recurse-submodules --no-format"
__gitcomp_builtin_bugreport_default=" --output-directory= --suffix= --no-output-directory -- --no-suffix"
__gitcomp_builtin_cat_file_default=" --allow-unknown-type --batch --batch-check --batch-command --batch-all-objects --buffer --follow-symlinks --unordered --textconv --filters --path= --no-allow-unknown-type -- --no-buffer --no-follow-symlinks --no-unordered --no-path"
__gitcomp_builtin_check_attr_default=" --all --cached --stdin --no-all -- --no-cached --no-stdin"
__gitcomp_builtin_check_ignore_default=" --quiet --verbose --stdin --non-matching --no-index --index -- --no-quiet --no-verbose --no-stdin --no-non-matching"
__gitcomp_builtin_check_mailmap_default=" --stdin --no-stdin"
__gitcomp_builtin_checkout_default=" --guess --overlay --quiet --recurse-submodules --progress --merge --conflict= --detach --track --orphan= --ignore-other-worktrees --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-guess -- --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-detach --no-track --no-orphan --no-ignore-other-worktrees --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul"
__gitcomp_builtin_checkout__worker_default=" --prefix= --no-prefix"
__gitcomp_builtin_checkout_index_default=" --all --ignore-skip-worktree-bits --force --quiet --no-create --index --stdin --temp --prefix= --stage= --create -- --no-all --no-ignore-skip-worktree-bits --no-force --no-quiet --no-index --no-stdin --no-temp --no-prefix"
__gitcomp_builtin_cherry_default=" --abbrev --verbose --no-abbrev -- --no-verbose"
__gitcomp_builtin_cherry_pick_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --ff --allow-empty --allow-empty-message --keep-redundant-commits --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign --no-ff --no-allow-empty --no-allow-empty-message --no-keep-redundant-commits"
__gitcomp_builtin_clean_default=" --quiet --dry-run --interactive --exclude= --no-quiet -- --no-dry-run --no-interactive"
__gitcomp_builtin_clone_default=" --verbose --quiet --progress --reject-shallow --no-checkout --bare --mirror --local --no-hardlinks --shared --recurse-submodules --jobs= --template= --reference= --reference-if-able= --dissociate --origin= --branch= --upload-pack= --depth= --shallow-since= --shallow-exclude= --single-branch --no-tags --shallow-submodules --separate-git-dir= --config= --server-option= --ipv4 --ipv6 --filter= --also-filter-submodules --remote-submodules --sparse --checkout --hardlinks --tags -- --no-verbose --no-quiet --no-progress --no-reject-shallow --no-bare --no-mirror --no-local --no-shared --no-recurse-submodules --no-recursive --no-jobs --no-template --no-reference --no-reference-if-able --no-dissociate --no-origin --no-branch --no-upload-pack --no-depth --no-shallow-since --no-shallow-exclude --no-single-branch --no-shallow-submodules --no-separate-git-dir --no-config --no-server-option --no-ipv4 --no-ipv6 --no-filter --no-also-filter-submodules --no-remote-submodules --no-sparse"
__gitcomp_builtin_column_default=" --command= --mode --raw-mode= --width= --indent= --nl= --padding= --no-command -- --no-mode --no-raw-mode --no-width --no-indent --no-nl --no-padding"
__gitcomp_builtin_commit_default=" --quiet --verbose --file= --author= --date= --message= --reedit-message= --reuse-message= --fixup= --squash= --reset-author --trailer= --signoff --template= --edit --cleanup= --status --gpg-sign --all --include --interactive --patch --only --no-verify --dry-run --short --branch --ahead-behind --porcelain --long --null --amend --no-post-rewrite --untracked-files --pathspec-from-file= --pathspec-file-nul --verify --post-rewrite -- --no-quiet --no-verbose --no-file --no-author --no-date --no-message --no-reedit-message --no-reuse-message --no-fixup --no-squash --no-reset-author --no-signoff --no-template --no-edit --no-cleanup --no-status --no-gpg-sign --no-all --no-include --no-interactive --no-patch --no-only --no-dry-run --no-short --no-branch --no-ahead-behind --no-porcelain --no-long --no-null --no-amend --no-untracked-files --no-pathspec-from-file --no-pathspec-file-nul"
__gitcomp_builtin_commit_graph_default=" --object-dir= --no-object-dir"
__gitcomp_builtin_config_default=" --global --system --local --worktree --file= --blob= --get --get-all --get-regexp --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section --list --fixed-value --edit --get-color --get-colorbool --type= --bool --int --bool-or-int --bool-or-str --path --expiry-date --null --name-only --includes --show-origin --show-scope --default= --no-global -- --no-system --no-local --no-worktree --no-file --no-blob --no-get --no-get-all --no-get-regexp --no-get-urlmatch --no-replace-all --no-add --no-unset --no-unset-all --no-rename-section --no-remove-section --no-list --no-fixed-value --no-edit --no-get-color --no-get-colorbool --no-type --no-null --no-name-only --no-includes --no-show-origin --no-show-scope --no-default"
__gitcomp_builtin_count_objects_default=" --verbose --human-readable --no-verbose -- --no-human-readable"
__gitcomp_builtin_credential_cache_default=" --timeout= --socket= --no-timeout -- --no-socket"
__gitcomp_builtin_credential_cache__daemon_default=" --debug --no-debug"
__gitcomp_builtin_credential_store_default=" --file= --no-file"
__gitcomp_builtin_describe_default=" --contains --debug --all --tags --long --first-parent --abbrev --exact-match --candidates= --match= --exclude= --always --dirty --broken --no-contains -- --no-debug --no-all --no-tags --no-long --no-first-parent --no-abbrev --no-exact-match --no-candidates --no-match --no-exclude --no-always --no-dirty --no-broken"
__gitcomp_builtin_difftool_default=" --gui --dir-diff --no-prompt --symlinks --tool= --tool-help --trust-exit-code --extcmd= --no-index --index -- --no-gui --no-dir-diff --no-symlinks --no-tool --no-tool-help --no-trust-exit-code --no-extcmd"
__gitcomp_builtin_env__helper_default=" --type= --default= --exit-code --no-default -- --no-exit-code"
__gitcomp_builtin_fast_export_default=" --progress= --signed-tags= --tag-of-filtered-object= --reencode= --export-marks= --import-marks= --import-marks-if-exists= --fake-missing-tagger --full-tree --use-done-feature --no-data --refspec= --anonymize --anonymize-map= --reference-excluded-parents --show-original-ids --mark-tags --data -- --no-progress --no-signed-tags --no-tag-of-filtered-object --no-reencode --no-export-marks --no-import-marks --no-import-marks-if-exists --no-fake-missing-tagger --no-full-tree --no-use-done-feature --no-refspec --no-anonymize --no-reference-excluded-parents --no-show-original-ids --no-mark-tags"
__gitcomp_builtin_fetch_default=" --verbose --quiet --all --set-upstream --append --atomic --upload-pack= --force --multiple --tags --jobs= --prefetch --prune --prune-tags --recurse-submodules --dry-run --write-fetch-head --keep --update-head-ok --progress --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --refetch --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --negotiate-only --filter= --auto-maintenance --auto-gc --show-forced-updates --write-commit-graph --stdin --no-verbose -- --no-quiet --no-all --no-set-upstream --no-append --no-atomic --no-upload-pack --no-force --no-multiple --no-tags --no-jobs --no-prefetch --no-prune --no-prune-tags --no-recurse-submodules --no-dry-run --no-write-fetch-head --no-keep --no-update-head-ok --no-progress --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-negotiate-only --no-filter --no-auto-maintenance --no-auto-gc --no-show-forced-updates --no-write-commit-graph --no-stdin"
__gitcomp_builtin_fmt_merge_msg_default=" --log --message= --into-name= --file= --no-log -- --no-message --no-into-name --no-file"
__gitcomp_builtin_for_each_ref_default=" --shell --perl --python --tcl --count= --format= --color --sort= --points-at= --merged --no-merged --contains --no-contains --ignore-case -- --no-shell --no-perl --no-python --no-tcl --no-count --no-format --no-color --no-sort --no-points-at --no-ignore-case"
__gitcomp_builtin_for_each_repo_default=" --config= --no-config"
__gitcomp_builtin_format_patch_default=" --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --to= --cc= --from --in-reply-to= --attach --inline --thread --signature= --base= --signature-file= --quiet --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-numbered --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-to --no-cc --no-from --no-in-reply-to --no-attach --no-thread --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
__gitcomp_builtin_fsck_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects"
__gitcomp_builtin_fsck_objects_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects"
__gitcomp_builtin_fsmonitor__daemon_default=""
__gitcomp_builtin_gc_default=" --quiet --prune --aggressive --keep-largest-pack --no-quiet -- --no-prune --no-aggressive --no-keep-largest-pack"
__gitcomp_builtin_grep_default=" --cached --no-index --untracked --exclude-standard --recurse-submodules --invert-match --ignore-case --word-regexp --text --textconv --recursive --max-depth= --extended-regexp --basic-regexp --fixed-strings --perl-regexp --line-number --column --full-name --files-with-matches --name-only --files-without-match --only-matching --count --color --break --heading --context= --before-context= --after-context= --threads= --show-function --function-context --and --or --not --quiet --all-match --index -- --no-cached --no-untracked --no-exclude-standard --no-recurse-submodules --no-invert-match --no-ignore-case --no-word-regexp --no-text --no-textconv --no-recursive --no-extended-regexp --no-basic-regexp --no-fixed-strings --no-perl-regexp --no-line-number --no-column --no-full-name --no-files-with-matches --no-name-only --no-files-without-match --no-only-matching --no-count --no-color --no-break --no-heading --no-context --no-before-context --no-after-context --no-threads --no-show-function --no-function-context --no-or --no-quiet --no-all-match"
__gitcomp_builtin_hash_object_default=" --stdin --stdin-paths --no-filters --literally --path= --filters -- --no-stdin --no-stdin-paths --no-literally --no-path"
__gitcomp_builtin_help_default=" --all --external-commands --aliases --man --web --info --verbose --guides --config --no-external-commands -- --no-aliases --no-man --no-web --no-info --no-verbose"
__gitcomp_builtin_hook_default=""
__gitcomp_builtin_init_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format"
__gitcomp_builtin_init_db_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format"
__gitcomp_builtin_interpret_trailers_default=" --in-place --trim-empty --where= --if-exists= --if-missing= --only-trailers --only-input --unfold --parse --no-divider --trailer= --divider -- --no-in-place --no-trim-empty --no-where --no-if-exists --no-if-missing --no-only-trailers --no-only-input --no-unfold --no-trailer"
__gitcomp_builtin_log_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
__gitcomp_builtin_ls_files_default=" --cached --deleted --modified --others --ignored --stage --killed --directory --eol --empty-directory --unmerged --resolve-undo --exclude= --exclude-from= --exclude-per-directory= --exclude-standard --full-name --recurse-submodules --error-unmatch --with-tree= --abbrev --debug --deduplicate --sparse --no-cached -- --no-deleted --no-modified --no-others --no-ignored --no-stage --no-killed --no-directory --no-eol --no-empty-directory --no-unmerged --no-resolve-undo --no-exclude-per-directory --no-recurse-submodules --no-error-unmatch --no-with-tree --no-abbrev --no-debug --no-deduplicate --no-sparse"
__gitcomp_builtin_ls_remote_default=" --quiet --upload-pack= --tags --heads --refs --get-url --sort= --symref --server-option= --no-quiet -- --no-upload-pack --no-tags --no-heads --no-refs --no-get-url --no-sort --no-symref --no-server-option"
__gitcomp_builtin_ls_tree_default=" --long --name-only --name-status --object-only --full-name --full-tree --format= --abbrev --no-full-name -- --no-full-tree --no-abbrev"
__gitcomp_builtin_merge_default=" --stat --summary --log --squash --commit --edit --cleanup= --ff --ff-only --rerere-autoupdate --verify-signatures --strategy= --strategy-option= --message= --file --into-name= --verbose --quiet --abort --quit --continue --allow-unrelated-histories --progress --gpg-sign --autostash --overwrite-ignore --signoff --no-verify --verify -- --no-stat --no-summary --no-log --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-rerere-autoupdate --no-verify-signatures --no-strategy --no-strategy-option --no-message --no-into-name --no-verbose --no-quiet --no-abort --no-quit --no-continue --no-allow-unrelated-histories --no-progress --no-gpg-sign --no-autostash --no-overwrite-ignore --no-signoff"
__gitcomp_builtin_merge_base_default=" --all --octopus --independent --is-ancestor --fork-point --no-all"
__gitcomp_builtin_merge_file_default=" --stdout --diff3 --zdiff3 --ours --theirs --union --marker-size= --quiet --no-stdout -- --no-diff3 --no-zdiff3 --no-ours --no-theirs --no-union --no-marker-size --no-quiet"
__gitcomp_builtin_mktree_default=" --missing --batch --no-missing -- --no-batch"
__gitcomp_builtin_multi_pack_index_default=" --object-dir= --no-object-dir"
__gitcomp_builtin_mv_default=" --verbose --dry-run --sparse --no-verbose -- --no-dry-run --no-sparse"
__gitcomp_builtin_name_rev_default=" --name-only --tags --refs= --exclude= --all --stdin --annotate-stdin --undefined --always --no-name-only -- --no-tags --no-refs --no-exclude --no-all --no-stdin --no-annotate-stdin --no-undefined --no-always"
__gitcomp_builtin_notes_default=" --ref= --no-ref"
__gitcomp_builtin_pack_objects_default=" --quiet --progress --all-progress --all-progress-implied --index-version= --max-pack-size= --local --incremental --window= --window-memory= --depth= --reuse-delta --reuse-object --delta-base-offset --threads= --non-empty --revs --unpacked --all --reflog --indexed-objects --stdin-packs --stdout --include-tag --keep-unreachable --pack-loose-unreachable --unpack-unreachable --sparse --thin --shallow --honor-pack-keep --keep-pack= --compression= --keep-true-parents --use-bitmap-index --write-bitmap-index --filter= --missing= --exclude-promisor-objects --delta-islands --uri-protocol= --no-quiet -- --no-progress --no-all-progress --no-all-progress-implied --no-local --no-incremental --no-window --no-depth --no-reuse-delta --no-reuse-object --no-delta-base-offset --no-threads --no-non-empty --no-revs --no-stdin-packs --no-stdout --no-include-tag --no-keep-unreachable --no-pack-loose-unreachable --no-unpack-unreachable --no-sparse --no-thin --no-shallow --no-honor-pack-keep --no-keep-pack --no-compression --no-keep-true-parents --no-use-bitmap-index --no-write-bitmap-index --no-filter --no-exclude-promisor-objects --no-delta-islands --no-uri-protocol"
__gitcomp_builtin_pack_refs_default=" --all --prune --no-all -- --no-prune"
__gitcomp_builtin_pickaxe_default=" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --ignore-rev= --ignore-revs-file= --color-lines --color-by-age --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-ignore-rev --no-ignore-revs-file --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev"
__gitcomp_builtin_prune_default=" --dry-run --verbose --progress --expire= --exclude-promisor-objects --no-dry-run -- --no-verbose --no-progress --no-expire --no-exclude-promisor-objects"
__gitcomp_builtin_prune_packed_default=" --dry-run --quiet --no-dry-run -- --no-quiet"
__gitcomp_builtin_pull_default=" --verbose --quiet --progress --recurse-submodules --rebase --stat --log --signoff --squash --commit --edit --cleanup= --ff --ff-only --verify --verify-signatures --autostash --strategy= --strategy-option= --gpg-sign --allow-unrelated-histories --all --append --upload-pack= --force --tags --prune --jobs --dry-run --keep --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --show-forced-updates --set-upstream --no-verbose -- --no-quiet --no-progress --no-recurse-submodules --no-rebase --no-stat --no-log --no-signoff --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-verify --no-verify-signatures --no-autostash --no-strategy --no-strategy-option --no-gpg-sign --no-allow-unrelated-histories --no-all --no-append --no-upload-pack --no-force --no-tags --no-prune --no-jobs --no-dry-run --no-keep --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-show-forced-updates --no-set-upstream"
__gitcomp_builtin_push_default=" --verbose --quiet --repo= --all --mirror --delete --tags --dry-run --porcelain --force --force-with-lease --force-if-includes --recurse-submodules= --receive-pack= --exec= --set-upstream --progress --prune --no-verify --follow-tags --signed --atomic --push-option= --ipv4 --ipv6 --verify -- --no-verbose --no-quiet --no-repo --no-all --no-mirror --no-delete --no-tags --no-dry-run --no-porcelain --no-force --no-force-with-lease --no-force-if-includes --no-recurse-submodules --no-receive-pack --no-exec --no-set-upstream --no-progress --no-prune --no-follow-tags --no-signed --no-atomic --no-push-option --no-ipv4 --no-ipv6"
__gitcomp_builtin_range_diff_default=" --creation-factor= --no-dual-color --notes --left-only --right-only --patch --no-patch --unified --function-context --raw --patch-with-raw --patch-with-stat --numstat --shortstat --dirstat --cumulative --dirstat-by-file --check --summary --name-only --name-status --stat --stat-width= --stat-name-width= --stat-graph-width= --stat-count= --compact-summary --binary --full-index --color --ws-error-highlight= --abbrev --src-prefix= --dst-prefix= --line-prefix= --no-prefix --inter-hunk-context= --output-indicator-new= --output-indicator-old= --output-indicator-context= --break-rewrites --find-renames --irreversible-delete --find-copies --find-copies-harder --no-renames --rename-empty --follow --minimal --ignore-all-space --ignore-space-change --ignore-space-at-eol --ignore-cr-at-eol --ignore-blank-lines --ignore-matching-lines= --indent-heuristic --patience --histogram --diff-algorithm= --anchored= --word-diff --word-diff-regex= --color-words --color-moved --color-moved-ws= --relative --text --exit-code --quiet --ext-diff --textconv --ignore-submodules --submodule --ita-invisible-in-index --ita-visible-in-index --pickaxe-all --pickaxe-regex --rotate-to= --skip-to= --find-object= --diff-filter= --output= --dual-color -- --no-creation-factor --no-notes --no-left-only --no-right-only --no-function-context --no-compact-summary --no-full-index --no-color --no-abbrev --no-find-copies-harder --no-rename-empty --no-follow --no-minimal --no-ignore-matching-lines --no-indent-heuristic --no-color-moved --no-color-moved-ws --no-relative --no-text --no-exit-code --no-quiet --no-ext-diff --no-textconv"
__gitcomp_builtin_read_tree_default=" --index-output= --empty --verbose --trivial --aggressive --reset --prefix= --exclude-per-directory= --dry-run --no-sparse-checkout --debug-unpack --recurse-submodules --quiet --sparse-checkout -- --no-empty --no-verbose --no-trivial --no-aggressive --no-reset --no-dry-run --no-debug-unpack --no-recurse-submodules --no-quiet"
__gitcomp_builtin_rebase_default=" --onto= --keep-base --no-verify --quiet --verbose --no-stat --signoff --committer-date-is-author-date --reset-author-date --ignore-whitespace --whitespace= --force-rebase --no-ff --continue --skip --abort --quit --edit-todo --show-current-patch --apply --merge --interactive --rerere-autoupdate --empty= --autosquash --gpg-sign --autostash --exec= --rebase-merges --fork-point --strategy= --strategy-option= --root --reschedule-failed-exec --reapply-cherry-picks --verify --stat --ff -- --no-onto --no-keep-base --no-quiet --no-verbose --no-signoff --no-committer-date-is-author-date --no-reset-author-date --no-ignore-whitespace --no-whitespace --no-force-rebase --no-rerere-autoupdate --no-autosquash --no-gpg-sign --no-autostash --no-exec --no-rebase-merges --no-fork-point --no-strategy --no-strategy-option --no-root --no-reschedule-failed-exec --no-reapply-cherry-picks"
__gitcomp_builtin_receive_pack_default=" --quiet --no-quiet"
__gitcomp_builtin_reflog_default=""
__gitcomp_builtin_remote_default=" --verbose --no-verbose"
__gitcomp_builtin_repack_default=" --quiet --local --write-bitmap-index --delta-islands --unpack-unreachable= --keep-unreachable --window= --window-memory= --depth= --threads= --max-pack-size= --pack-kept-objects --keep-pack= --geometric= --write-midx --no-quiet -- --no-local --no-write-bitmap-index --no-delta-islands --no-unpack-unreachable --no-keep-unreachable --no-window --no-window-memory --no-depth --no-threads --no-max-pack-size --no-pack-kept-objects --no-keep-pack --no-geometric --no-write-midx"
__gitcomp_builtin_replace_default=" --list --delete --edit --graft --convert-graft-file --raw --format= --no-raw -- --no-format"
__gitcomp_builtin_rerere_default=" --rerere-autoupdate --no-rerere-autoupdate"
__gitcomp_builtin_reset_default=" --quiet --no-refresh --mixed --soft --hard --merge --keep --recurse-submodules --patch --intent-to-add --pathspec-from-file= --pathspec-file-nul --refresh -- --no-quiet --no-mixed --no-soft --no-hard --no-merge --no-keep --no-recurse-submodules --no-patch --no-intent-to-add --no-pathspec-from-file --no-pathspec-file-nul"
__gitcomp_builtin_restore_default=" --source= --staged --worktree --ignore-unmerged --overlay --quiet --recurse-submodules --progress --merge --conflict= --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-source -- --no-staged --no-worktree --no-ignore-unmerged --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul"
__gitcomp_builtin_revert_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign"
__gitcomp_builtin_rm_default=" --dry-run --quiet --cached --ignore-unmatch --sparse --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-quiet --no-cached --no-ignore-unmatch --no-sparse --no-pathspec-from-file --no-pathspec-file-nul"
__gitcomp_builtin_send_pack_default=" --verbose --quiet --receive-pack= --exec= --remote= --all --dry-run --mirror --force --signed --push-option= --progress --thin --atomic --stateless-rpc --stdin --helper-status --force-with-lease --force-if-includes --no-verbose -- --no-quiet --no-receive-pack --no-exec --no-remote --no-all --no-dry-run --no-mirror --no-force --no-signed --no-push-option --no-progress --no-thin --no-atomic --no-stateless-rpc --no-stdin --no-helper-status --no-force-with-lease --no-force-if-includes"
__gitcomp_builtin_shortlog_default=" --committer --numbered --summary --email --group= --no-committer -- --no-numbered --no-summary --no-email --no-group"
__gitcomp_builtin_show_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
__gitcomp_builtin_show_branch_default=" --all --remotes --color --more --list --no-name --current --sha1-name --merge-base --independent --topo-order --topics --sparse --date-order --reflog --name -- --no-all --no-remotes --no-color --no-more --no-list --no-current --no-sha1-name --no-merge-base --no-independent --no-topo-order --no-topics --no-sparse --no-date-order"
__gitcomp_builtin_show_index_default=" --object-format= --no-object-format"
__gitcomp_builtin_show_ref_default=" --tags --heads --verify --head --dereference --hash --abbrev --quiet --exclude-existing --no-tags -- --no-heads --no-verify --no-head --no-dereference --no-hash --no-abbrev --no-quiet"
__gitcomp_builtin_sparse_checkout_default=""
__gitcomp_builtin_stage_default=" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-removal --refresh --ignore-errors --ignore-missing --sparse --chmod= --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit --no-force --no-update --no-renormalize --no-intent-to-add --no-all --no-ignore-removal --no-refresh --no-ignore-errors --no-ignore-missing --no-sparse --no-chmod --no-pathspec-from-file --no-pathspec-file-nul"
__gitcomp_builtin_stash_default=""
__gitcomp_builtin_status_default=" --verbose --short --branch --show-stash --ahead-behind --porcelain --long --null --untracked-files --ignored --ignore-submodules --column --no-renames --find-renames --renames -- --no-verbose --no-short --no-branch --no-show-stash --no-ahead-behind --no-porcelain --no-long --no-null --no-untracked-files --no-ignored --no-ignore-submodules --no-column"
__gitcomp_builtin_stripspace_default=" --strip-comments --comment-lines"
__gitcomp_builtin_switch_default=" --create= --force-create= --guess --discard-changes --quiet --recurse-submodules --progress --merge --conflict= --detach --track --orphan= --ignore-other-worktrees --no-create -- --no-force-create --no-guess --no-discard-changes --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-detach --no-track --no-orphan --no-ignore-other-worktrees"
__gitcomp_builtin_symbolic_ref_default=" --quiet --delete --short --no-quiet -- --no-delete --no-short"
__gitcomp_builtin_tag_default=" --list --delete --verify --annotate --message= --file= --edit --sign --cleanup= --local-user= --force --create-reflog --column --contains --no-contains --merged --no-merged --sort= --points-at --format= --color --ignore-case -- --no-annotate --no-file --no-edit --no-sign --no-cleanup --no-local-user --no-force --no-create-reflog --no-column --no-sort --no-points-at --no-format --no-color --no-ignore-case"
__gitcomp_builtin_update_index_default=" --ignore-submodules --add --replace --remove --unmerged --refresh --really-refresh --cacheinfo --chmod= --assume-unchanged --no-assume-unchanged --skip-worktree --no-skip-worktree --ignore-skip-worktree-entries --info-only --force-remove --stdin --index-info --unresolve --again --ignore-missing --verbose --clear-resolve-undo --index-version= --split-index --untracked-cache --test-untracked-cache --force-untracked-cache --force-write-index --fsmonitor --fsmonitor-valid --no-fsmonitor-valid -- --no-ignore-submodules --no-add --no-replace --no-remove --no-unmerged --no-ignore-skip-worktree-entries --no-info-only --no-force-remove --no-ignore-missing --no-verbose --no-index-version --no-split-index --no-untracked-cache --no-test-untracked-cache --no-force-untracked-cache --no-force-write-index --no-fsmonitor"
__gitcomp_builtin_update_ref_default=" --no-deref --stdin --create-reflog --deref -- --no-stdin --no-create-reflog"
__gitcomp_builtin_update_server_info_default=" --force --no-force"
__gitcomp_builtin_upload_pack_default=" --stateless-rpc --strict --timeout= --no-stateless-rpc -- --no-strict --no-timeout"
__gitcomp_builtin_verify_commit_default=" --verbose --raw --no-verbose -- --no-raw"
__gitcomp_builtin_verify_pack_default=" --verbose --stat-only --object-format= --no-verbose -- --no-stat-only --no-object-format"
__gitcomp_builtin_verify_tag_default=" --verbose --raw --format= --no-verbose -- --no-raw --no-format"
__gitcomp_builtin_version_default=" --build-options --no-build-options"
__gitcomp_builtin_whatchanged_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
__gitcomp_builtin_write_tree_default=" --missing-ok --prefix= --no-missing-ok -- --no-prefix"
__gitcomp_builtin_send_email_default="--sender= --from= --smtp-auth= --8bit-encoding= --no-format-patch --no-bcc --no-suppress-from --no-annotate --relogin-delay= --no-cc --no-signed-off-cc --no-signed-off-by-cc --no-chain-reply-to --smtp-debug= --smtp-domain= --chain-reply-to --dry-run --compose --bcc= --smtp-user= --thread --cc-cover --identity= --to= --reply-to= --no-cc-cover --suppress-cc= --to-cmd= --smtp-server= --smtp-ssl-cert-path= --no-thread --smtp-server-option= --quiet --batch-size= --envelope-sender= --smtp-ssl --no-to --validate --format-patch --suppress-from --cc= --compose-encoding= --to-cover --in-reply-to= --annotate --smtp-encryption= --cc-cmd= --smtp-server-port= --smtp-pass= --signed-off-cc --signed-off-by-cc --no-xmailer --subject= --no-to-cover --confirm= --transfer-encoding= --no-smtp-auth --sendmail-cmd= --no-validate --no-identity --dump-aliases --xmailer --force --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --from --attach --inline --signature= --base= --signature-file= --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-from --no-in-reply-to --no-attach --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
__gitcomp_builtin_get_default ()
{
eval "test -n \"\$${1}_default\" && echo \"\$${1}_default\""
}
# This function is equivalent to # This function is equivalent to
# #
# __gitcomp_opts "$(git xxx --git-completion-helper) ..." # __gitcomp_opts "$(git xxx --git-completion-helper) ..."
@ -457,11 +353,9 @@ __gitcomp_builtin ()
else else
completion_helper="--git-completion-helper" completion_helper="--git-completion-helper"
fi fi
completion="$(__git ${cmd/_/ } $completion_helper ||
__gitcomp_builtin_get_default $var)" || return
# leading and trailing spaces are significant to make # leading and trailing spaces are significant to make
# option removal work correctly. # option removal work correctly.
options=" $incl $completion " options=" $incl $(__git ${cmd/_/ } $completion_helper) " || return
for i in $excl; do for i in $excl; do
options="${options/ $i / }" options="${options/ $i / }"
@ -604,6 +498,7 @@ __git_heads ()
local pfx="${1-}" cur_="${2-}" sfx="${3-}" local pfx="${1-}" cur_="${2-}" sfx="${3-}"
__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/heads/$cur_*" "refs/heads/$cur_*/**" "refs/heads/$cur_*" "refs/heads/$cur_*/**"
} }
@ -617,6 +512,7 @@ __git_remote_heads ()
local pfx="${1-}" cur_="${2-}" sfx="${3-}" local pfx="${1-}" cur_="${2-}" sfx="${3-}"
__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/remotes/$cur_*" "refs/remotes/$cur_*/**" "refs/remotes/$cur_*" "refs/remotes/$cur_*/**"
} }
@ -627,6 +523,7 @@ __git_tags ()
local pfx="${1-}" cur_="${2-}" sfx="${3-}" local pfx="${1-}" cur_="${2-}" sfx="${3-}"
__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/tags/$cur_*" "refs/tags/$cur_*/**" "refs/tags/$cur_*" "refs/tags/$cur_*/**"
} }
@ -646,6 +543,7 @@ __git_dwim_remote_heads ()
# but only output if the branch name is unique # but only output if the branch name is unique
__git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
--sort="refname:strip=3" \ --sort="refname:strip=3" \
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/remotes/*/$cur_*" "refs/remotes/*/$cur_*/**" | \ "refs/remotes/*/$cur_*" "refs/remotes/*/$cur_*/**" | \
uniq -u uniq -u
} }
@ -670,6 +568,7 @@ __git_refs ()
local format refs local format refs
local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}" local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}"
local match="${4-}" local match="${4-}"
local umatch="${4-}"
local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers
__git_find_repo_path __git_find_repo_path
@ -693,12 +592,19 @@ __git_refs ()
fi fi
fi fi
if test "${GIT_COMPLETION_IGNORE_CASE:+1}" = "1"
then
# uppercase with tr instead of ${match,^^} for bash 3.2 compatibility
umatch=$(echo "$match" | tr a-z A-Z 2>/dev/null || echo "$match")
fi
if [ "$list_refs_from" = path ]; then if [ "$list_refs_from" = path ]; then
if [[ "$cur_" == ^* ]]; then if [[ "$cur_" == ^* ]]; then
pfx="$pfx^" pfx="$pfx^"
fer_pfx="$fer_pfx^" fer_pfx="$fer_pfx^"
cur_=${cur_#^} cur_=${cur_#^}
match=${match#^} match=${match#^}
umatch=${umatch#^}
fi fi
case "$cur_" in case "$cur_" in
refs|refs/*) refs|refs/*)
@ -709,7 +615,7 @@ __git_refs ()
*) *)
for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD; do for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD; do
case "$i" in case "$i" in
$match*) $match*|$umatch*)
if [ -e "$dir/$i" ]; then if [ -e "$dir/$i" ]; then
echo "$pfx$i$sfx" echo "$pfx$i$sfx"
fi fi
@ -723,6 +629,7 @@ __git_refs ()
;; ;;
esac esac
__git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \ __git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"${refs[@]}" "${refs[@]}"
if [ -n "$track" ]; then if [ -n "$track" ]; then
__git_dwim_remote_heads "$pfx" "$match" "$sfx" __git_dwim_remote_heads "$pfx" "$match" "$sfx"
@ -742,15 +649,16 @@ __git_refs ()
*) *)
if [ "$list_refs_from" = remote ]; then if [ "$list_refs_from" = remote ]; then
case "HEAD" in case "HEAD" in
$match*) echo "${pfx}HEAD$sfx" ;; $match*|$umatch*) echo "${pfx}HEAD$sfx" ;;
esac esac
__git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \ __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/remotes/$remote/$match*" \ "refs/remotes/$remote/$match*" \
"refs/remotes/$remote/$match*/**" "refs/remotes/$remote/$match*/**"
else else
local query_symref local query_symref
case "HEAD" in case "HEAD" in
$match*) query_symref="HEAD" ;; $match*|$umatch*) query_symref="HEAD" ;;
esac esac
__git ls-remote "$remote" $query_symref \ __git ls-remote "$remote" $query_symref \
"refs/tags/$match*" "refs/heads/$match*" \ "refs/tags/$match*" "refs/heads/$match*" \
@ -888,7 +796,6 @@ __git_list_merge_strategies ()
}' }'
} }
__git_merge_strategies_default='octopus ours recursive resolve subtree'
__git_merge_strategies= __git_merge_strategies=
# 'git merge -s help' (and thus detection of the merge strategy # 'git merge -s help' (and thus detection of the merge strategy
# list) fails, unfortunately, if run outside of any git working # list) fails, unfortunately, if run outside of any git working
@ -898,8 +805,7 @@ __git_merge_strategies=
__git_compute_merge_strategies () __git_compute_merge_strategies ()
{ {
test -n "$__git_merge_strategies" || test -n "$__git_merge_strategies" ||
{ __git_merge_strategies=$(__git_list_merge_strategies); __git_merge_strategies=$(__git_list_merge_strategies)
__git_merge_strategies="${__git_merge_strategies:-__git_merge_strategies_default}"; }
} }
__git_merge_strategy_options="ours theirs subtree subtree= patience __git_merge_strategy_options="ours theirs subtree subtree= patience
@ -2281,7 +2187,7 @@ _git_reflog ()
fi fi
} }
__git_send_email_options="--no-cc-cover --cc= --no-bcc --force --relogin-delay= --to= --suppress-cc= --no-annotate --no-chain-reply-to --sendmail-cmd= --no-identity --transfer-encoding= --validate --no-smtp-auth --confirm= --no-format-patch --reply-to= --smtp-pass= --smtp-server= --annotate --envelope-sender= --no-validate --dry-run --no-thread --smtp-debug= --no-to --thread --no-xmailer --identity= --no-signed-off-cc --no-signed-off-by-cc --smtp-domain= --to-cover --8bit-encoding= --bcc= --smtp-ssl-cert-path= --smtp-user= --cc-cmd= --to-cmd= --no-cc --smtp-server-option= --in-reply-to= --subject= --batch-size= --smtp-auth= --compose --smtp-server-port= --xmailer --no-to-cover --chain-reply-to --smtp-encryption= --dump-aliases --quiet --smtp-ssl --signed-off-cc --signed-off-by-cc --suppress-from --compose-encoding= --no-suppress-from --sender= --from= --format-patch --cc-cover --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --from --attach --inline --signature= --base= --signature-file= --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-from --no-in-reply-to --no-attach --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor" __gitcomp_builtin_send_email_default="--8bit-encoding= --add-header= --annotate --attach --base= --batch-size= --bcc= --binary --cc-cmd= --cc-cover --cc= --chain-reply-to --compose --compose-encoding= --confirm= --cover-from-description= --cover-letter --creation-factor= --dry-run --dump-aliases --envelope-sender= --filename-max-length= --force --force-in-body-from --format-patch --from --from= --identity= --ignore-if-in-upstream --in-reply-to= --inline --interdiff= --keep-subject --numbered --numbered-files --output-directory= --progress --quiet --range-diff= --relogin-delay= --reply-to= --reroll-count= --rfc --sender= --sendmail-cmd= --signature-file= --signature= --signed-off-by-cc --signed-off-cc --signoff --smtp-auth= --smtp-debug= --smtp-domain= --smtp-encryption= --smtp-pass= --smtp-server-option= --smtp-server-port= --smtp-server= --smtp-ssl --smtp-ssl-cert-path= --smtp-user= --start-number= --stdout --subject-prefix= --subject= --suffix= --suppress-cc= --suppress-from --thread --to-cmd= --to-cover --to= --transfer-encoding= --v= --validate --xmailer --zero-commit -- --no-add-header --no-annotate --no-attach --no-base --no-bcc --no-binary --no-cc --no-cc-cover --no-chain-reply-to --no-cover-from-description --no-cover-letter --no-creation-factor --no-filename-max-length --no-force-in-body-from --no-format-patch --no-from --no-identity --no-ignore-if-in-upstream --no-in-reply-to --no-interdiff --no-numbered --no-numbered-files --no-progress --no-quiet --no-range-diff --no-reroll-count --no-signature --no-signature-file --no-signed-off-by-cc --no-signed-off-cc --no-signoff --no-smtp-auth --no-start-number --no-stat --no-stdout --no-suffix --no-suppress-from --no-thread --no-to --no-to-cover --no-validate --no-xmailer --no-zero-commit"
__git_send_email_confirm_options="always never auto cc compose" __git_send_email_confirm_options="always never auto cc compose"
__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all" __git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all"
@ -2321,7 +2227,11 @@ _git_send_email ()
return return
;; ;;
--*) --*)
__gitcomp_builtin send-email "$__git_send_email_options $__git_format_patch_extra_options" # Older versions of git send-email don't have all the options
git send-email --git-completion-helper | grep -q annotate ||
__gitcomp_builtin_send_email=$__gitcomp_builtin_send_email_default
__gitcomp_builtin send-email "$__git_format_patch_extra_options"
return return
;; ;;
esac esac
@ -2456,7 +2366,25 @@ __git_config_vars=
__git_compute_config_vars () __git_compute_config_vars ()
{ {
test -n "$__git_config_vars" || test -n "$__git_config_vars" ||
__git_config_vars="$(git help --config-for-completion | sort -u)" __git_config_vars="$(git help --config-for-completion)"
}
__git_compute_config_sections_old ()
{
__git_compute_config_vars
echo "$__git_config_vars" |
awk -F . '{ dict[$1] = 1 } END { for (e in dict) print e }'
}
__git_config_sections=
__git_compute_config_sections ()
{
test -n "$__git_config_sections" ||
__git_config_sections="$(
git help --config-sections-for-completion > /dev/null 2>&1 &&
git help --config-sections-for-completion ||
__git_compute_config_sections_old
)"
} }
# Completes possible values of various configuration variables. # Completes possible values of various configuration variables.
@ -2670,16 +2598,8 @@ __git_complete_config_variable_name ()
__gitcomp "$__git_config_vars" "" "$cur_" "$sfx" __gitcomp "$__git_config_vars" "" "$cur_" "$sfx"
;; ;;
*) *)
__git_compute_config_vars __git_compute_config_sections
__gitcomp_nl "$(echo "$__git_config_vars" | __gitcomp_nl "$__git_config_sections" "" "$cur_" "."
awk -F . '{
sections[$1] = 1
}
END {
for (s in sections)
print s "."
}
')" "" "$cur_" ""
;; ;;
esac esac
} }
@ -3628,43 +3548,6 @@ __git_complete ()
___git_complete $1 $func ___git_complete $1 $func
} }
if ! git --list-cmds=main >/dev/null 2>&1; then
declare -A __git_cmds
__git_cmds[list-complete]="apply blame cherry config difftool fsck help instaweb mergetool prune reflog remote repack replace request-pull send-email show-branch stage whatchanged"
__git_cmds[list-guide]="attributes cli core-tutorial credentials cvs-migration diffcore everyday faq glossary hooks ignore mailmap modules namespaces remote-helpers repository-layout revisions submodules tutorial tutorial-2 workflows"
__git_cmds[list-mainporcelain]="add am archive bisect branch bundle checkout cherry-pick citool clean clone commit describe diff fetch format-patch gc grep gui init log maintenance merge mv notes pull push range-diff rebase reset restore revert rm shortlog show sparse-checkout stash status submodule switch tag worktree gitk"
__git_cmds[main]="add add--interactive am annotate apply archimport archive bisect bisect--helper blame branch bugreport bundle cat-file check-attr check-ignore check-mailmap check-ref-format checkout checkout--worker checkout-index cherry cherry-pick citool clean clone column commit commit-graph commit-tree config count-objects credential credential-cache credential-cache--daemon credential-store cvsexportcommit cvsimport cvsserver daemon describe diff diff-files diff-index diff-tree difftool difftool--helper env--helper fast-export fast-import fetch fetch-pack filter-branch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects fsmonitor--daemon gc get-tar-commit-id grep gui gui--askpass hash-object help hook http-backend http-fetch http-push imap-send index-pack init init-db instaweb interpret-trailers legacy-rebase legacy-stash log ls-files ls-remote ls-tree mailinfo mailsplit maintenance merge merge-base merge-file merge-index merge-octopus merge-one-file merge-ours merge-recursive merge-recursive-ours merge-recursive-theirs merge-resolve merge-subtree merge-tree mergetool mktag mktree multi-pack-index mv name-rev notes p4 pack-objects pack-redundant pack-refs patch-id pickaxe prune prune-packed pull push quiltimport range-diff read-tree rebase rebase--helper receive-pack reflog relink remote remote-ext remote-fd remote-ftp remote-ftps remote-http remote-https remote-testsvn repack replace request-pull rerere reset restore rev-list rev-parse revert rm send-email send-pack serve sh-i18n--envsubst shell shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace submodule submodule--helper svn switch symbolic-ref tag unpack-file unpack-objects update-index update-ref update-server-info upload-archive upload-archive--writer upload-pack var verify-commit verify-pack verify-tag version web--browse whatchanged worktree write-tree"
__git_cmds[others]=""
__git_cmds[parseopt]="add am apply archive bisect--helper blame branch bugreport cat-file check-attr check-ignore check-mailmap checkout checkout--worker checkout-index cherry cherry-pick clean clone column commit commit-graph config count-objects credential-cache credential-cache--daemon credential-store describe difftool env--helper fast-export fetch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects fsmonitor--daemon gc grep hash-object help hook init init-db interpret-trailers log ls-files ls-remote ls-tree merge merge-base merge-file mktree multi-pack-index mv name-rev notes pack-objects pack-refs pickaxe prune prune-packed pull push range-diff read-tree rebase receive-pack reflog remote repack replace rerere reset restore revert rm send-pack shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace switch symbolic-ref tag update-index update-ref update-server-info upload-pack verify-commit verify-pack verify-tag version whatchanged write-tree "
# Override __git
__git ()
{
case "$1" in
--list-cmds=*)
while read -r -d ',' x; do
case "$x" in
nohelpers)
;;
alias)
;;
config)
;;
*)
echo ${__git_cmds[$x]}
;;
esac
done <<< "${1##--list-cmds=},"
return
;;
esac
git ${__git_C_args:+"${__git_C_args[@]}"} \
${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null
}
fi
___git_complete git __git_main ___git_complete git __git_main
___git_complete gitk __gitk_main ___git_complete gitk __gitk_main

View file

@ -84,6 +84,10 @@
# single '?' character by setting GIT_PS1_COMPRESSSPARSESTATE, or omitted # single '?' character by setting GIT_PS1_COMPRESSSPARSESTATE, or omitted
# by setting GIT_PS1_OMITSPARSESTATE. # by setting GIT_PS1_OMITSPARSESTATE.
# #
# If you would like to see a notification on the prompt when there are
# unresolved conflicts, set GIT_PS1_SHOWCONFLICTSTATE to "yes". The
# prompt will include "|CONFLICT".
#
# If you would like to see more information about the identity of # If you would like to see more information about the identity of
# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE # commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
# to one of these values: # to one of these values:
@ -96,9 +100,7 @@
# #
# If you would like a colored hint about the current dirty state, set # If you would like a colored hint about the current dirty state, set
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on # GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
# the colored output of "git status -sb" and are available only when # the colored output of "git status -sb".
# using __git_ps1 for PROMPT_COMMAND or precmd in Bash,
# but always available in Zsh.
# #
# If you would like __git_ps1 to do nothing in the case when the current # If you would like __git_ps1 to do nothing in the case when the current
# directory is set up to be ignored by git, then set # directory is set up to be ignored by git, then set
@ -255,12 +257,12 @@ __git_ps1_colorize_gitstring ()
local c_lblue='%F{blue}' local c_lblue='%F{blue}'
local c_clear='%f' local c_clear='%f'
else else
# Using \[ and \] around colors is necessary to prevent # Using \001 and \002 around colors is necessary to prevent
# issues with command line editing/browsing/completion! # issues with command line editing/browsing/completion!
local c_red='\[\e[31m\]' local c_red=$'\001\e[31m\002'
local c_green='\[\e[32m\]' local c_green=$'\001\e[32m\002'
local c_lblue='\[\e[1;34m\]' local c_lblue=$'\001\e[1;34m\002'
local c_clear='\[\e[0m\]' local c_clear=$'\001\e[0m\002'
fi fi
local bad_color=$c_red local bad_color=$c_red
local ok_color=$c_green local ok_color=$c_green
@ -508,6 +510,12 @@ __git_ps1 ()
r="$r $step/$total" r="$r $step/$total"
fi fi
local conflict="" # state indicator for unresolved conflicts
if [[ "${GIT_PS1_SHOWCONFLICTSTATE}" == "yes" ]] &&
[[ $(git ls-files --unmerged 2>/dev/null) ]]; then
conflict="|CONFLICT"
fi
local w="" local w=""
local i="" local i=""
local s="" local s=""
@ -564,15 +572,12 @@ __git_ps1 ()
b="\${__git_ps1_branch_name}" b="\${__git_ps1_branch_name}"
fi fi
# NO color option unless in PROMPT_COMMAND mode or it's Zsh
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then __git_ps1_colorize_gitstring
__git_ps1_colorize_gitstring
fi
fi fi
local f="$h$w$i$s$u$p" local f="$h$w$i$s$u$p"
local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}" local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}${conflict}"
if [ $pcmode = yes ]; then if [ $pcmode = yes ]; then
if [ "${__git_printf_supports_v-}" != yes ]; then if [ "${__git_printf_supports_v-}" != yes ]; then

View file

@ -10,9 +10,10 @@ plugins=(... helm)
## Aliases ## Aliases
| Alias | Full command | | Alias | Full command |
| ----- | ------------ | | ----- | -------------- |
| h | helm | | h | helm |
| hin | helm install | | hin | helm install |
| hse | helm search | | hun | helm uninstall |
| hup | helm upgrade | | hse | helm search |
| hup | helm upgrade |

View file

@ -14,5 +14,6 @@ fi
alias h='helm' alias h='helm'
alias hin='helm install' alias hin='helm install'
alias hun='helm uninstall'
alias hse='helm search' alias hse='helm search'
alias hup='helm upgrade' alias hup='helm upgrade'

View file

@ -224,6 +224,8 @@ function quick-look() {
} }
function man-preview() { function man-preview() {
[[ $# -eq 0 ]] && >&2 echo "Usage: $0 command1 [command2 ...]" && return 1
local page local page
for page in "${(@f)"$(man -w $@)"}"; do for page in "${(@f)"$(man -w $@)"}"; do
command mandoc -Tpdf $page | open -f -a Preview command mandoc -Tpdf $page | open -f -a Preview

View file

@ -1,13 +1,13 @@
# Autocompletion for Minikube. if (( ! $+commands[minikube] )); then
# return
if (( $+commands[minikube] )); then
__MINIKUBE_COMPLETION_FILE="${ZSH_CACHE_DIR}/minikube_completion"
if [[ ! -f $__MINIKUBE_COMPLETION_FILE ]]; then
minikube completion zsh >! $__MINIKUBE_COMPLETION_FILE
fi
[[ -f $__MINIKUBE_COMPLETION_FILE ]] && source $__MINIKUBE_COMPLETION_FILE
unset __MINIKUBE_COMPLETION_FILE
fi fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `minikube`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_minikube" ]]; then
typeset -g -A _comps
autoload -Uz _minikube
_comps[minikube]=_minikube
fi
minikube completion zsh >| "$ZSH_CACHE_DIR/completions/_minikube" &|

32
plugins/mise/README.md Normal file
View file

@ -0,0 +1,32 @@
# mise
Adds integration with [mise](https://github.com/jdx/mise) (formerly `rtx`), a runtime executor compatible with
npm, nodenv, pyenv, etc. mise is written in rust and is very fast. 20x-200x faster than asdf. With that being
said, mise is compatible with asdf plugins and .tool-versions files. It can be used as a drop-in replacement.
## Installation
1. [Download & install mise](https://github.com/jdx/mise#installation) by running the following:
```bash
curl https://mise.jdx.dev/install.sh | sh
```
2. [Enable mise](https://github.com/jdx/mise#quickstart) by adding it to your `plugins` definition in
`~/.zshrc`.
```bash
plugins=(mise)
```
## Usage
See the [mise readme](https://github.com/jdx/mise#table-of-contents) for information on how to use mise. Here
are a few examples:
```bash
mise install node Install the current version specified in .tool-versions/.mise.toml
mise use -g node@system Use system node as global default
mise install node@20.0.0 Install a specific version number
mise use -g node@20 Use node-20.x as global default
```

View file

@ -0,0 +1,23 @@
# TODO: 2024-01-03 remove rtx support
local __mise=mise
if (( ! $+commands[mise] )); then
if (( $+commands[rtx] )); then
__mise=rtx
else
return
fi
fi
# Load mise hooks
eval "$($__mise activate zsh)"
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `mise`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_$__mise" ]]; then
typeset -g -A _comps
autoload -Uz _$__mise
_comps[$__mise]=_$__mise
fi
# Generate and load mise completion
$__mise completion zsh >| "$ZSH_CACHE_DIR/completions/_$__mise" &|

View file

@ -24,9 +24,14 @@ if zstyle -t ':omz:plugins:nvm' lazy && \
! zstyle -t ':omz:plugins:nvm' autoload; then ! zstyle -t ':omz:plugins:nvm' autoload; then
# Call nvm when first using nvm, node, npm, pnpm, yarn or other commands in lazy-cmd # Call nvm when first using nvm, node, npm, pnpm, yarn or other commands in lazy-cmd
zstyle -a ':omz:plugins:nvm' lazy-cmd nvm_lazy_cmd zstyle -a ':omz:plugins:nvm' lazy-cmd nvm_lazy_cmd
nvm_lazy_cmd=(nvm node npm npx pnpm yarn $nvm_lazy_cmd) # default values
eval " eval "
function nvm node npm npx pnpm yarn $nvm_lazy_cmd { function $nvm_lazy_cmd {
unfunction nvm node npm npx pnpm yarn $nvm_lazy_cmd for func in $nvm_lazy_cmd; do
if (( \$+functions[\$func] )); then
unfunction \$func
fi
done
# Load nvm if it exists in \$NVM_DIR # Load nvm if it exists in \$NVM_DIR
[[ -f \"\$NVM_DIR/nvm.sh\" ]] && source \"\$NVM_DIR/nvm.sh\" [[ -f \"\$NVM_DIR/nvm.sh\" ]] && source \"\$NVM_DIR/nvm.sh\"
\"\$0\" \"\$@\" \"\$0\" \"\$@\"

View file

@ -34,6 +34,8 @@ toggle set the `PER_DIRECTORY_HISTORY_TOGGLE` environment variable.
and global histories. and global histories.
* `PER_DIRECTORY_HISTORY_TOGGLE` is the key binding used to run the toggle-history * `PER_DIRECTORY_HISTORY_TOGGLE` is the key binding used to run the toggle-history
function above (default `^G`) function above (default `^G`)
* `PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE` is a variable which toggles whether
the current mode is printed to the screen following a mode change (default `true`)
## History ## History

View file

@ -59,6 +59,7 @@
[[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history" [[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history"
[[ -z $HISTORY_START_WITH_GLOBAL ]] && HISTORY_START_WITH_GLOBAL=false [[ -z $HISTORY_START_WITH_GLOBAL ]] && HISTORY_START_WITH_GLOBAL=false
[[ -z $PER_DIRECTORY_HISTORY_TOGGLE ]] && PER_DIRECTORY_HISTORY_TOGGLE='^G' [[ -z $PER_DIRECTORY_HISTORY_TOGGLE ]] && PER_DIRECTORY_HISTORY_TOGGLE='^G'
[[ -z $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE ]] && PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE=true
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# toggle global/directory history used for searching - ctrl-G by default # toggle global/directory history used for searching - ctrl-G by default
@ -68,14 +69,16 @@ function per-directory-history-toggle-history() {
if [[ $_per_directory_history_is_global == true ]]; then if [[ $_per_directory_history_is_global == true ]]; then
_per-directory-history-set-directory-history _per-directory-history-set-directory-history
_per_directory_history_is_global=false _per_directory_history_is_global=false
print -n "\nusing local history" if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then
zle -M "using local history"
fi
else else
_per-directory-history-set-global-history _per-directory-history-set-global-history
_per_directory_history_is_global=true _per_directory_history_is_global=true
print -n "\nusing global history" if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then
zle -M "using global history"
fi
fi fi
zle .push-line
zle .accept-line
} }
autoload per-directory-history-toggle-history autoload per-directory-history-toggle-history

View file

@ -12,7 +12,7 @@ plugins=(... python)
| Command | Description | | Command | Description |
| ---------------- | -------------------------------------------------------------------------------------- | | ---------------- | -------------------------------------------------------------------------------------- |
| `py` | Runs `python3` | | `py` | Runs `python3`. Only set if `py` is not installed. |
| `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv | | `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
| `pyfind` | Finds .py files recursively in the current directory | | `pyfind` | Finds .py files recursively in the current directory |
| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one | | `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |

View file

@ -1,5 +1,5 @@
# python command # set python command if 'py' not installed
alias py='python3' builtin which py > /dev/null || alias py='python3'
# Find python file # Find python file
alias pyfind='find . -name "*.py"' alias pyfind='find . -name "*.py"'
@ -44,7 +44,7 @@ function pyuserpaths() {
alias pygrep='grep -nr --include="*.py"' alias pygrep='grep -nr --include="*.py"'
# Run proper IPython regarding current virtualenv (if any) # Run proper IPython regarding current virtualenv (if any)
alias ipython="python3 -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'" alias ipython='python3 -c "import IPython, sys; sys.exit(IPython.start_ipython())"'
# Share local directory as a HTTP server # Share local directory as a HTTP server
alias pyserver="python3 -m http.server" alias pyserver="python3 -m http.server"

File diff suppressed because it is too large Load diff

View file

@ -43,14 +43,17 @@ _tasks_changed () {
} }
_rake_generate () { _rake_generate () {
echo "version:$_rake_tasks_version" > .rake_tasks local rake_tasks_content="version:$_rake_tasks_version\n"
rake_tasks_content+=$(rake --silent --tasks --all \
rake --silent --tasks --all \
| sed "s/^rake //" | sed "s/\:/\\\:/g" \ | sed "s/^rake //" | sed "s/\:/\\\:/g" \
| sed "s/\[[^]]*\]//g" \ | sed "s/\[[^]]*\]//g" \
| sed "s/ *# /\:/" \ | sed "s/ *# /\:/" \
| sed "s/\:$//" \ | sed "s/\:$//")
>> .rake_tasks
local rake_tasks_file="$(mktemp -t .rake_tasks.XXXXXX)"
echo $rake_tasks_content > $rake_tasks_file
mv $rake_tasks_file .rake_tasks
} }
_rake () { _rake () {

View file

@ -54,6 +54,10 @@ plugins=(... react-native)
| **rnios14pl** | `react-native run-ios --simulator "iPhone 14 Plus"` | | **rnios14pl** | `react-native run-ios --simulator "iPhone 14 Plus"` |
| **rnios14p** | `react-native run-ios --simulator "iPhone 14 Pro"` | | **rnios14p** | `react-native run-ios --simulator "iPhone 14 Pro"` |
| **rnios14pm** | `react-native run-ios --simulator "iPhone 14 Pro Max"` | | **rnios14pm** | `react-native run-ios --simulator "iPhone 14 Pro Max"` |
| **rnios15** | `react-native run-ios --simulator "iPhone 15"` |
| **rnios15pl** | `react-native run-ios --simulator "iPhone 15 Plus"` |
| **rnios15p** | `react-native run-ios --simulator "iPhone 15 Pro"` |
| **rnios15pm** | `react-native run-ios --simulator "iPhone 15 Pro Max"` |
| _iPad_ | | | _iPad_ | |
| **rnipad2** | `react-native run-ios --simulator "iPad 2"` | | **rnipad2** | `react-native run-ios --simulator "iPad 2"` |
| **rnipad5** | `react-native run-ios --simulator "iPad (5th generation)"` | | **rnipad5** | `react-native run-ios --simulator "iPad (5th generation)"` |

View file

@ -39,6 +39,10 @@ alias rnios14='react-native run-ios --simulator "iPhone 14"'
alias rnios14pl='react-native run-ios --simulator "iPhone 14 Plus"' alias rnios14pl='react-native run-ios --simulator "iPhone 14 Plus"'
alias rnios14p='react-native run-ios --simulator "iPhone 14 Pro"' alias rnios14p='react-native run-ios --simulator "iPhone 14 Pro"'
alias rnios14pm='react-native run-ios --simulator "iPhone 14 Pro Max"' alias rnios14pm='react-native run-ios --simulator "iPhone 14 Pro Max"'
alias rnios15='react-native run-ios --simulator "iPhone 15"'
alias rnios15pl='react-native run-ios --simulator "iPhone 15 Plus"'
alias rnios15p='react-native run-ios --simulator "iPhone 15 Pro"'
alias rnios15pm='react-native run-ios --simulator "iPhone 15 Pro Max"'
# iPad # iPad
alias rnipad2='react-native run-ios --simulator "iPad 2"' alias rnipad2='react-native run-ios --simulator "iPad 2"'

View file

@ -1,30 +0,0 @@
## rtx
Adds integration with [rtx](https://github.com/jdx/rtx), a runtime executor compatible with npm, nodenv, pyenv, etc. rtx is written in rust and is very fast. 20x-200x faster than asdf. With that being said, rtx is compatible with asdf plugins and .tool-versions files. It can be used as a drop-in replacement.
### Installation
1. [Download & install rtx](https://github.com/jdx/rtx#installation) by running the following:
```
curl https://rtx.pub/install.sh | sh
```
2. [Enable rtx](https://github.com/jdx/rtx#quickstart) by adding it to your `plugins` definition in `~/.zshrc`.
```
plugins=(rtx)
```
### Usage
See the [rtx readme](https://github.com/jdx/rtx#table-of-contents) for information on how to use rtx. Here are a few examples:
```
rtx install node Install the current version specified in .tool-versions/.rtx.toml
rtx use -g node@system Use system node as global default
rtx install node@20.0.0 Install a specific version number
rtx use -g node@20 Use node-20.x as global default
```

View file

@ -1,18 +1,2 @@
# rtx needs to be in $PATH # TODO: 2024-01-03 remove rtx support
if (( ! ${+commands[rtx]} )); then echo "[oh-my-zsh] 'rtx' plugin has been renamed to 'mise'"
return
fi
# Load rtx hooks
eval "$(rtx activate zsh)"
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `rtx`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_rtx" ]]; then
typeset -g -A _comps
autoload -Uz _rtx
_comps[rtx]=_rtx
fi
# Generate and load rtx completion
rtx completion zsh >! "$ZSH_CACHE_DIR/completions/_rtx" &|

View file

@ -26,6 +26,9 @@ plugins=(... terraform)
| `tfo` | `terraform output` | | `tfo` | `terraform output` |
| `tfp` | `terraform plan` | | `tfp` | `terraform plan` |
| `tfv` | `terraform validate` | | `tfv` | `terraform validate` |
| `tfs` | `terraform state` |
| `tfsh`| `terraform show` |
## Prompt function ## Prompt function

View file

@ -24,3 +24,5 @@ alias tfi='terraform init'
alias tfo='terraform output' alias tfo='terraform output'
alias tfp='terraform plan' alias tfp='terraform plan'
alias tfv='terraform validate' alias tfv='terraform validate'
alias tfs='terraform state'
alias tfsh='terraform show'

View file

@ -4,6 +4,8 @@
![Zsh version 4.3.11 and higher](img/zsh_4.3.11_plus.svg) ![Zsh version 4.3.11 and higher](img/zsh_4.3.11_plus.svg)
[![GitHub stars](https://img.shields.io/github/stars/agkozak/zsh-z.svg)](https://github.com/agkozak/zsh-z/stargazers) [![GitHub stars](https://img.shields.io/github/stars/agkozak/zsh-z.svg)](https://github.com/agkozak/zsh-z/stargazers)
![Zsh-z demo](img/demo.gif)
Zsh-z is a command line tool that allows you to jump quickly to directories that you have visited frequently in the past, or recently -- but most often a combination of the two (a concept known as ["frecency"](https://en.wikipedia.org/wiki/Frecency)). It works by keeping track of when you go to directories and how much time you spend in them. It is then in the position to guess where you want to go when you type a partial string, e.g., `z src` might take you to `~/src/zsh`. `z zsh` might also get you there, and `z c/z` might prove to be even more specific -- it all depends on your habits and how much time you have been using Zsh-z to build up a database. After using Zsh-z for a little while, you will get to where you want to be by typing considerably less than you would need if you were using `cd`. Zsh-z is a command line tool that allows you to jump quickly to directories that you have visited frequently in the past, or recently -- but most often a combination of the two (a concept known as ["frecency"](https://en.wikipedia.org/wiki/Frecency)). It works by keeping track of when you go to directories and how much time you spend in them. It is then in the position to guess where you want to go when you type a partial string, e.g., `z src` might take you to `~/src/zsh`. `z zsh` might also get you there, and `z c/z` might prove to be even more specific -- it all depends on your habits and how much time you have been using Zsh-z to build up a database. After using Zsh-z for a little while, you will get to where you want to be by typing considerably less than you would need if you were using `cd`.
Zsh-z is a native Zsh port of [rupa/z](https://github.com/rupa/z), a tool written for `bash` and Zsh that uses embedded `awk` scripts to do the heavy lifting. It was quite possibly my most used command line tool for a couple of years. I decided to translate it, `awk` parts and all, into pure Zsh script, to see if by eliminating calls to external tools (`awk`, `sort`, `date`, `sed`, `mv`, `rm`, and `chown`) and reducing forking through subshells I could make it faster. The performance increase is impressive, particularly on systems where forking is slow, such as Cygwin, MSYS2, and WSL. I have found that, in those environments, switching directories using Zsh-z can be over 100% faster than it is using `rupa/z`. Zsh-z is a native Zsh port of [rupa/z](https://github.com/rupa/z), a tool written for `bash` and Zsh that uses embedded `awk` scripts to do the heavy lifting. It was quite possibly my most used command line tool for a couple of years. I decided to translate it, `awk` parts and all, into pure Zsh script, to see if by eliminating calls to external tools (`awk`, `sort`, `date`, `sed`, `mv`, `rm`, and `chown`) and reducing forking through subshells I could make it faster. The performance increase is impressive, particularly on systems where forking is slow, such as Cygwin, MSYS2, and WSL. I have found that, in those environments, switching directories using Zsh-z can be over 100% faster than it is using `rupa/z`.
@ -32,6 +34,12 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
<details> <details>
<summary>Here are the latest features and updates.</summary> <summary>Here are the latest features and updates.</summary>
- August 24, 2023
+ Zsh-z will now run when `setopt NO_UNSET` has been enabled (props @ntninja).
- August 23, 2023
+ Better logic for loading `zsh/files` (props @z0rc)
- August 2, 2023
+ Zsh-z still uses the `zsh/files` module when possible, but will fall back on the standard `chown`, `mv`, and `rm` commands in its absence.
- April 27, 2023 - April 27, 2023
+ Zsh-z now allows the user to specify the directory-changing command using the `ZSHZ_CD` environment variable (default: `builtin cd`; props @basnijholt). + Zsh-z now allows the user to specify the directory-changing command using the `ZSHZ_CD` environment variable (default: `builtin cd`; props @basnijholt).
- January 27, 2023 - January 27, 2023
@ -64,7 +72,7 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
+ Temporarily disabling use of `print -v`, which seems to be mangling CJK multibyte strings. + Temporarily disabling use of `print -v`, which seems to be mangling CJK multibyte strings.
- July 27, 2021 - July 27, 2021
+ Internal escaping of path names now works with older versions of ZSH. + Internal escaping of path names now works with older versions of ZSH.
+ Zsh-z now detects and discards any incomplete or incorrectly formattted database entries. + Zsh-z now detects and discards any incomplete or incorrectly formatted database entries.
- July 10, 2021 - July 10, 2021
+ Setting `ZSHZ_TRAILING_SLASH=1` makes it so that a search pattern ending in `/` can match the end of a path; e.g. `z foo/` can match `/path/to/foo`. + Setting `ZSHZ_TRAILING_SLASH=1` makes it so that a search pattern ending in `/` can match the end of a path; e.g. `z foo/` can match `/path/to/foo`.
- June 25, 2021 - June 25, 2021
@ -85,7 +93,7 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
- January 11, 2021 - January 11, 2021
+ Major refactoring of the code. + Major refactoring of the code.
+ `z -lr` and `z -lt` work as expected. + `z -lr` and `z -lt` work as expected.
+ `EXTENDED_GLOB` has been disabled within the plugin to accomodate old-fashioned Windows directories with names such as `Progra~1`. + `EXTENDED_GLOB` has been disabled within the plugin to accommodate old-fashioned Windows directories with names such as `Progra~1`.
+ Removed `zshelldoc` documentation. + Removed `zshelldoc` documentation.
- January 6, 2021 - January 6, 2021
+ I have corrected the frecency routine so that it matches `rupa/z`'s math, but for the present, Zsh-z will continue to display ranks as 1/10000th of what they are in `rupa/z` -- [they had to multiply theirs by 10000](https://github.com/rupa/z/commit/f1f113d9bae9effaef6b1e15853b5eeb445e0712) to work around `bash`'s inadequacies at dealing with decimal fractions. + I have corrected the frecency routine so that it matches `rupa/z`'s math, but for the present, Zsh-z will continue to display ranks as 1/10000th of what they are in `rupa/z` -- [they had to multiply theirs by 10000](https://github.com/rupa/z/commit/f1f113d9bae9effaef6b1e15853b5eeb445e0712) to work around `bash`'s inadequacies at dealing with decimal fractions.
@ -102,13 +110,13 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
### General observations ### General observations
This script can be installed simply by downloading it and sourcing it from your `.zshrc`: This plugin can be installed simply by putting the various files in a directory together and by sourcing `zsh-z.plugin.zsh` in your `.zshrc`:
source /path/to/zsh-z.plugin.zsh source /path/to/zsh-z.plugin.zsh
For tab completion to work, you will want to have loaded `compinit`. The frameworks handle this themselves. If you are not using a framework, put For tab completion to work, `_zshz` *must* be in the same directory as `zsh-z.plugin.zsh`, and you will want to have loaded `compinit`. The frameworks handle this themselves. If you are not using a framework, put
autoload -U compinit && compinit autoload -U compinit; compinit
in your .zshrc somewhere below where you source `zsh-z.plugin.zsh`. in your .zshrc somewhere below where you source `zsh-z.plugin.zsh`.

BIN
plugins/z/img/demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View file

@ -100,20 +100,30 @@ With no ARGUMENT, list the directory history in ascending rank.
} }
# Load zsh/datetime module, if necessary # Load zsh/datetime module, if necessary
(( $+EPOCHSECONDS )) || zmodload zsh/datetime (( ${+EPOCHSECONDS} )) || zmodload zsh/datetime
# Load zsh/files, if necessary
[[ ${builtins[zf_chown]} == 'defined' &&
${builtins[zf_mv]} == 'defined' &&
${builtins[zf_rm]} == 'defined' ]] ||
zmodload -F zsh/files b:zf_chown b:zf_mv b:zf_rm
# Load zsh/system, if necessary
[[ ${modules[zsh/system]} == 'loaded' ]] || zmodload zsh/system &> /dev/null
# Global associative array for internal use # Global associative array for internal use
typeset -gA ZSHZ typeset -gA ZSHZ
# Fallback utilities in case Zsh lacks zsh/files (as is the case with MobaXterm)
ZSHZ[CHOWN]='chown'
ZSHZ[MV]='mv'
ZSHZ[RM]='rm'
# Try to load zsh/files utilities
if [[ ${builtins[zf_chown]-} != 'defined' ||
${builtins[zf_mv]-} != 'defined' ||
${builtins[zf_rm]-} != 'defined' ]]; then
zmodload -F zsh/files b:zf_chown b:zf_mv b:zf_rm &> /dev/null
fi
# Use zsh/files, if it is available
[[ ${builtins[zf_chown]-} == 'defined' ]] && ZSHZ[CHOWN]='zf_chown'
[[ ${builtins[zf_mv]-} == 'defined' ]] && ZSHZ[MV]='zf_mv'
[[ ${builtins[zf_rm]-} == 'defined' ]] && ZSHZ[RM]='zf_rm'
# Load zsh/system, if necessary
[[ ${modules[zsh/system]-} == 'loaded' ]] || zmodload zsh/system &> /dev/null
# Make sure ZSHZ_EXCLUDE_DIRS has been declared so that other scripts can # Make sure ZSHZ_EXCLUDE_DIRS has been declared so that other scripts can
# simply append to it # simply append to it
(( ${+ZSHZ_EXCLUDE_DIRS} )) || typeset -gUa ZSHZ_EXCLUDE_DIRS (( ${+ZSHZ_EXCLUDE_DIRS} )) || typeset -gUa ZSHZ_EXCLUDE_DIRS
@ -145,7 +155,7 @@ is-at-least 5.3.0 && ZSHZ[PRINTV]=1
zshz() { zshz() {
# Don't use `emulate -L zsh' - it breaks PUSHD_IGNORE_DUPS # Don't use `emulate -L zsh' - it breaks PUSHD_IGNORE_DUPS
setopt LOCAL_OPTIONS NO_KSH_ARRAYS NO_SH_WORD_SPLIT EXTENDED_GLOB setopt LOCAL_OPTIONS NO_KSH_ARRAYS NO_SH_WORD_SPLIT EXTENDED_GLOB UNSET
(( ZSHZ_DEBUG )) && setopt LOCAL_OPTIONS WARN_CREATE_GLOBAL (( ZSHZ_DEBUG )) && setopt LOCAL_OPTIONS WARN_CREATE_GLOBAL
local REPLY local REPLY
@ -277,7 +287,7 @@ zshz() {
if (( ret != 0 )); then if (( ret != 0 )); then
# Avoid clobbering the datafile if the write to tempfile failed # Avoid clobbering the datafile if the write to tempfile failed
zf_rm -f "$tempfile" ${ZSHZ[RM]} -f "$tempfile"
return $ret return $ret
fi fi
@ -285,16 +295,17 @@ zshz() {
owner=${ZSHZ_OWNER:-${_Z_OWNER}} owner=${ZSHZ_OWNER:-${_Z_OWNER}}
if (( ZSHZ[USE_FLOCK] )); then if (( ZSHZ[USE_FLOCK] )); then
zf_mv "$tempfile" "$datafile" 2> /dev/null || zf_rm -f "$tempfile" ${ZSHZ[MV]} "$tempfile" "$datafile" 2> /dev/null || ${ZSHZ[RM]} -f "$tempfile"
if [[ -n $owner ]]; then if [[ -n $owner ]]; then
zf_chown ${owner}:"$(id -ng ${owner})" "$datafile" ${ZSHZ[CHOWN]} ${owner}:"$(id -ng ${owner})" "$datafile"
fi fi
else else
if [[ -n $owner ]]; then if [[ -n $owner ]]; then
zf_chown "${owner}":"$(id -ng "${owner}")" "$tempfile" ${ZSHZ[CHOWN]} "${owner}":"$(id -ng "${owner}")" "$tempfile"
fi fi
zf_mv -f "$tempfile" "$datafile" 2> /dev/null || zf_rm -f "$tempfile" ${ZSHZ[MV]} -f "$tempfile" "$datafile" 2> /dev/null ||
${ZSHZ[RM]} -f "$tempfile"
fi fi
# In order to make z -x work, we have to disable zsh-z's adding # In order to make z -x work, we have to disable zsh-z's adding
@ -306,7 +317,7 @@ zshz() {
} }
############################################################ ############################################################
# Read the curent datafile contents, update them, "age" them # Read the current datafile contents, update them, "age" them
# when the total rank gets high enough, and print the new # when the total rank gets high enough, and print the new
# contents to STDOUT. # contents to STDOUT.
# #
@ -884,6 +895,9 @@ alias ${ZSHZ_CMD:-${_Z_CMD:-z}}='zshz 2>&1'
# ZSHZ # ZSHZ
############################################################ ############################################################
_zshz_precmd() { _zshz_precmd() {
# Protect against `setopt NO_UNSET'
setopt LOCAL_OPTIONS UNSET
# Do not add PWD to datafile when in HOME directory, or # Do not add PWD to datafile when in HOME directory, or
# if `z -x' has just been run # if `z -x' has just been run
[[ $PWD == "$HOME" ]] || (( ZSHZ[DIRECTORY_REMOVED] )) && return [[ $PWD == "$HOME" ]] || (( ZSHZ[DIRECTORY_REMOVED] )) && return
@ -931,7 +945,7 @@ add-zsh-hook chpwd _zshz_chpwd
# Completion # Completion
############################################################ ############################################################
# Standarized $0 handling # Standardized $0 handling
# 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}"
@ -958,7 +972,7 @@ ZSHZ[FUNCTIONS]='_zshz_usage
# Enable WARN_NESTED_VAR for functions listed in # Enable WARN_NESTED_VAR for functions listed in
# ZSHZ[FUNCTIONS] # ZSHZ[FUNCTIONS]
############################################################ ############################################################
(( ZSHZ_DEBUG )) && () { (( ${+ZSHZ_DEBUG} )) && () {
if is-at-least 5.4.0; then if is-at-least 5.4.0; then
local x local x
for x in ${=ZSHZ[FUNCTIONS]}; do for x in ${=ZSHZ[FUNCTIONS]}; do

View file

@ -1,7 +1,7 @@
# user, host, full path, and time/date on two lines for easier vgrepping # user, host, full path, and time/date on two lines for easier vgrepping
function hg_prompt_info { function hg_prompt_info {
if (( $+commands[hg] )) && grep -q "prompt" ~/.hgrc; then if (( $+commands[hg] )) && [[ -e ~/.hgrc ]] && grep -q "prompt" ~/.hgrc; then
hg prompt --angle-brackets "\ hg prompt --angle-brackets "\
<hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\ <hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\
</%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\ </%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\

View file

@ -1,7 +1,7 @@
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ ) %{$fg[cyan]%}%c%{$reset_color%}" PROMPT="%(?:%{$fg_bold[green]%}%1{➜%} :%{$fg_bold[red]%}%1{➜%} ) %{$fg[cyan]%}%c%{$reset_color%}"
PROMPT+=' $(git_prompt_info)' PROMPT+=' $(git_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%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}%1{✗%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"

View file

@ -292,16 +292,17 @@ function display-release {
function fmt:hash { function fmt:hash {
#* Uses $hash from outer scope #* Uses $hash from outer scope
local hash="${1:-$hash}" local hash="${1:-$hash}"
local short_hash="${hash:0:7}" # 7 characters sha, top level sha is 12 characters
case "$output" in case "$output" in
raw) printf '%s' "$hash" ;; raw) printf '%s' "$short_hash" ;;
text) text)
local text="\e[33m$hash\e[0m"; # red local text="\e[33m$short_hash\e[0m"; # red
if supports_hyperlinks; then if supports_hyperlinks; then
printf "\e]8;;%s\a%s\e]8;;\a" "https://github.com/ohmyzsh/ohmyzsh/commit/$hash" $text; printf "\e]8;;%s\a%s\e]8;;\a" "https://github.com/ohmyzsh/ohmyzsh/commit/$hash" $text;
else else
echo $text; echo $text;
fi ;; fi ;;
md) printf '[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)' "$hash" "$hash" ;; md) printf '[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)' "$short_hash" "$hash" ;;
esac esac
} }
@ -512,13 +513,13 @@ function main {
# Git log options # Git log options
# -z: commits are delimited by null bytes # -z: commits are delimited by null bytes
# --format: [7-char hash]<field sep>[ref names]<field sep>[subject]<field sep>[body] # --format: [7-char hash]<field sep>[ref names]<field sep>[subject]<field sep>[body]
# --abbrev=7: force commit hashes to be 7 characters long # --abbrev=7: force commit hashes to be 12 characters long
# --no-merges: merge commits are omitted # --no-merges: merge commits are omitted
# --first-parent: commits from merged branches are omitted # --first-parent: commits from merged branches are omitted
local SEP="0mZmAgIcSeP" local SEP="0mZmAgIcSeP"
local -a raw_commits local -a raw_commits
raw_commits=(${(0)"$(command git -c log.showSignature=false log -z \ raw_commits=(${(0)"$(command git -c log.showSignature=false log -z \
--format="%h${SEP}%D${SEP}%s${SEP}%b" --abbrev=7 \ --format="%h${SEP}%D${SEP}%s${SEP}%b" --abbrev=12 \
--no-merges --first-parent $range)"}) --no-merges --first-parent $range)"})
local raw_commit local raw_commit

View file

@ -63,7 +63,9 @@ zdot="${ZDOTDIR:-$HOME}"
# Default value for $ZSH # Default value for $ZSH
# a) if $ZDOTDIR is supplied and not $HOME: $ZDOTDIR/ohmyzsh # a) if $ZDOTDIR is supplied and not $HOME: $ZDOTDIR/ohmyzsh
# b) otherwise, $HOME/.oh-my-zsh # b) otherwise, $HOME/.oh-my-zsh
[ "$ZDOTDIR" = "$HOME" ] || ZSH="${ZSH:-${ZDOTDIR:+$ZDOTDIR/ohmyzsh}}" if [ -n "$ZDOTDIR" ] && [ "$ZDOTDIR" != "$HOME" ]; then
ZSH="${ZSH:-$ZDOTDIR/ohmyzsh}"
fi
ZSH="${ZSH:-$HOME/.oh-my-zsh}" ZSH="${ZSH:-$HOME/.oh-my-zsh}"
REPO=${REPO:-snakewarhead/oh-my-zsh} REPO=${REPO:-snakewarhead/oh-my-zsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git} REMOTE=${REMOTE:-https://github.com/${REPO}.git}