summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--README.md2
-rw-r--r--SECURITY.md22
-rw-r--r--lib/cli.zsh4
-rw-r--r--lib/directories.zsh2
-rw-r--r--plugins/command-not-found/command-not-found.plugin.zsh2
-rw-r--r--plugins/dirhistory/README.md42
-rw-r--r--plugins/dirhistory/dirhistory.plugin.zsh98
-rw-r--r--plugins/fzf/fzf.plugin.zsh4
-rw-r--r--plugins/macos/README.md (renamed from plugins/osx/README.md)8
-rw-r--r--plugins/macos/_security (renamed from plugins/osx/_security)0
-rw-r--r--plugins/macos/macos.plugin.zsh (renamed from plugins/osx/osx.plugin.zsh)14
-rw-r--r--plugins/macos/music (renamed from plugins/osx/music)0
l---------plugins/macos/osx.plugin.zsh1
-rw-r--r--plugins/macos/spotify (renamed from plugins/osx/spotify)0
-rw-r--r--plugins/mix/README.md16
-rw-r--r--plugins/mix/_mix43
l---------plugins/osx1
-rw-r--r--plugins/xcode/README.md2
-rw-r--r--plugins/xcode/xcode.plugin.zsh28
-rw-r--r--themes/ys.zsh-theme10
-rwxr-xr-xtools/changelog.sh111
-rw-r--r--tools/check_for_upgrade.sh25
23 files changed, 275 insertions, 162 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4903584ee..605142845 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -202,7 +202,7 @@ type(scope)!: subject
feat(archlinux): add support for aura AUR helper (#9467)
```
- - Formatted inline code by using backticks: the text inbetween backticks will also be highlighted by
+ - Formatted inline code by using backticks: the text between backticks will also be highlighted by
the changelog tool:
```
feat(shell-proxy): enable unexported `DEFAULT_PROXY` setting (#9774)
diff --git a/README.md b/README.md
index 907248beb..5712c1701 100644
--- a/README.md
+++ b/README.md
@@ -68,7 +68,7 @@ plugins=(
git
bundler
dotenv
- osx
+ macos
rake
rbenv
ruby
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 000000000..cda53379f
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,22 @@
+# Security Policy
+
+## Supported Versions
+
+At the moment Oh My Zsh only considers the very latest commit to be supported.
+We combine that with our fast response to incidents, so risk is minimized.
+
+| Version | Supported |
+|:-------------- |:------------------ |
+| master | :white_check_mark: |
+| other commits | :x: |
+
+In the near future we will introduce versioning, so expect this section to change.
+
+## Reporting a Vulnerability
+
+If you find a vulnerability, email all the maintainers directly at:
+
+- Robby: robby [at] planetargon.com
+- Marc: hello [at] mcornella.com
+
+**Do not open an issue or Pull Request directly**, because it might reveal the vulnerability.
diff --git a/lib/cli.zsh b/lib/cli.zsh
index 4b14360c1..0b6bbc6cb 100644
--- a/lib/cli.zsh
+++ b/lib/cli.zsh
@@ -755,9 +755,9 @@ function _omz::update {
# Run update script
if [[ "$1" != --unattended ]]; then
- ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
+ ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive || return $?
else
- ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
+ ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" || return $?
fi
# Update last updated file
diff --git a/lib/directories.zsh b/lib/directories.zsh
index cf87bd7e4..6696854b0 100644
--- a/lib/directories.zsh
+++ b/lib/directories.zsh
@@ -9,7 +9,7 @@ alias -g .....='../../../..'
alias -g ......='../../../../..'
alias -- -='cd -'
-alias 1='cd -'
+alias 1='cd -1'
alias 2='cd -2'
alias 3='cd -3'
alias 4='cd -4'
diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
index 3ec13429c..cb96fe063 100644
--- a/plugins/command-not-found/command-not-found.plugin.zsh
+++ b/plugins/command-not-found/command-not-found.plugin.zsh
@@ -50,7 +50,7 @@ fi
# NixOS: https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found
if [[ -x /run/current-system/sw/bin/command-not-found ]]; then
command_not_found_handler() {
- /run/current-system/sw/bin/command-not-found -- "$@"
+ /run/current-system/sw/bin/command-not-found "$@"
}
fi
diff --git a/plugins/dirhistory/README.md b/plugins/dirhistory/README.md
index 602fc8284..ede9b5410 100644
--- a/plugins/dirhistory/README.md
+++ b/plugins/dirhistory/README.md
@@ -12,19 +12,27 @@ plugins=(... dirhistory)
| Shortcut | Description |
|-----------------------------------|-----------------------------------------------------------|
-| <kbd>alt</kbd> + <kbd>left</kbd> | Go to previous directory |
-| <kbd>alt</kbd> + <kbd>right</kbd> | Undo <kbd>alt</kbd> + <kbd>left</kbd> |
-| <kbd>alt</kbd> + <kbd>up</kbd> | Move into the parent directory |
-| <kbd>alt</kbd> + <kbd>down</kbd> | Move into the first child directory by alphabetical order |
+| <kbd>Alt</kbd> + <kbd>Left</kbd> | Go to previous directory |
+| <kbd>Alt</kbd> + <kbd>Right</kbd> | Go to next directory |
+| <kbd>Alt</kbd> + <kbd>Up</kbd> | Move into the parent directory |
+| <kbd>Alt</kbd> + <kbd>Down</kbd> | Move into the first child directory by alphabetical order |
-NOTE: some terminals might override the ALT+Arrows key bindings (Windows Terminal, for example).
-If these don't work check your terminal settings and change them to a different keyboard shortcut.
+**For macOS: use the Option key (<kbd>⌥</kbd>) instead of <kbd>Alt</kbd>**.
+
+> NOTE: some terminals might override the <kbd>Alt</kbd> + Arrows key bindings (e.g. Windows Terminal).
+> If these don't work check your terminal settings and change them to a different keyboard shortcut.
## Usage
-This plugin allows you to navigate the history of previous current-working-directories using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. MAC users may alternately use OPT-LEFT and OPT-RIGHT.
+This plugin allows you to navigate the history of previous working directories using <kbd>Alt</kbd> + <kbd>Left</kbd>
+and <kbd>Alt</kbd> + <kbd>Right</kbd>. <kbd>Alt</kbd> + <kbd>Left</kbd> moves to past directories, and
+<kbd>Alt</kbd> + <kbd>Right</kbd> goes back to recent directories.
+
+**NOTE: the maximum directory history size is 30.**
-Also, navigate directory **hierarchy** using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented). ALT-UP moves to higher hierarchy (shortcut for 'cd ..'). ALT-DOWN moves into the first directory found in alphabetical order (useful to navigate long empty directories e.g. java packages)
+You can also navigate **directory hierarchies** using <kbd>Alt</kbd> + <kbd>Up</kbd> and <kbd>Alt</kbd> + <kbd>Down</kbd>.
+<kbd>Alt</kbd> + <kbd>Up</kbd> moves to the parent directory, while <kbd>Alt</kbd> + <kbd>Down</kbd> moves into the first
+child directory found in alphabetical order (useful to navigate long empty directories, e.g. Java packages).
For example, if the shell was started, and the following commands were entered:
@@ -35,8 +43,20 @@ cd share
cd doc
```
-Then entering ALT-LEFT at the prompt would change directory from /usr/share/doc to /usr/share, then if pressed again to /usr/, then ~. If ALT-RIGHT were pressed the directory would be changed to /usr/ again.
+the directory stack (`dirs -v`) would look like this:
+
+```console
+$ dirs -v
+0 /usr/share/doc
+1 /usr/share
+2 /usr
+3 ~
+```
-After that, ALT-DOWN will probably go to /usr/bin (depends on your /usr structure), ALT-UP will return to /usr, then ALT-UP will get you to /
+then entering <kbd>Alt</kbd> + <kbd>Left</kbd> at the prompt would change directory from `/usr/share/doc` to `/usr/share`,
+then if pressed again to `/usr`, then `~`. If <kbd>Alt</kbd> + <kbd>Right</kbd> were pressed the directory would be changed
+to `/usr` again.
-**Currently the max history size is 30**. The navigation should work for xterm, PuTTY xterm mode, GNU screen, and on MAC with alternate keys as mentioned above.
+After that, <kbd>Alt</kbd> + <kbd>Down</kbd> will probably go to `/usr/bin` if `bin` is the first directory in alphabetical
+order (depends on your `/usr` folder structure). <kbd>Alt</kbd> + <kbd>Up</kbd> will return to `/usr`, and once more will get
+you to the root folder (`/`).
diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh
index cbac84600..26ef07494 100644
--- a/plugins/dirhistory/dirhistory.plugin.zsh
+++ b/plugins/dirhistory/dirhistory.plugin.zsh
@@ -1,7 +1,7 @@
-##
-# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories
+##
+# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
-#
+#
# Navigate directory hierarchy using ALT-UP and ALT-DOWN.
# ALT-UP moves to higher hierarchy (cd ..)
# ALT-DOWN moves into the first directory found in alphabetical order
@@ -14,8 +14,8 @@ export dirhistory_future
export DIRHISTORY_SIZE=30
-# Pop the last element of dirhistory_past.
-# Pass the name of the variable to return the result in.
+# Pop the last element of dirhistory_past.
+# Pass the name of the variable to return the result in.
# Returns the element if the array was not empty,
# otherwise returns empty string.
function pop_past() {
@@ -32,7 +32,7 @@ function pop_future() {
fi
}
-# Push a new element onto the end of dirhistory_past. If the size of the array
+# Push a new element onto the end of dirhistory_past. If the size of the array
# is >= DIRHISTORY_SIZE, the array is shifted
function push_past() {
if [[ $#dirhistory_past -ge $DIRHISTORY_SIZE ]]; then
@@ -76,7 +76,7 @@ function dirhistory_back() {
local d=""
# Last element in dirhistory_past is the cwd.
- pop_past cw
+ pop_past cw
if [[ "" == "$cw" ]]; then
# Someone overwrote our variable. Recover it.
dirhistory_past=($PWD)
@@ -121,40 +121,35 @@ function dirhistory_zle_dirhistory_future() {
}
zle -N dirhistory_zle_dirhistory_back
-# xterm in normal mode
-bindkey "\e[3D" dirhistory_zle_dirhistory_back
-bindkey "\e[1;3D" dirhistory_zle_dirhistory_back
-# Terminal.app
-if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
- bindkey "^[b" dirhistory_zle_dirhistory_back
-fi
-# iTerm2
-if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
- bindkey "^[^[[D" dirhistory_zle_dirhistory_back
+bindkey "\e[3D" dirhistory_zle_dirhistory_back # xterm in normal mode
+bindkey "\e[1;3D" dirhistory_zle_dirhistory_back # xterm in normal mode
+bindkey "\e\e[D" dirhistory_zle_dirhistory_back # Putty
+bindkey "\eO3D" dirhistory_zle_dirhistory_back # GNU screen
+case "$TERM_PROGRAM" in
+iTerm.app) bindkey "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2
+Apple_Terminal) bindkey "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
+esac
+if (( ${+terminfo[kcub1]} )); then
+ bindkey "^[${terminfo[kcub1]}" dirhistory_zle_dirhistory_back # urxvt
fi
-# Putty:
-bindkey "\e\e[D" dirhistory_zle_dirhistory_back
-# GNU screen:
-bindkey "\eO3D" dirhistory_zle_dirhistory_back
zle -N dirhistory_zle_dirhistory_future
-bindkey "\e[3C" dirhistory_zle_dirhistory_future
-bindkey "\e[1;3C" dirhistory_zle_dirhistory_future
-# Terminal.app
-if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
- bindkey "^[f" dirhistory_zle_dirhistory_future
-fi
-# iTerm2
-if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
- bindkey "^[^[[C" dirhistory_zle_dirhistory_future
+bindkey "\e[3C" dirhistory_zle_dirhistory_future # xterm in normal mode
+bindkey "\e[1;3C" dirhistory_zle_dirhistory_future # xterm in normal mode
+bindkey "\e\e[C" dirhistory_zle_dirhistory_future # Putty
+bindkey "\eO3C" dirhistory_zle_dirhistory_future # GNU screen
+case "$TERM_PROGRAM" in
+iTerm.app) bindkey "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2
+Apple_Terminal) bindkey "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
+esac
+if (( ${+terminfo[kcuf1]} )); then
+ bindkey "^[${terminfo[kcuf1]}" dirhistory_zle_dirhistory_future # urxvt
fi
-bindkey "\e\e[C" dirhistory_zle_dirhistory_future
-bindkey "\eO3C" dirhistory_zle_dirhistory_future
-#
+#
# HIERARCHY Implemented in this section, in case someone wants to split it to another plugin if it clashes bindings
-#
+#
# Move up in hierarchy
function dirhistory_up() {
@@ -181,22 +176,27 @@ function dirhistory_zle_dirhistory_down() {
}
zle -N dirhistory_zle_dirhistory_up
-# xterm in normal mode
-bindkey "\e[3A" dirhistory_zle_dirhistory_up
-bindkey "\e[1;3A" dirhistory_zle_dirhistory_up
-if [[ "$TERM_PROGRAM" == "Apple_Terminal" || "$TERM_PROGRAM" == "iTerm.app" ]]; then
- bindkey "^[[A" dirhistory_zle_dirhistory_up
+bindkey "\e[3A" dirhistory_zle_dirhistory_up # xterm in normal mode
+bindkey "\e[1;3A" dirhistory_zle_dirhistory_up # xterm in normal mode
+bindkey "\e\e[A" dirhistory_zle_dirhistory_up # Putty
+bindkey "\eO3A" dirhistory_zle_dirhistory_up # GNU screen
+case "$TERM_PROGRAM" in
+iTerm.app) bindkey "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2
+Apple_Terminal) bindkey "^[OA" dirhistory_zle_dirhistory_up ;; # Terminal.app
+esac
+if (( ${+terminfo[kcuu1]} )); then
+ bindkey "^[${terminfo[kcuu1]}" dirhistory_zle_dirhistory_up # urxvt
fi
-# Putty:
-bindkey "\e\e[A" dirhistory_zle_dirhistory_up
-# GNU screen:
-bindkey "\eO3A" dirhistory_zle_dirhistory_up
zle -N dirhistory_zle_dirhistory_down
-bindkey "\e[3B" dirhistory_zle_dirhistory_down
-bindkey "\e[1;3B" dirhistory_zle_dirhistory_down
-if [[ "$TERM_PROGRAM" == "Apple_Terminal" || "$TERM_PROGRAM" == "iTerm.app" ]]; then
- bindkey "^[[B" dirhistory_zle_dirhistory_down
+bindkey "\e[3B" dirhistory_zle_dirhistory_down # xterm in normal mode
+bindkey "\e[1;3B" dirhistory_zle_dirhistory_down # xterm in normal mode
+bindkey "\e\e[B" dirhistory_zle_dirhistory_down # Putty
+bindkey "\eO3B" dirhistory_zle_dirhistory_down # GNU screen
+case "$TERM_PROGRAM" in
+iTerm.app) bindkey "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2
+Apple_Terminal) bindkey "^[OB" dirhistory_zle_dirhistory_down ;; # Terminal.app
+esac
+if (( ${+terminfo[kcud1]} )); then
+ bindkey "^[${terminfo[kcud1]}" dirhistory_zle_dirhistory_down # urxvt
fi
-bindkey "\e\e[B" dirhistory_zle_dirhistory_down
-bindkey "\eO3B" dirhistory_zle_dirhistory_down
diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh
index a979fe222..aabd62cb1 100644
--- a/plugins/fzf/fzf.plugin.zsh
+++ b/plugins/fzf/fzf.plugin.zsh
@@ -20,7 +20,9 @@ function setup_using_base_dir() {
done
if [[ -z "${fzf_base}" ]]; then
- if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
+ if (( ${+commands[fzf-share]} )) && dir="$(fzf-share)" && [[ -d "${dir}" ]]; then
+ fzf_base="${dir}"
+ elif (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
fi
diff --git a/plugins/osx/README.md b/plugins/macos/README.md
index 50458f60e..1bc4244a4 100644
--- a/plugins/osx/README.md
+++ b/plugins/macos/README.md
@@ -1,11 +1,11 @@
-# OSX plugin
+# MacOS plugin
This plugin provides a few utilities to make it more enjoyable on macOS (previously named OSX).
-To start using it, add the `osx` plugin to your plugins array in `~/.zshrc`:
+To start using it, add the `macos` plugin to your plugins array in `~/.zshrc`:
```zsh
-plugins=(... osx)
+plugins=(... macos)
```
Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
@@ -31,7 +31,7 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
| `itunes` | _DEPRECATED_. Use `music` from macOS Catalina on |
| `music` | Control Apple Music. Use `music -h` for usage details |
| `spotify` | Control Spotify and search by artist, album, track… |
-| `rmdsstore` | Remove .DS\_Store files recursively in a directory |
+| `rmdsstore` | Remove .DS_Store files recursively in a directory |
| `btrestart` | Restart the Bluetooth daemon |
| `freespace` | Erases purgeable disk space with 0s on the selected disk |
diff --git a/plugins/osx/_security b/plugins/macos/_security
index e4ed585ac..e4ed585ac 100644
--- a/plugins/osx/_security
+++ b/plugins/macos/_security
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/macos/macos.plugin.zsh
index 16f16ddb6..4bcbbaead 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/macos/macos.plugin.zsh
@@ -1,3 +1,9 @@
+# Check if 'osx' is still in the plugins list and prompt to change to 'macos'
+if [[ -n "${plugins[(r)osx]}" ]]; then
+ print ${(%):-"%F{yellow}The \`osx\` plugin is deprecated and has been renamed to \`macos\`."}
+ print ${(%):-"Please update your .zshrc to use the \`%Bmacos%b\` plugin instead.%f"}
+fi
+
# Open the current directory in a Finder window
alias ofd='open_command $PWD'
@@ -11,7 +17,7 @@ function btrestart() {
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
}
-function _omz_osx_get_frontmost_app() {
+function _omz_macos_get_frontmost_app() {
osascript 2>/dev/null <<EOF
tell application "System Events"
name of first item of (every process whose frontmost is true)
@@ -24,7 +30,7 @@ function tab() {
local command="cd \\\"$PWD\\\"; clear"
(( $# > 0 )) && command="${command}; $*"
- local the_app=$(_omz_osx_get_frontmost_app)
+ local the_app=$(_omz_macos_get_frontmost_app)
if [[ "$the_app" == 'Terminal' ]]; then
# Discarding stdout to quash "tab N of window id XXX" output
@@ -77,7 +83,7 @@ function vsplit_tab() {
local command="cd \\\"$PWD\\\"; clear"
(( $# > 0 )) && command="${command}; $*"
- local the_app=$(_omz_osx_get_frontmost_app)
+ local the_app=$(_omz_macos_get_frontmost_app)
if [[ "$the_app" == 'iTerm' ]]; then
osascript <<EOF
@@ -125,7 +131,7 @@ function split_tab() {
local command="cd \\\"$PWD\\\"; clear"
(( $# > 0 )) && command="${command}; $*"
- local the_app=$(_omz_osx_get_frontmost_app)
+ local the_app=$(_omz_macos_get_frontmost_app)
if [[ "$the_app" == 'iTerm' ]]; then
osascript 2>/dev/null <<EOF
diff --git a/plugins/osx/music b/plugins/macos/music
index 50566797b..50566797b 100644
--- a/plugins/osx/music
+++ b/plugins/macos/music
diff --git a/plugins/macos/osx.plugin.zsh b/plugins/macos/osx.plugin.zsh
new file mode 120000
index 000000000..73d718d43
--- /dev/null
+++ b/plugins/macos/osx.plugin.zsh
@@ -0,0 +1 @@
+macos.plugin.zsh \ No newline at end of file
diff --git a/plugins/osx/spotify b/plugins/macos/spotify
index 663215a74..663215a74 100644
--- a/plugins/osx/spotify
+++ b/plugins/macos/spotify
diff --git a/plugins/mix/README.md b/plugins/mix/README.md
index 878f370f2..f0258fe88 100644
--- a/plugins/mix/README.md
+++ b/plugins/mix/README.md
@@ -9,11 +9,11 @@ plugins=(... mix)
```
## Supported Task Types
-| Task Type | Documentation |
-|-------------------------|----------------------------------------------------------|
-| Elixir | [Elixir Lang](https://elixir-lang.org/) |
-| Phoenix v1.2.1 and below| [Phoenix](https://hexdocs.pm/phoenix/1.2.1/Phoenix.html) |
-| Phoenix v1.3.0 and above| [Phoenix](https://hexdocs.pm/phoenix/Phoenix.html) |
-| Ecto | [Ecto](https://hexdocs.pm/ecto/Ecto.html) |
-| Hex | [Hex](https://hex.pm/) |
-| Nerves | [Nerves](https://nerves-project.org/) |
+| Task Type | Documentation |
+|--------------------------|----------------------------------------------------------|
+| Elixir | [Elixir Lang](https://elixir-lang.org/) |
+| Phoenix v1.2.1 and below | [Phoenix](https://hexdocs.pm/phoenix/1.2.1/Phoenix.html) |
+| Phoenix v1.3.0 and above | [Phoenix](https://hexdocs.pm/phoenix/Phoenix.html) |
+| Ecto | [Ecto](https://hexdocs.pm/ecto/Ecto.html) |
+| Hex | [Hex](https://hex.pm/) |
+| Nerves | [Nerves](https://nerves-project.org/) |
diff --git a/plugins/mix/_mix b/plugins/mix/_mix
index c0fe68c91..7940ff1c9 100644
--- a/plugins/mix/_mix
+++ b/plugins/mix/_mix
@@ -5,8 +5,10 @@
local -a _1st_arguments
_1st_arguments=(
+ 'app.config:Configures all registered apps'
'app.start:Start all registered apps'
- 'archive:List all archives'
+ 'app.tree:Prints the application tree'
+ 'archive:Lists installed archives'
'archive.build:Archive this project into a .ez file'
'archive.install:Install an archive locally'
'archive.uninstall:Uninstall archives'
@@ -18,6 +20,7 @@ _1st_arguments=(
"deps.clean:Remove the given dependencies' files"
'deps.compile:Compile dependencies'
'deps.get:Get all out of date dependencies'
+ 'deps.tree:Prints the dependency tree'
'deps.unlock:Unlock the given dependencies'
'deps.update:Update the given dependencies'
'do:Executes the tasks separated by comma'
@@ -30,27 +33,39 @@ _1st_arguments=(
'ecto.migrate:Runs Ecto migration'
'ecto.migrations:Displays the up / down migration status'
'ecto.rollback:Reverts applied migrations'
+ 'escript:Lists installed escripts'
'escript.build:Builds an escript for the project'
+ 'escript.install:Installs an escript locally'
+ 'escript.uninstall:Uninstalls escripts'
'firmware:Nerves - Build a firmware image for the selected target platform'
'firmware.burn:Nerves - Writes the generated firmware image to an attached SDCard or file'
'firmware.image:Nerves - Create a firmware image file that can be copied byte-for-byte'
'format:Formats the given files and patterns'
'help:Print help information for tasks'
'hex:Print hex help information'
- 'hex.config:Read or update hex config'
- 'hex.docs:Publish docs for package'
+ 'hex.audit:Shows retired Hex deps for the current project'
+ 'hex.build:Builds a new package version locally'
+ 'hex.config:Reads, updates or deletes local Hex config'
+ 'hex.docs:Fetches or opens documentation of a package'
'hex.info:Print hex information'
+ 'hex.organization:Manages Hex.pm organizations'
'hex.key:Hex API key tasks'
- 'hex.outdated:Shows outdated hex deps for the current project'
- 'hex.owner:Hex package ownership tasks'
+ 'hex.outdated:Shows outdated Hex deps for the current project'
+ 'hex.owner:Manages Hex package ownership'
+ 'hex.package:Fetches or diffs packages'
'hex.publish:Publish a new package version'
+ 'hex.registry:Manages local Hex registries'
+ 'hex.repo:Manages Hex repositories'
+ 'hex.retire:Retires a package version'
'hex.search:Search for package names'
- 'hex.user:Hex user tasks'
+ 'hex.sponsor:Show Hex packages accepting sponsorships'
+ 'hex.user:Manages your Hex user account'
'loadconfig:Loads and persists the given configuration'
'local:List local tasks'
'local.hex:Install hex locally'
'local.phoenix:Updates Phoenix locally'
'local.phx:Updates the Phoenix project generator locally'
+ 'local.public_keys:Manages public keys'
'local.rebar:Install rebar locally'
'nerves.artifact:Create an artifact for a specified Nerves package'
'nerves.artifact.get:Nerves get artifacts'
@@ -69,21 +84,33 @@ _1st_arguments=(
'phoenix.server:Starts applications and their servers'
'phx.digest:Digests and compresses static files'
'phx.digest.clean:Removes old versions of static assets.'
+ 'phx.gen.auth:Generates authentication logic for a resource'
+ 'phx.gen.cert:Generates a self-signed certificate for HTTPS testing'
'phx.gen.channel:Generates a Phoenix channel'
'phx.gen.context:Generates a context with functions around an Ecto schema'
'phx.gen.embedded:Generates an embedded Ecto schema file'
'phx.gen.html:Generates controller, views, and context for an HTML resource'
'phx.gen.json:Generates controller, views, and context for a JSON resource'
+ 'phx.gen.live:Generates LiveView, templates, and context for a resource'
+ 'phx.gen.notifier:Generates a notifier that delivers emails by default'
'phx.gen.presence:Generates a Presence tracker'
'phx.gen.schema:Generates an Ecto schema and migration file'
'phx.gen.secret:Generates a secret'
- 'phx.new:Creates a new Phoenix v1.3.0 application'
+ 'phx.gen.socket:Generates a Phoenix socket handler'
+ 'phx.new:Creates a new Phoenix application'
'phx.new.ecto:Creates a new Ecto project within an umbrella project'
'phx.new.web:Creates a new Phoenix web project within an umbrella project'
'phx.routes:Prints all routes'
'phx.server:Starts applications and their servers'
+ 'profile.cprof:Profiles the given file or expression with cprof'
+ 'profile.eprof:Profiles the given file or expression with eprof'
+ 'profile.fprof:Profiles the given file or expression with fprof'
+ 'release:Assembles a self-contained release'
+ 'release.init:Generates sample files for releases'
'run:Run the given file or expression'
"test:Run a project's tests"
+ 'test.coverage:Build report from exported test coverage'
+ 'xref:Prints cross reference information'
'--help:Describe available tasks'
'--version:Prints the Elixir version information'
)
@@ -93,7 +120,7 @@ __task_list ()
local expl
declare -a tasks
- tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build format help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.presence phx.gen.schema phx.gen.secret phx.new phx.new.ecto phx.new.web phx.routes phx.server run test)
+ tasks=(app.config app.start app.tree archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.tree deps.unlock deps.update do ecto.create ecto.drop ecto.dump ecto.gen.migration ecto.gen.repo ecto.load ecto.migrate ecto.migrations ecto.rollback escript escript.build escript.install escript.uninstall firmware firmware.burn firmware.image format help hex hex.audit hex.build hex.config hex.docs hex.info hex.organization hex.key hex.outdated hex.owner hex.package hex.publish hex.registry hex.repo hex.retire hex.search hex.sponsor hex.user loadconfig local local.hex local.phoenix local.phx local.public_keys local.rebar nerves.artifact nerves.artifact.get nerves.info nerves.new nerves.release.init new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.auth phx.gen.cert phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.live phx.gen.notifier phx.gen.presence phx.gen.schema phx.gen.secret phx.gen.socket phx.new phx.new.ecto phx.new.web phx.routes phx.server profile.cprof profile.eprof profile.fprof release release.init run test test.coverage xref)
_wanted tasks expl 'help' compadd $tasks
}
diff --git a/plugins/osx b/plugins/osx
new file mode 120000
index 000000000..a8d0f9c48
--- /dev/null
+++ b/plugins/osx
@@ -0,0 +1 @@
+macos \ No newline at end of file
diff --git a/plugins/xcode/README.md b/plugins/xcode/README.md
index 37f882638..664a063a3 100644
--- a/plugins/xcode/README.md
+++ b/plugins/xcode/README.md
@@ -26,7 +26,7 @@ plugins=(... xcode)
### `xc`
-Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files.
+Opens the current directory in Xcode as an Xcode project or a Swift package. This will open one of the `.xcworkspace`, `.xcodeproj` and `Package.swift` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files.
Returns 1 if it didn't find any relevant files.
### `xx`
diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh
index 89703fe3c..41b9e37e4 100644
--- a/plugins/xcode/xcode.plugin.zsh
+++ b/plugins/xcode/xcode.plugin.zsh
@@ -6,28 +6,18 @@ alias xcsel='sudo xcode-select --switch'
# original author: @subdigital
# source: https://gist.github.com/subdigital/5420709
function xc {
- local xcode_proj
- if [[ $# == 0 ]]; then
- xcode_proj=(*.{xcworkspace,xcodeproj}(N))
- else
- xcode_proj=($1/*.{xcworkspace,xcodeproj}(N))
- fi
-
+ local xcode_files
+ xcode_files=(${1:-.}/{*.{xcworkspace,xcodeproj},Package.swift}(N))
- if [[ ${#xcode_proj} -eq 0 ]]; then
- if [[ $# == 0 ]]; then
- echo "No xcworkspace/xcodeproj file found in the current directory."
- else
- echo "No xcworkspace/xcodeproj file found in $1."
- fi
+ if [[ ${#xcode_files} -eq 0 ]]; then
+ echo "No Xcode files found in ${1:-the current directory}." >&2
return 1
- else
- local active_path
- active_path=$(xcode-select -p)
- active_path=${active_path%%/Contents/Developer*}
- echo "Found ${xcode_proj[1]}. Opening with ${active_path}"
- open -a "$active_path" "${xcode_proj[1]}"
fi
+
+ local active_path
+ active_path=${"$(xcode-select -p)"%%/Contents/Developer*}
+ echo "Found ${xcode_files[1]}. Opening with ${active_path}"
+ open -a "$active_path" "${xcode_files[1]}"
}
# Opens a file or files in the Xcode IDE. Multiple files are opened in multi-file browser
diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme
index 303c898b4..251b48827 100644
--- a/themes/ys.zsh-theme
+++ b/themes/ys.zsh-theme
@@ -5,8 +5,10 @@
#
# Mar 2013 Yad Smood
+typeset +H my_gray="$FG[247]"
+
# VCS
-YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} "
+YS_VCS_PROMPT_PREFIX1=" %{$my_gray%}on%{$reset_color%} "
YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}"
YS_VCS_PROMPT_SUFFIX="%{$reset_color%}"
YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x"
@@ -60,13 +62,13 @@ local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})"
PROMPT="
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
%(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \
-%{$fg[white]%}@ \
+%{$my_gray%}@ \
%{$fg[green]%}%m \
-%{$fg[white]%}in \
+%{$my_gray%}in \
%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
${hg_info}\
${git_info}\
${venv_info}\
\
-%{$fg[white]%}[%*] $exit_code
+%{$my_gray%}[%*] $exit_code
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
diff --git a/tools/changelog.sh b/tools/changelog.sh
index 7329a9526..664f34608 100755
--- a/tools/changelog.sh
+++ b/tools/changelog.sh
@@ -1,5 +1,8 @@
#!/usr/bin/env zsh
+cd "$ZSH"
+setopt extendedglob
+
##############################
# CHANGELOG SCRIPT CONSTANTS #
##############################
@@ -49,10 +52,15 @@ function parse-commit {
# make a breaking change
function commit:type {
- local type="$(sed -E 's/^([a-zA-Z_\-]+)(\(.+\))?!?: .+$/\1/' <<< "$1")"
+ local type
+
+ # Parse commit type from the subject
+ if [[ "$1" =~ '^([a-zA-Z_\-]+)(\(.+\))?!?: .+$' ]]; then
+ type="${match[1]}"
+ fi
# If $type doesn't appear in $TYPES array mark it as 'other'
- if [[ -n "${(k)TYPES[(i)$type]}" ]]; then
+ if [[ -n "$type" && -n "${(k)TYPES[(i)$type]}" ]]; then
echo $type
else
echo other
@@ -63,17 +71,18 @@ function parse-commit {
local scope
# Try to find scope in "type(<scope>):" format
- scope=$(sed -nE 's/^[a-zA-Z_\-]+\((.+)\)!?: .+$/\1/p' <<< "$1")
- if [[ -n "$scope" ]]; then
- echo "$scope"
+ if [[ "$1" =~ '^[a-zA-Z_\-]+\((.+)\)!?: .+$' ]]; then
+ echo "${match[1]}"
return
fi
# If no scope found, try to find it in "<scope>:" format
- # Make sure it's not a type before printing it
- scope=$(sed -nE 's/^([a-zA-Z_\-]+): .+$/\1/p' <<< "$1")
- if [[ -z "${(k)TYPES[(i)$scope]}" ]]; then
- echo "$scope"
+ if [[ "$1" =~ '^([a-zA-Z_\-]+): .+$' ]]; then
+ scope="${match[1]}"
+ # Make sure it's not a type before printing it
+ if [[ -z "${(k)TYPES[(i)$scope]}" ]]; then
+ echo "$scope"
+ fi
fi
}
@@ -81,7 +90,11 @@ function parse-commit {
# Only display the relevant part of the commit, i.e. if it has the format
# type[(scope)!]: subject, where the part between [] is optional, only
# displays subject. If it doesn't match the format, returns the whole string.
- sed -E 's/^[a-zA-Z_\-]+(\(.+\))?!?: (.+)$/\2/' <<< "$1"
+ if [[ "$1" =~ '^[a-zA-Z_\-]+(\(.+\))?!?: (.+)$' ]]; then
+ echo "${match[2]}"
+ else
+ echo "$1"
+ fi
}
# Return subject if the body or subject match the breaking change format
@@ -114,15 +127,8 @@ function parse-commit {
fi
}
- # Ignore commit if it is a merge commit
- if [[ $(command git show -s --format=%p $1 | wc -w) -gt 1 ]]; then
- return
- fi
-
# Parse commit with hash $1
- local hash="$1" subject body warning rhash
- subject="$(command git show -s --format=%s $hash)"
- body="$(command git show -s --format=%b $hash)"
+ local hash="$1" subject="$2" body="$3" warning rhash
# Commits following Conventional Commits (https://www.conventionalcommits.org/)
# have the following format, where parts between [] are optional:
@@ -195,9 +201,9 @@ function display-release {
#* Uses $hash from outer scope
local hash="${1:-$hash}"
case "$output" in
- raw) printf "$hash" ;;
- text) printf "\e[33m$hash\e[0m" ;; # red
- md) printf "[\`$hash\`](https://github.com/ohmyzsh/ohmyzsh/commit/$hash)" ;;
+ raw) printf '%s' "$hash" ;;
+ text) printf '\e[33m%s\e[0m' "$hash" ;; # red
+ md) printf '[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)' "$hash" ;;
esac
}
@@ -209,16 +215,16 @@ function display-release {
case "$output" in
raw)
case "$level" in
- 1) printf "$header\n$(printf '%.0s=' {1..${#header}})\n\n" ;;
- 2) printf "$header\n$(printf '%.0s-' {1..${#header}})\n\n" ;;
- *) printf "$header:\n\n" ;;
+ 1) printf '%s\n%s\n\n' "$header" "$(printf '%.0s=' {1..${#header}})" ;;
+ 2) printf '%s\n%s\n\n' "$header" "$(printf '%.0s-' {1..${#header}})" ;;
+ *) printf '%s:\n\n' "$header" ;;
esac ;;
text)
case "$level" in
- 1|2) printf "\e[1;4m$header\e[0m\n\n" ;; # bold, underlined
- *) printf "\e[1m$header:\e[0m\n\n" ;; # bold
+ 1|2) printf '\e[1;4m%s\e[0m\n\n' "$header" ;; # bold, underlined
+ *) printf '\e[1m%s:\e[0m\n\n' "$header" ;; # bold
esac ;;
- md) printf "$(printf '%.0s#' {1..${level}}) $header\n\n" ;;
+ md) printf '%s %s\n\n' "$(printf '%.0s#' {1..${level}})" "$header" ;;
esac
}
@@ -244,8 +250,8 @@ function display-release {
# Print [scope]
case "$output" in
- raw|md) printf "[$scope]${padding} " ;;
- text) printf "[\e[38;5;9m$scope\e[0m]${padding} " ;; # red 9
+ raw|md) printf '[%s]%s ' "$scope" "$padding";;
+ text) printf '[\e[38;5;9m%s\e[0m]%s ' "$scope" "$padding";; # red 9
esac
}
@@ -258,7 +264,7 @@ function display-release {
subject="${(U)subject:0:1}${subject:1}"
case "$output" in
- raw) printf "$subject" ;;
+ raw) printf '%s' "$subject" ;;
# In text mode, highlight (#<issue>) and dim text between `backticks`
text) sed -E $'s|#([0-9]+)|\e[32m#\\1\e[0m|g;s|`([^`]+)`|`\e[2m\\1\e[0m`|g' <<< "$subject" ;;
# In markdown mode, link to (#<issue>) issues
@@ -271,8 +277,8 @@ function display-release {
local type="${1:-${TYPES[$type]:-${(C)type}}}"
[[ -z "$type" ]] && return 0
case "$output" in
- raw|md) printf "$type: " ;;
- text) printf "\e[4m$type\e[24m: " ;; # underlined
+ raw|md) printf '%s: ' "$type" ;;
+ text) printf '\e[4m%s\e[24m: ' "$type" ;; # underlined
esac
}
@@ -286,7 +292,7 @@ function display-release {
(( $#breaking != 0 )) || return 0
case "$output" in
- text) fmt:header "\e[31mBREAKING CHANGES" 3 ;;
+ text) printf '\e[31m'; fmt:header "BREAKING CHANGES" 3 ;;
raw) fmt:header "BREAKING CHANGES" 3 ;;
md) fmt:header "BREAKING CHANGES ⚠" 3 ;;
esac
@@ -384,7 +390,8 @@ function main {
# Commit classification arrays
local -A commits subjects scopes breaking reverts
local truncate=0 read_commits=0
- local hash version tag
+ local version tag
+ local hash refs subject body
# Get the first version name:
# 1) try tag-like version, or
@@ -396,17 +403,41 @@ function main {
|| version=$(command git symbolic-ref --quiet --short $until 2>/dev/null) \
|| version=$(command git rev-parse --short $until 2>/dev/null)
- # Get commit list from $until commit until $since commit, or until root
- # commit if $since is unset, in short hash form.
- command git rev-list --abbrev-commit --abbrev=7 ${since:+$since..}$until | while read hash; do
+ # Get commit list from $until commit until $since commit, or until root commit if $since is unset
+ local range=${since:+$since..}$until
+
+ # Git log options
+ # -z: commits are delimited by null bytes
+ # --format: [7-char hash]<field sep>[ref names]<field sep>[subject]<field sep>[body]
+ # --abbrev=7: force commit hashes to be 7 characters long
+ # --no-merges: merge commits are omitted
+ # --first-parent: commits from merged branches are omitted
+ local SEP="0mZmAgIcSeP"
+ local -a raw_commits
+ raw_commits=(${(0)"$(command git log -z \
+ --format="%h${SEP}%D${SEP}%s${SEP}%b" --abbrev=7 \
+ --no-merges --first-parent $range)"})
+
+ local raw_commit
+ local -a raw_fields
+ for raw_commit in $raw_commits; do
# Truncate list on versions with a lot of commits
if [[ -z "$since" ]] && (( ++read_commits > 35 )); then
truncate=1
break
fi
+ # Read the commit fields (@ is needed to keep empty values)
+ eval "raw_fields=(\"\${(@ps:$SEP:)raw_commit}\")"
+ hash="${raw_fields[1]}"
+ refs="${raw_fields[2]}"
+ subject="${raw_fields[3]}"
+ body="${raw_fields[4]}"
+
# If we find a new release (exact tag)
- if tag=$(command git describe --exact-match --tags $hash 2>/dev/null); then
+ if [[ "$refs" = *tag:\ * ]]; then
+ # Parse tag name (needs: setopt extendedglob)
+ tag="${${refs##*tag: }%%,# *}"
# Output previous release
display-release
# Reinitialize commit storage
@@ -420,7 +451,7 @@ function main {
read_commits=1
fi
- parse-commit "$hash"
+ parse-commit "$hash" "$subject" "$body"
done
display-release
@@ -431,8 +462,6 @@ function main {
fi
}
-cd "$ZSH"
-
# Use raw output if stdout is not a tty
if [[ ! -t 1 && -z "$3" ]]; then
main "$1" "$2" --raw
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index 157b0cce2..8264762b6 100644
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -54,14 +54,27 @@ function is_update_available() {
[[ "$repo" = ohmyzsh/ohmyzsh ]] || return 0
local api_url="https://api.github.com/repos/${repo}/commits/${branch}"
- # Get local and remote HEADs and compare them. If we can't get either assume there are updates
- local local_head remote_head
+ # Get local HEAD. If this fails assume there are updates
+ local local_head
local_head=$(git -C "$ZSH" rev-parse $branch 2>/dev/null) || return 0
- remote_head=$(curl -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null) \
- || remote_head=$(wget -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null) \
- || remote_head=$(HTTP_ACCEPT='Accept: application/vnd.github.v3.sha' fetch -o - $api_url 2>/dev/null) \
- || return 0
+ # Get remote HEAD. If we can't get it assume there are updates unless there is no connection:
+ # - curl: 6 (could not resolve) or 7 (could not connect)
+ # - wget: 4 (network unreachable)
+ # - fetch: 1 (no route to host)
+ local remote_head ret
+ remote_head=$(
+ curl -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null || {
+ [[ $? -eq 6 || $? -eq 7 ]] && exit 1
+ } || wget -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null || {
+ [[ $? -eq 4 ]] && exit 1
+ } || HTTP_ACCEPT='Accept: application/vnd.github.v3.sha' fetch -o - $api_url 2>/dev/null || {
+ [[ $? -eq 1 ]] && exit 1
+ } || exit 0
+ )
+
+ # If can't fetch remote HEAD, return exit code
+ ret=$?; [[ -n "$remote_head" ]] || return $ret
# Compare local and remote HEADs
[[ "$local_head" != "$remote_head" ]]