1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-02-12 05:49:47 +08:00

Compare commits

...

5 Commits

Author SHA1 Message Date
sattisumasri
6768906d07
chore: change headings in README to Title Case (#11956)
Co-authored-by: Marc Cornellà <hello@mcornella.com>
2023-10-11 20:57:01 +02:00
Marc Cornellà
408330e131
ci: remove redundant macos runner for CI tests
Currently the macOS runner is not needed, as we are only checking
zsh syntax. We can reactivate it in the future if needed.
2023-10-11 20:44:46 +02:00
Marc Cornellà
53cb50acb5
refactor(systemadmin): use ss instead of netstat when available (#11957) 2023-10-11 20:43:55 +02:00
Marc Cornellà
fedef5dbd5
fix(xcode): open Xcode in current Desk if already open in another (#10384)
Fixes #10384
2023-10-11 19:23:44 +02:00
Lukas Elmer
da3b8fcb6a
fix(yarn): output completion entries in UTF-8 (#11955) 2023-10-11 18:06:22 +02:00
5 changed files with 111 additions and 89 deletions

View File

@ -20,16 +20,12 @@ permissions:
jobs: jobs:
tests: tests:
name: Run tests name: Run tests
runs-on: ${{ matrix.os }} runs-on: ubuntu-latest
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps: steps:
- name: Set up git repository - name: Set up git repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install zsh - name: Install zsh
if: runner.os == 'Linux'
run: sudo apt-get update; sudo apt-get install zsh run: sudo apt-get update; sudo apt-get install zsh
- name: Check syntax - name: Check syntax
run: | run: |

View File

@ -23,32 +23,33 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi
<summary>Table of Contents</summary> <summary>Table of Contents</summary>
- [Getting Started](#getting-started) - [Getting Started](#getting-started)
- [Operating System Compatibility](#operating-system-compatibility)
- [Prerequisites](#prerequisites) - [Prerequisites](#prerequisites)
- [Basic Installation](#basic-installation) - [Basic Installation](#basic-installation)
- [Manual inspection](#manual-inspection) - [Manual Inspection](#manual-inspection)
- [Using Oh My Zsh](#using-oh-my-zsh) - [Using Oh My Zsh](#using-oh-my-zsh)
- [Plugins](#plugins) - [Plugins](#plugins)
- [Enabling Plugins](#enabling-plugins) - [Enabling Plugins](#enabling-plugins)
- [Using Plugins](#using-plugins) - [Using Plugins](#using-plugins)
- [Themes](#themes) - [Themes](#themes)
- [Selecting a Theme](#selecting-a-theme) - [Selecting A Theme](#selecting-a-theme)
- [FAQ](#faq) - [FAQ](#faq)
- [Advanced Topics](#advanced-topics) - [Advanced Topics](#advanced-topics)
- [Advanced Installation](#advanced-installation) - [Advanced Installation](#advanced-installation)
- [Custom Directory](#custom-directory) - [Custom Directory](#custom-directory)
- [Unattended install](#unattended-install) - [Unattended Install](#unattended-install)
- [Installing from a forked repository](#installing-from-a-forked-repository) - [Installing From A Forked Repository](#installing-from-a-forked-repository)
- [Manual Installation](#manual-installation) - [Manual Installation](#manual-installation)
- [Installation Problems](#installation-problems) - [Installation Problems](#installation-problems)
- [Custom Plugins and Themes](#custom-plugins-and-themes) - [Custom Plugins And Themes](#custom-plugins-and-themes)
- [Enable GNU ls in macOS and freeBSD systems](#enable-gnu-ls) - [Enable GNU ls In macOS And freeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems)
- [Skip aliases](#skip-aliases) - [Skip Aliases](#skip-aliases)
- [Getting Updates](#getting-updates) - [Getting Updates](#getting-updates)
- [Updates verbosity](#updates-verbosity) - [Updates Verbosity](#updates-verbosity)
- [Manual Updates](#manual-updates) - [Manual Updates](#manual-updates)
- [Uninstalling Oh My Zsh](#uninstalling-oh-my-zsh) - [Uninstalling Oh My Zsh](#uninstalling-oh-my-zsh)
- [How do I contribute to Oh My Zsh?](#how-do-i-contribute-to-oh-my-zsh) - [How Do I Contribute To Oh My Zsh?](#how-do-i-contribute-to-oh-my-zsh)
- [Do NOT send us themes](#do-not-send-us-themes) - [Do Not Send Us Themes](#do-not-send-us-themes)
- [Contributors](#contributors) - [Contributors](#contributors)
- [Follow Us](#follow-us) - [Follow Us](#follow-us)
- [Merchandise](#merchandise) - [Merchandise](#merchandise)
@ -61,15 +62,15 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi
### Operating System Compatibility ### Operating System Compatibility
| O/S | Status | | O/S | Status |
| :---------------- | :------: | | :------------- | :-----: |
| Android | ✅ | | Android | |
| FreeBSD | ✅ | | freeBSD | ✅ |
| LCARS | 🛸 | | LCARS | 🛸 |
| Linux | ✅ | | Linux | |
| MacOS | ✅ | | macOS | ✅ |
| OS/2 Warp | ❌ | | OS/2 Warp | |
| Windows (WSL2) | ✅ | | Windows (WSL2) | |
### Prerequisites ### Prerequisites
@ -90,7 +91,7 @@ Oh My Zsh is installed by running one of the following commands in your terminal
_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
It's a good idea to inspect the install script from projects you don't yet know. You can do It's a good idea to inspect the install script from projects you don't yet know. You can do
that by downloading the install script first, looking through it so everything looks normal, that by downloading the install script first, looking through it so everything looks normal,
@ -139,7 +140,7 @@ Each built-in plugin includes a **README**, documenting it. This README should s
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred and fifty themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki (We are working on updating this!). Check them out! We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred and fifty themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki (We are working on updating this!). Check them out!
#### Selecting a Theme #### Selecting A Theme
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._ _Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._
@ -210,7 +211,7 @@ like this:
ZSH="$HOME/.dotfiles/oh-my-zsh" sh install.sh ZSH="$HOME/.dotfiles/oh-my-zsh" sh install.sh
``` ```
#### Unattended install #### Unattended Install
If you're running the Oh My Zsh install script as part of an automated install, you can pass the `--unattended` If you're running the Oh My Zsh install script as part of an automated install, you can pass the `--unattended`
flag to the `install.sh` script. This will have the effect of not trying to change flag to the `install.sh` script. This will have the effect of not trying to change
@ -220,7 +221,7 @@ 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
``` ```
#### 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:
@ -245,19 +246,19 @@ REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh
#### Manual Installation #### Manual Installation
##### 1. Clone the repository <!-- omit in toc --> ##### 1. Clone The Repository <!-- omit in toc -->
```sh ```sh
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
``` ```
##### 2. _Optionally_, backup your existing `~/.zshrc` file <!-- omit in toc --> ##### 2. _Optionally_, Backup Your Existing `~/.zshrc` File <!-- omit in toc -->
```sh ```sh
cp ~/.zshrc ~/.zshrc.orig cp ~/.zshrc ~/.zshrc.orig
``` ```
##### 3. Create a new zsh configuration file <!-- omit in toc --> ##### 3. Create A New Zsh Configuration File <!-- omit in toc -->
You can create a new zsh config file by copying the template that we have included for you. You can create a new zsh config file by copying the template that we have included for you.
@ -265,7 +266,7 @@ You can create a new zsh config file by copying the template that we have includ
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
``` ```
##### 4. Change your default shell <!-- omit in toc --> ##### 4. Change Your Default Shell <!-- omit in toc -->
```sh ```sh
chsh -s $(which zsh) chsh -s $(which zsh)
@ -273,7 +274,7 @@ chsh -s $(which zsh)
You must log out from your user session and log back in to see this change. You must log out from your user session and log back in to see this change.
##### 5. Initialize your new zsh configuration <!-- omit in toc --> ##### 5. Initialize Your New Zsh Configuration <!-- omit in toc -->
Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration. Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration.
@ -284,7 +285,7 @@ If you have any hiccups installing, here are a few common fixes.
- You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after switching to `oh-my-zsh`. - You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after switching to `oh-my-zsh`.
- If you installed manually or changed the install location, check the `ZSH` environment variable in `~/.zshrc`. - If you installed manually or changed the install location, check the `ZSH` environment variable in `~/.zshrc`.
### Custom Plugins and Themes ### Custom Plugins And Themes
If you want to override any of the default behaviors, just add a new file (ending in `.zsh`) in the `custom/` directory. If you want to override any of the default behaviors, just add a new file (ending in `.zsh`) in the `custom/` directory.
@ -292,7 +293,7 @@ If you have many functions that go well together, you can put them as a `XYZ.plu
If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`. If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`.
### Enable GNU ls in macOS and freeBSD systems ### Enable GNU ls In macOS And freeBSD Systems
<a name="enable-gnu-ls"></a> <a name="enable-gnu-ls"></a>
@ -306,7 +307,7 @@ zstyle ':omz:lib:theme-and-appearance' gnu-ls yes
_Note: this is not compatible with `DISABLE_LS_COLORS=true`_ _Note: this is not compatible with `DISABLE_LS_COLORS=true`_
### Skip aliases ### Skip Aliases
<a name="remove-directories-aliases"></a> <a name="remove-directories-aliases"></a>
@ -389,7 +390,7 @@ zstyle ':omz:update' frequency 7
zstyle ':omz:update' frequency 0 zstyle ':omz:update' frequency 0
``` ```
### Updates verbosity ### Updates Verbosity
You can also limit the update verbosity with the following settings: You can also limit the update verbosity with the following settings:
@ -417,7 +418,7 @@ Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy b
If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration. If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration.
## How do I contribute to Oh My Zsh? ## How Do I Contribute To Oh My Zsh?
Before you participate in our delightful community, please read the [code of conduct](CODE_OF_CONDUCT.md). Before you participate in our delightful community, please read the [code of conduct](CODE_OF_CONDUCT.md).
@ -427,7 +428,7 @@ We also need people to test out pull requests. So take a look through [the open
See [Contributing](CONTRIBUTING.md) for more details. See [Contributing](CONTRIBUTING.md) for more details.
### Do NOT send us themes ### Do Not Send Us Themes
We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page. We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page.

View File

@ -13,11 +13,11 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
function retlog() { function retlog() {
if [[ -z $1 ]];then if [[ -z $1 ]];then
echo '/var/log/nginx/access.log' echo '/var/log/nginx/access.log'
else else
echo $1 echo $1
fi fi
} }
alias ping='ping -c 5' alias ping='ping -c 5'
@ -28,142 +28,160 @@ alias mkdir='mkdir -pv'
alias psmem='ps -e -orss=,args= | sort -b -k1 -nr' alias psmem='ps -e -orss=,args= | sort -b -k1 -nr'
alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -n 10' alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -n 10'
# get top process eating cpu if not work try execute : export LC_ALL='C' # get top process eating cpu if not work try execute : export LC_ALL='C'
alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr' alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args | sort -k1,1n -nr'
alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -n 10' alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args | sort -k1,1n -nr | head -n 10'
# top10 of the history # top10 of the history
alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10' alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
function ip() { function ip() {
if [ -t 1 ]; then if [ -t 1 ]; then
command ip -color "$@" command ip -color "$@"
else else
command ip "$@" command ip "$@"
fi fi
} }
# directory LS # directory LS
function dls() { function dls() {
print -l *(/) print -l *(/)
} }
function psgrep() { function psgrep() {
ps aux | grep "${1:-.}" | grep -v grep ps aux | grep "${1:-.}" | grep -v grep
} }
# Kills any process that matches a regexp passed to it # Kills any process that matches a regexp passed to it
function killit() { function killit() {
ps aux | grep -v "grep" | grep "$@" | awk '{print $2}' | xargs sudo kill ps aux | grep -v "grep" | grep "$@" | awk '{print $2}' | xargs sudo kill
} }
# list contents of directories in a tree-like format # list contents of directories in a tree-like format
if ! (( $+commands[tree] )); then if ! (( $+commands[tree] )); then
function tree() { function tree() {
find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
} }
fi fi
# Sort connection state # Sort connection state
function sortcons() { function sortcons() {
netstat -nat |awk '{print $6}'|sort|uniq -c|sort -rn {
LANG= ss -nat | awk 'NR > 1 {print $1}' \
|| LANG= netstat -nat | awk 'NR > 2 {print $6}'
} | sort | uniq -c | sort -rn
} }
# View all 80 Port Connections # View all 80 Port Connections
function con80() { function con80() {
netstat -nat|grep -i ":80"|wc -l {
LANG= ss -nat || LANG= netstat -nat
} | grep -E ":80[^0-9]" | wc -l
} }
# On the connected IP sorted by the number of connections # On the connected IP sorted by the number of connections
function sortconip() { function sortconip() {
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n {
LANG= ss -ntu | awk 'NR > 1 {print $6}' \
|| LANG= netstat -ntu | awk 'NR > 2 {print $5}'
} | cut -d: -f1 | sort | uniq -c | sort -n
} }
# top20 of Find the number of requests on 80 port # top20 of Find the number of requests on 80 port
function req20() { function req20() {
netstat -anlp|grep 80|grep tcp|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -n20 {
LANG= ss -tn | awk '$4 ~ /:80$/ {print $5}' \
|| LANG= netstat -tn | awk '$4 ~ /:80$/ {print $5}'
} | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n 20
} }
# top20 of Using tcpdump port 80 access to view # top20 of Using tcpdump port 80 access to view
function http20() { function http20() {
sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -n 20 sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr | head -n 20
} }
# top20 of Find time_wait connection # top20 of Find time_wait connection
function timewait20() { function timewait20() {
netstat -n|grep TIME_WAIT|awk '{print $5}'|sort|uniq -c|sort -rn|head -n20 {
LANG= ss -nat | awk 'NR > 1 && /TIME-WAIT/ {print $5}' \
|| LANG= netstat -nat | awk 'NR > 2 && /TIME_WAIT/ {print $5}'
} | sort | uniq -c | sort -rn | head -n 20
} }
# top20 of Find SYN connection # top20 of Find SYN connection
function syn20() { function syn20() {
netstat -an | grep SYN | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr|head -n20 {
LANG= ss -an | awk '/SYN/ {print $5}' \
|| LANG= netstat -an | awk '/SYN/ {print $5}'
} | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n20
} }
# Printing process according to the port number # Printing process according to the port number
function port_pro() { function port_pro() {
netstat -ntlp | grep "${1:-.}" | awk '{print $7}' | cut -d/ -f1 LANG= ss -ntlp | awk "NR > 1 && /:${1:-}/ {print \$6}" | sed 's/.*pid=\([^,]*\).*/\1/' \
|| LANG= netstat -ntlp | awk "NR > 2 && /:${1:-}/ {print \$7}" | cut -d/ -f1
} }
# top10 of gain access to the ip address # top10 of gain access to the ip address
function accessip10() { function accessip10() {
awk '{counts[$(11)]+=1}; END {for(url in counts) print counts[url], url}' "$(retlog)" awk '{counts[$(11)]+=1}; END {for(url in counts) print counts[url], url}' "$(retlog)"
} }
# top20 of Most Visited file or page # top20 of Most Visited file or page
function visitpage20() { function visitpage20() {
awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -n 20 awk '{print $11}' "$(retlog)" | sort | uniq -c | sort -nr | head -n 20
} }
# top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences # top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences
function consume100() { function consume100() {
awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100 awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" | sort -n | uniq -c | sort -nr | head -n 100
# if django website or other website make by no suffix language # if django website or other website make by no suffix language
# awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100 # awk '{print $7}' "$(retlog)" | sort -n | uniq -c | sort -nr | head -n 100
} }
# Website traffic statistics (G) # Website traffic statistics (G)
function webtraffic() { function webtraffic() {
awk "{sum+=$10} END {print sum/1024/1024/1024}" "$(retlog)" awk "{sum+=$10} END {print sum/1024/1024/1024}" "$(retlog)"
} }
# Statistical connections 404 # Statistical connections 404
function c404() { function c404() {
awk '($9 ~/404/)' "$(retlog)" | awk '{print $9,$7}' | sort awk '($9 ~ /404/)' "$(retlog)" | awk '{print $9,$7}' | sort
} }
# Statistical http status. # Statistical http status.
function httpstatus() { function httpstatus() {
awk '{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}' "$(retlog)" awk '{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}' "$(retlog)"
} }
# Delete 0 byte file # Delete 0 byte file
function d0() { function d0() {
find "${1:-.}" -type f -size 0 -exec rm -rf {} \; find "${1:-.}" -type f -size 0 -exec rm -rf {} \;
} }
# gather external ip address # gather external ip address
function geteip() { function geteip() {
curl -s -S -4 https://icanhazip.com curl -s -S -4 https://icanhazip.com
# handle case when there is no IPv6 external IP, which shows error # handle case when there is no IPv6 external IP, which shows error
# curl: (7) Couldn't connect to server # curl: (7) Couldn't connect to server
curl -s -S -6 https://icanhazip.com 2>/dev/null curl -s -S -6 https://icanhazip.com 2>/dev/null
local ret=$? local ret=$?
(( ret == 7 )) && print -P -u2 "%F{red}error: no IPv6 route to host%f" (( ret == 7 )) && print -P -u2 "%F{red}error: no IPv6 route to host%f"
return $ret return $ret
} }
# determine local IP address(es) # determine local IP address(es)
function getip() { function getip() {
if (( ${+commands[ip]} )); then if (( ${+commands[ip]} )); then
ip addr | awk '/inet /{print $2}' | command grep -v 127.0.0.1 ip addr | awk '/inet /{print $2}' | command grep -v 127.0.0.1
else else
ifconfig | awk '/inet /{print $2}' | command grep -v 127.0.0.1 ifconfig | awk '/inet /{print $2}' | command grep -v 127.0.0.1
fi fi
} }
# Clear zombie processes # Clear zombie processes
function clrz() { function clrz() {
ps -eal | awk '{ if ($2 == "Z") {print $4}}' | kill -9 ps -eal | awk '{ if ($2 == "Z") {print $4}}' | kill -9
} }
# Second concurrent # Second concurrent
function conssec() { function conssec() {
awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog)"|sort -k 2 -nr|head -n10 awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog)" | sort -k 2 -nr | head -n10
} }

View File

@ -17,6 +17,13 @@ function xc {
local active_path local active_path
active_path=${"$(xcode-select -p)"%%/Contents/Developer*} active_path=${"$(xcode-select -p)"%%/Contents/Developer*}
echo "Found ${xcode_files[1]}. Opening with ${active_path}" echo "Found ${xcode_files[1]}. Opening with ${active_path}"
# If Xcode is already opened in another Desk, we need this double call
# with -g to open the project window in the current Desk and focus it.
# See https://github.com/ohmyzsh/ohmyzsh/issues/10384
if command pgrep -q "^Xcode"; then
open -g -a "$active_path" "${xcode_files[1]}"
fi
open -a "$active_path" "${xcode_files[1]}" open -a "$active_path" "${xcode_files[1]}"
} }

View File

@ -144,7 +144,7 @@ _yarn_scripts() {
fi fi
if [[ -n $packageJson ]]; then if [[ -n $packageJson ]]; then
scripts=("${(@f)$(cat ${packageJson} | perl -0777 -MJSON::PP -n -E '%r=%{decode_json($_)->{scripts}}; do{$k=$_;($e=$k)=~s/:/\\:/g; printf "$e:$r{$k}\n"} for sort keys %r')}") scripts=("${(@f)$(cat ${packageJson} | perl -0777 -MJSON::PP -n -E 'binmode(STDOUT, ":encoding(UTF-8)"); %r=%{decode_json($_)->{scripts}}; do{$k=$_;($e=$k)=~s/:/\\:/g; printf "$e:$r{$k}\n"} for sort keys %r')}")
fi fi
commands=('env' $scripts $binaries) commands=('env' $scripts $binaries)