mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 05:59:46 +08:00
Compare commits
No commits in common. "203369b0f9ec284e06b73f555a14fa5f02be5a0a" and "a779d6563ffb2f0093b4b74c8d5ff0982fa3e930" have entirely different histories.
203369b0f9
...
a779d6563f
2
.github/dependencies.yml
vendored
2
.github/dependencies.yml
vendored
@ -39,7 +39,7 @@ dependencies:
|
|||||||
plugins/wd:
|
plugins/wd:
|
||||||
repo: mfaerevaag/wd
|
repo: mfaerevaag/wd
|
||||||
branch: master
|
branch: master
|
||||||
version: tag:v0.7.0
|
version: tag:v0.6.1
|
||||||
precopy: |
|
precopy: |
|
||||||
set -e
|
set -e
|
||||||
rm -r test
|
rm -r test
|
||||||
|
|||||||
2
.github/workflows/dependencies.yml
vendored
2
.github/workflows/dependencies.yml
vendored
@ -2,7 +2,7 @@ name: Update dependencies
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 6 * * 0"
|
- cron: "34 3 * * */8"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
|
|||||||
72
.github/workflows/dependencies/updater.py
vendored
72
.github/workflows/dependencies/updater.py
vendored
@ -228,22 +228,21 @@ class Dependency:
|
|||||||
self.__apply_upstream_changes()
|
self.__apply_upstream_changes()
|
||||||
|
|
||||||
# Add all changes and commit
|
# Add all changes and commit
|
||||||
has_new_commit = Git.add_and_commit(self.name, short_sha)
|
Git.add_and_commit(self.name, short_sha)
|
||||||
|
|
||||||
if has_new_commit:
|
# Push changes to remote
|
||||||
# Push changes to remote
|
Git.push(branch)
|
||||||
Git.push(branch)
|
|
||||||
|
|
||||||
# Create GitHub PR
|
# Create GitHub PR
|
||||||
GitHub.create_pr(
|
GitHub.create_pr(
|
||||||
branch,
|
branch,
|
||||||
f"feat({self.name}): update to version {new_version}",
|
f"feat({self.name}): update to version {new_version}",
|
||||||
f"""## Description
|
f"""## Description
|
||||||
|
|
||||||
Update for **{self.desc}**: update to version [{new_version}]({status['head_url']}).
|
Update for **{self.desc}**: update to version [{new_version}]({status['head_url']}).
|
||||||
Check out the [list of changes]({status['compare_url']}).
|
Check out the [list of changes]({status['compare_url']}).
|
||||||
""",
|
""",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Clean up repository
|
# Clean up repository
|
||||||
Git.clean_repo()
|
Git.clean_repo()
|
||||||
@ -378,21 +377,7 @@ class Git:
|
|||||||
return branch_name
|
return branch_name
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_and_commit(scope: str, version: str) -> bool:
|
def add_and_commit(scope: str, version: str):
|
||||||
"""
|
|
||||||
Returns `True` if there were changes and were indeed commited.
|
|
||||||
Returns `False` if the repo was clean and no changes were commited.
|
|
||||||
"""
|
|
||||||
# check if repo is clean (clean => no error, no commit)
|
|
||||||
try:
|
|
||||||
CommandRunner.run_or_fail(
|
|
||||||
["git", "diff", "--exit-code"], stage="CheckRepoClean"
|
|
||||||
)
|
|
||||||
return False
|
|
||||||
except CommandRunner.Exception:
|
|
||||||
# if it's other kind of error just throw!
|
|
||||||
pass
|
|
||||||
|
|
||||||
user_name = os.environ.get("GIT_APP_NAME")
|
user_name = os.environ.get("GIT_APP_NAME")
|
||||||
user_email = os.environ.get("GIT_APP_EMAIL")
|
user_email = os.environ.get("GIT_APP_EMAIL")
|
||||||
|
|
||||||
@ -405,22 +390,27 @@ class Git:
|
|||||||
clean_env["GIT_CONFIG_GLOBAL"] = "/dev/null"
|
clean_env["GIT_CONFIG_GLOBAL"] = "/dev/null"
|
||||||
clean_env["GIT_CONFIG_NOSYSTEM"] = "1"
|
clean_env["GIT_CONFIG_NOSYSTEM"] = "1"
|
||||||
|
|
||||||
# Commit with settings above
|
# check if repo is clean (clean => no error, no commit)
|
||||||
CommandRunner.run_or_fail(
|
try:
|
||||||
[
|
CommandRunner.run_or_fail(
|
||||||
"git",
|
["git", "diff", "--exit-code"], stage="CheckRepoClean", env=clean_env
|
||||||
"-c",
|
)
|
||||||
f"user.name={user_name}",
|
except CommandRunner.Exception:
|
||||||
"-c",
|
# Commit with settings above
|
||||||
f"user.email={user_email}",
|
CommandRunner.run_or_fail(
|
||||||
"commit",
|
[
|
||||||
"-m",
|
"git",
|
||||||
f"feat({scope}): update to {version}",
|
"-c",
|
||||||
],
|
f"user.name={user_name}",
|
||||||
stage="CreateCommit",
|
"-c",
|
||||||
env=clean_env,
|
f"user.email={user_email}",
|
||||||
)
|
"commit",
|
||||||
return True
|
"-m",
|
||||||
|
f"feat({scope}): update to {version}",
|
||||||
|
],
|
||||||
|
stage="CreateCommit",
|
||||||
|
env=clean_env,
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def push(branch: str):
|
def push(branch: str):
|
||||||
|
|||||||
@ -36,10 +36,6 @@ plugins=(... laravel)
|
|||||||
| `pamj` | `php artisan make:job` |
|
| `pamj` | `php artisan make:job` |
|
||||||
| `paml` | `php artisan make:listener` |
|
| `paml` | `php artisan make:listener` |
|
||||||
| `pamn` | `php artisan make:notification` |
|
| `pamn` | `php artisan make:notification` |
|
||||||
| `pamcl` | `php artisan make:class` |
|
|
||||||
| `pamen` | `php artisan make:enum` |
|
|
||||||
| `pami` | `php artisan make:interface` |
|
|
||||||
| `pamtr` | `php artisan make:trait` |
|
|
||||||
|
|
||||||
## Clears
|
## Clears
|
||||||
|
|
||||||
|
|||||||
@ -25,10 +25,6 @@ alias pamj='php artisan make:job'
|
|||||||
alias paml='php artisan make:listener'
|
alias paml='php artisan make:listener'
|
||||||
alias pamn='php artisan make:notification'
|
alias pamn='php artisan make:notification'
|
||||||
alias pampp='php artisan make:provider'
|
alias pampp='php artisan make:provider'
|
||||||
alias pamcl='php artisan make:class'
|
|
||||||
alias pamen='php artisan make:enum'
|
|
||||||
alias pami='php artisan make:interface'
|
|
||||||
alias pamtr='php artisan make:trait'
|
|
||||||
|
|
||||||
|
|
||||||
# Clears
|
# Clears
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
# tldr plugin
|
|
||||||
|
|
||||||
This plugin adds a shortcut to insert tldr before the previous command.
|
|
||||||
Heavily inspired from [Man plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/man).
|
|
||||||
|
|
||||||
To use it, add `tldr` to the plugins array in your zshrc file:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
plugins=(... tldr)
|
|
||||||
```
|
|
||||||
|
|
||||||
# Keyboard Shortcuts
|
|
||||||
| Shortcut | Description |
|
|
||||||
|------------------------------------|----------------------------------------------------------------------------|
|
|
||||||
| <kbd>Esc</kbd> + tldr | add tldr before the previous command to see the tldr page for this command |
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
tldr-command-line() {
|
|
||||||
# if there is no command typed, use the last command
|
|
||||||
[[ -z "$BUFFER" ]] && zle up-history
|
|
||||||
|
|
||||||
# if typed command begins with tldr, do nothing
|
|
||||||
[[ "$BUFFER" = tldr\ * ]] && return
|
|
||||||
|
|
||||||
# get command and possible subcommand
|
|
||||||
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
|
|
||||||
local -a args
|
|
||||||
args=(${${(Az)BUFFER}[1]} ${${(Az)BUFFER}[2]})
|
|
||||||
|
|
||||||
BUFFER="tldr ${args[1]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
zle -N tldr-command-line
|
|
||||||
# Defined shortcut keys: [Esc]tldr
|
|
||||||
bindkey "\e"tldr tldr-command-line
|
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ rm -f ~/.zcompdump; compinit
|
|||||||
If you want to make use of the `fzf`-powered browse feature to fuzzy search through all your warp points, set up a keybind in your `.zshrc`:
|
If you want to make use of the `fzf`-powered browse feature to fuzzy search through all your warp points, set up a keybind in your `.zshrc`:
|
||||||
|
|
||||||
```zsh
|
```zsh
|
||||||
bindkey ${FZF_WD_BINDKEY:-'^B'} fuzzy_wd_widget
|
bindkey '^G' wd_browse
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@ -158,19 +158,6 @@ If a warp point with the same name exists, use `wd add foo --force` to overwrite
|
|||||||
**Note:** a warp point cannot contain colons, or consist of only spaces and dots.
|
**Note:** a warp point cannot contain colons, or consist of only spaces and dots.
|
||||||
The first will conflict in how `wd` stores the warp points, and the second will conflict with other features, as below.
|
The first will conflict in how `wd` stores the warp points, and the second will conflict with other features, as below.
|
||||||
|
|
||||||
* Add warp point to any directory with default name:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
wd addcd /foo/ bar
|
|
||||||
```
|
|
||||||
|
|
||||||
* Add warp point to any directory with a custom name:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
wd addcd /foo/
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
You can omit point name to automatically use the current directory's name instead.
|
You can omit point name to automatically use the current directory's name instead.
|
||||||
|
|
||||||
* From any directory, warp to `foo` with:
|
* From any directory, warp to `foo` with:
|
||||||
|
|||||||
@ -31,7 +31,6 @@ function _wd() {
|
|||||||
|
|
||||||
commands=(
|
commands=(
|
||||||
'add:Adds the current working directory to your warp points'
|
'add:Adds the current working directory to your warp points'
|
||||||
'addcd:Adds a directory to your warp points'
|
|
||||||
'add!:Overwrites existing warp point'
|
'add!:Overwrites existing warp point'
|
||||||
'export:Export warp points as static named directories'
|
'export:Export warp points as static named directories'
|
||||||
'rm:Removes the given warp point'
|
'rm:Removes the given warp point'
|
||||||
@ -64,9 +63,6 @@ function _wd() {
|
|||||||
add)
|
add)
|
||||||
_message 'Write the name of your warp point' && ret=0
|
_message 'Write the name of your warp point' && ret=0
|
||||||
;;
|
;;
|
||||||
addcd)
|
|
||||||
_message 'Write the name of your path' && ret=0
|
|
||||||
;;
|
|
||||||
show)
|
show)
|
||||||
_describe -t points "Warp points" warp_points && ret=0
|
_describe -t points "Warp points" warp_points && ret=0
|
||||||
;;
|
;;
|
||||||
|
|||||||
@ -14,8 +14,7 @@
|
|||||||
|
|
||||||
eval "wd() { source '${0:A:h}/wd.sh' }"
|
eval "wd() { source '${0:A:h}/wd.sh' }"
|
||||||
wd > /dev/null
|
wd > /dev/null
|
||||||
zle -N wd_browse_widget
|
# Register the function as a Zsh widget
|
||||||
zle -N wd_restore_buffer
|
zle -N wd_browse
|
||||||
autoload -Uz add-zle-hook-widget
|
# Bind the widget to a key combination
|
||||||
add-zle-hook-widget line-init wd_restore_buffer
|
bindkey '^G' wd_browse
|
||||||
bindkey ${FZF_WD_BINDKEY:-'^B'} wd_browse_widget
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
# @github.com/mfaerevaag/wd
|
# @github.com/mfaerevaag/wd
|
||||||
|
|
||||||
# version
|
# version
|
||||||
readonly WD_VERSION=0.7.0
|
readonly WD_VERSION=0.6.1
|
||||||
|
|
||||||
# colors
|
# colors
|
||||||
readonly WD_BLUE="\033[96m"
|
readonly WD_BLUE="\033[96m"
|
||||||
@ -59,7 +59,7 @@ wd_print_msg()
|
|||||||
then
|
then
|
||||||
local color="${1:-$WD_BLUE}" # Default to blue if no color is provided
|
local color="${1:-$WD_BLUE}" # Default to blue if no color is provided
|
||||||
local msg="$2"
|
local msg="$2"
|
||||||
|
|
||||||
if [[ -z "$msg" ]]; then
|
if [[ -z "$msg" ]]; then
|
||||||
print "${WD_RED}*${WD_NOC} Could not print message. Sorry!"
|
print "${WD_RED}*${WD_NOC} Could not print message. Sorry!"
|
||||||
else
|
else
|
||||||
@ -74,20 +74,18 @@ wd_print_usage()
|
|||||||
Usage: wd [command] [point]
|
Usage: wd [command] [point]
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
<point> Warps to the directory specified by the warp point
|
<point> Warps to the directory specified by the warp point
|
||||||
<point> <path> Warps to the directory specified by the warp point with path appended
|
<point> <path> Warps to the directory specified by the warp point with path appended
|
||||||
add <point> Adds the current working directory to your warp points
|
add <point> Adds the current working directory to your warp points
|
||||||
add Adds the current working directory to your warp points with current directory's name
|
add Adds the current working directory to your warp points with current directory's name
|
||||||
addcd <path> Adds a path to your warp points with the directory's name
|
rm <point> Removes the given warp point
|
||||||
addcd <path> <point> Adds a path to your warp points with a custom name
|
rm Removes the given warp point with current directory's name
|
||||||
rm <point> Removes the given warp point
|
show <point> Print path to given warp point
|
||||||
rm Removes the given warp point with current directory's name
|
show Print warp points to current directory
|
||||||
show <point> Print path to given warp point
|
list Print all stored warp points
|
||||||
show Print warp points to current directory
|
ls <point> Show files from given warp point (ls)
|
||||||
list Print all stored warp points
|
path <point> Show the path to given warp point (pwd)
|
||||||
ls <point> Show files from given warp point (ls)
|
clean Remove points warping to nonexistent directories (will prompt unless --force is used)
|
||||||
path <point> Show the path to given warp point (pwd)
|
|
||||||
clean Remove points warping to nonexistent directories (will prompt unless --force is used)
|
|
||||||
|
|
||||||
-v | --version Print version
|
-v | --version Print version
|
||||||
-d | --debug Exit after execution with exit codes (for testing)
|
-d | --debug Exit after execution with exit codes (for testing)
|
||||||
@ -205,28 +203,6 @@ wd_add()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
wd_addcd() {
|
|
||||||
local folder="$1"
|
|
||||||
local point=$2
|
|
||||||
local force=$3
|
|
||||||
local currentdir=$PWD
|
|
||||||
|
|
||||||
if [[ -z "$folder" ]]; then
|
|
||||||
wd_exit_fail "You must specify a path"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -d "$folder" ]]; then
|
|
||||||
wd_exit_fail "The directory does not exist"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd "$folder" || return
|
|
||||||
wd_add "$point" "$force"
|
|
||||||
cd "$currentdir" || return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wd_remove()
|
wd_remove()
|
||||||
{
|
{
|
||||||
local point_list=$1
|
local point_list=$1
|
||||||
@ -259,15 +235,7 @@ wd_browse() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
local entries=("${(@f)$(sed "s:${HOME}:~:g" "$WD_CONFIG" | awk -F ':' '{print $1 " -> " $2}')}")
|
local entries=("${(@f)$(sed "s:${HOME}:~:g" "$WD_CONFIG" | awk -F ':' '{print $1 " -> " $2}')}")
|
||||||
local script_path="${${(%):-%x}:h}"
|
local selected_entry=$(printf '%s\n' "${entries[@]}" | fzf --height 40% --reverse)
|
||||||
local wd_remove_output=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
|
|
||||||
local entries_with_headers=("All warp points:" "Press enter to select. Press delete to remove" "${entries[@]}")
|
|
||||||
local fzf_bind="delete:execute(echo {} | awk -F ' -> ' '{print \$1}' | xargs -I {} "$script_path/wd.sh" rm {} > "$wd_remove_output")+abort"
|
|
||||||
local fzf_command=$(printf '%s\n' "${entries_with_headers[@]}" | fzf --height 100% --reverse --header-lines=2 --bind="$fzf_bind")
|
|
||||||
if [[ -e $wd_remove_output ]]; then
|
|
||||||
cat "$wd_remove_output"
|
|
||||||
rm "$wd_remove_output"
|
|
||||||
fi
|
|
||||||
if [[ -n $selected_entry ]]; then
|
if [[ -n $selected_entry ]]; then
|
||||||
local selected_point="${selected_entry%% ->*}"
|
local selected_point="${selected_entry%% ->*}"
|
||||||
selected_point=$(echo "$selected_point" | xargs)
|
selected_point=$(echo "$selected_point" | xargs)
|
||||||
@ -275,24 +243,6 @@ wd_browse() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
wd_browse_widget() {
|
|
||||||
if [[ -e $WD_CONFIG ]]; then
|
|
||||||
wd_browse
|
|
||||||
saved_buffer=$BUFFER
|
|
||||||
saved_cursor=$CURSOR
|
|
||||||
BUFFER=
|
|
||||||
zle redisplay
|
|
||||||
zle accept-line
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
wd_restore_buffer() {
|
|
||||||
BUFFER=$saved_buffer
|
|
||||||
CURSOR=$saved_cursor
|
|
||||||
saved_buffer=
|
|
||||||
saved_cursor=1
|
|
||||||
}
|
|
||||||
|
|
||||||
wd_list_all()
|
wd_list_all()
|
||||||
{
|
{
|
||||||
wd_print_msg "$WD_BLUE" "All warp points:"
|
wd_print_msg "$WD_BLUE" "All warp points:"
|
||||||
@ -421,7 +371,7 @@ wd_export_static_named_directories() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
WD_CONFIG=${WD_CONFIG:-$HOME/.warprc}
|
local WD_CONFIG=${WD_CONFIG:-$HOME/.warprc}
|
||||||
local WD_QUIET=0
|
local WD_QUIET=0
|
||||||
local WD_EXIT_CODE=0
|
local WD_EXIT_CODE=0
|
||||||
local WD_DEBUG=0
|
local WD_DEBUG=0
|
||||||
@ -505,10 +455,6 @@ else
|
|||||||
wd_browse
|
wd_browse
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
"-c"|"--addcd"|"addcd")
|
|
||||||
wd_addcd "$2" "$3" "$wd_force_mode"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
"-e"|"export")
|
"-e"|"export")
|
||||||
wd_export_static_named_directories
|
wd_export_static_named_directories
|
||||||
break
|
break
|
||||||
@ -564,7 +510,6 @@ fi
|
|||||||
unset wd_extglob_is_set
|
unset wd_extglob_is_set
|
||||||
unset wd_warp
|
unset wd_warp
|
||||||
unset wd_add
|
unset wd_add
|
||||||
unset wd_addcd
|
|
||||||
unset wd_remove
|
unset wd_remove
|
||||||
unset wd_show
|
unset wd_show
|
||||||
unset wd_list_all
|
unset wd_list_all
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user