diff options
-rw-r--r-- | lib/completion.zsh | 7 | ||||
-rw-r--r-- | lib/directories.zsh | 1 | ||||
-rw-r--r-- | lib/git.zsh | 29 | ||||
-rw-r--r-- | plugins/colored-man/colored-man.plugin.zsh | 21 | ||||
-rw-r--r-- | plugins/forklift/forklift.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/frontend-search/frontend-search.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/gitignore/gitignore.plugin.zsh | 12 | ||||
-rw-r--r-- | plugins/osx/osx.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/pj/pj.plugin.zsh | 11 | ||||
-rw-r--r-- | plugins/rails/rails.plugin.zsh | 4 | ||||
-rw-r--r-- | plugins/scd/README.md | 15 | ||||
-rwxr-xr-x | plugins/scd/scd | 119 | ||||
-rw-r--r-- | plugins/virtualenv/virtualenv.plugin.zsh | 5 | ||||
-rw-r--r-- | plugins/xcode/xcode.plugin.zsh | 7 | ||||
-rw-r--r-- | themes/gallois.zsh-theme | 20 | ||||
-rw-r--r-- | tools/check_for_upgrade.sh | 6 |
16 files changed, 165 insertions, 98 deletions
diff --git a/lib/completion.zsh b/lib/completion.zsh index fa1d97f48..83b6efb66 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -25,7 +25,12 @@ bindkey -M menuselect '^o' accept-and-infer-next-history zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' -zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" +if [ "$OSTYPE[0,7]" = "solaris" ] +then + zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm" +else + zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" +fi # disable named-directories autocompletion zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories diff --git a/lib/directories.zsh b/lib/directories.zsh index 1896945f4..02743e0c7 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -1,5 +1,4 @@ # Changing/making/removing directory -setopt auto_name_dirs setopt auto_pushd setopt pushd_ignore_dups setopt pushdminus diff --git a/lib/git.zsh b/lib/git.zsh index 7aa5a0ea2..aba095422 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -10,23 +10,20 @@ function git_prompt_info() { # Checks if working tree is dirty parse_git_dirty() { - local SUBMODULE_SYNTAX='' - local GIT_STATUS='' - local CLEAN_MESSAGE='nothing to commit (working directory clean)' + local STATUS='' + local FLAGS + FLAGS=('--porcelain') if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then if [[ $POST_1_7_2_GIT -gt 0 ]]; then - SUBMODULE_SYNTAX="--ignore-submodules=dirty" + FLAGS+='--ignore-submodules=dirty' fi if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then - GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1) - else - GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1) - fi - if [[ -n $GIT_STATUS ]]; then - echo "$ZSH_THEME_GIT_PROMPT_DIRTY" - else - echo "$ZSH_THEME_GIT_PROMPT_CLEAN" + FLAGS+='--untracked-files=no' fi + STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) + fi + if [[ -n $STATUS ]]; then + echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" fi @@ -135,17 +132,19 @@ function git_compare_version() { INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}); for i in {1..3}; do + if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then + echo 1 + return 0 + fi if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then echo -1 return 0 fi done - echo 1 + echo 0 } #this is unlikely to change so make it all statically assigned POST_1_7_2_GIT=$(git_compare_version "1.7.2") #clean up the namespace slightly by removing the checker function unset -f git_compare_version - - diff --git a/plugins/colored-man/colored-man.plugin.zsh b/plugins/colored-man/colored-man.plugin.zsh index 56056284a..5c613f49d 100644 --- a/plugins/colored-man/colored-man.plugin.zsh +++ b/plugins/colored-man/colored-man.plugin.zsh @@ -1,3 +1,21 @@ +if [ "$OSTYPE[0,7]" = "solaris" ] +then + if [ ! -x ${HOME}/bin/nroff ] + then + mkdir -p ${HOME}/bin + cat > ${HOME}/bin/nroff <<EOF +#!/bin/sh +if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then + shift + exec /usr/bin/nroff -u\${_NROFF_U} "\$@" +fi +#-- Some other invocation of nroff +exec /usr/bin/nroff "\$@" +EOF + chmod +x ${HOME}/bin/nroff + fi +fi + man() { env \ LESS_TERMCAP_mb=$(printf "\e[1;31m") \ @@ -7,5 +25,8 @@ man() { LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ LESS_TERMCAP_ue=$(printf "\e[0m") \ LESS_TERMCAP_us=$(printf "\e[1;32m") \ + PAGER=/usr/bin/less \ + _NROFF_U=1 \ + PATH=${HOME}/bin:${PATH} \ man "$@" } diff --git a/plugins/forklift/forklift.plugin.zsh b/plugins/forklift/forklift.plugin.zsh index b0e60a434..692ca5790 100644 --- a/plugins/forklift/forklift.plugin.zsh +++ b/plugins/forklift/forklift.plugin.zsh @@ -1,4 +1,4 @@ -# Open folder in ForkLift.app of ForkLift2.app from console +# Open folder in ForkLift.app or ForkLift2.app from console # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de # Updated to support ForkLift2 by Johan Kaving # diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index 38b1a80ea..f1d45b0d1 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -118,7 +118,7 @@ alias jquery='frontend jquery' alias mdn='frontend mdn' # pre processors frameworks -alias compass='frontend compass' +alias compassdoc='frontend compass' # important links alias html5please='frontend html5please' diff --git a/plugins/gitignore/gitignore.plugin.zsh b/plugins/gitignore/gitignore.plugin.zsh index be037d87a..481d487ba 100644 --- a/plugins/gitignore/gitignore.plugin.zsh +++ b/plugins/gitignore/gitignore.plugin.zsh @@ -1,12 +1,12 @@ -function gi() { curl http://www.gitignore.io/api/$@ ;} +function gi() { curl -sL https://www.gitignore.io/api/$@ ;} -_gitignireio_get_command_list() { - curl -s http://www.gitignore.io/api/list | tr "," "\n" +_gitignoreio_get_command_list() { + curl -sL https://www.gitignore.io/api/list | tr "," "\n" } -_gitignireio () { +_gitignoreio () { compset -P '*,' - compadd -S '' `_gitignireio_get_command_list` + compadd -S '' `_gitignoreio_get_command_list` } -compdef _gitignireio gi +compdef _gitignoreio gi diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index a63f0ee05..2eea0d8ef 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -139,7 +139,7 @@ function man-preview() { function trash() { local trash_dir="${HOME}/.Trash" - local temp_ifs=$IFS + local temp_ifs="$IFS" IFS=$'\n' for item in "$@"; do if [[ -e "$item" ]]; then diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh index ba3765b83..f9cbddf1a 100644 --- a/plugins/pj/pj.plugin.zsh +++ b/plugins/pj/pj.plugin.zsh @@ -18,8 +18,11 @@ function pj() { file=$1 if [[ "open" == "$file" ]] then - file=$2 + shift + file=$* cmd=(${(s: :)EDITOR}) + else + file=$* fi for project in $PROJECT_PATHS; do @@ -36,7 +39,11 @@ function pj() { alias pjo="pj open" function _pj () { - compadd `/bin/ls -l $PROJECT_PATHS 2>/dev/null | awk '{ print $9 }'` + # might be possible to improve this using glob, without the basename trick + typeset -a projects + projects=($PROJECT_PATHS/*) + projects=$projects:t + _arguments '*:file:($projects)' } compdef _pj pj diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index fb46cdcf0..824658e44 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -6,7 +6,7 @@ function _rails_command () { elif [ -e "script/server" ]; then ruby script/$@ else - rails $@ + command rails $@ fi } @@ -14,7 +14,7 @@ function _rake_command () { if [ -e "bin/rake" ]; then bin/rake $@ else - rake $@ + command rake $@ fi } diff --git a/plugins/scd/README.md b/plugins/scd/README.md index 197cea50a..86ab67203 100644 --- a/plugins/scd/README.md +++ b/plugins/scd/README.md @@ -11,12 +11,9 @@ the index. A selection menu is displayed in case of several matches, with a preference given to recently visited paths. `scd` can create permanent directory aliases, which appear as named directories in zsh session. -## INSTALLATION +## INSTALLATION NOTES -For oh-my-zsh, add `scd` to the `plugins` array in the ~/.zshrc file as in the -[template file](../../templates/zshrc.zsh-template#L45). - -Besides zsh, `scd` can be used with *bash*, *dash* or *tcsh* +Besides oh-my-zsh, `scd` can be used with *bash*, *dash* or *tcsh* shells and is also available as [Vim](http://www.vim.org/) plugin and [IPython](http://ipython.org/) extension. For installation details, see https://github.com/pavoljuhas/smart-change-directory. @@ -34,7 +31,7 @@ scd [options] [pattern1 pattern2 ...] add specified directories to the directory index.</dd><dt> --unindex</dt><dd> - remove specified directories from the index.</dd><dt> + remove current or specified directories from the index.</dd><dt> -r, --recursive</dt><dd> apply options <em>--add</em> or <em>--unindex</em> recursively.</dd><dt> @@ -47,6 +44,10 @@ scd [options] [pattern1 pattern2 ...] remove ALIAS definition for the current or specified directory from <em>~/.scdalias.zsh</em>.</dd><dt> +-A, --all</dt><dd> + include all matching directories. Disregard matching by directory + alias and filtering of less likely paths.</dd><dt> + --list</dt><dd> show matching directories and exit.</dd><dt> @@ -70,7 +71,7 @@ scd doc scd a b c # Change to a directory path that ends with "ts" -scd "ts(#e)" +scd "ts$" # Show selection menu and ranking of 20 most likely directories scd -v diff --git a/plugins/scd/scd b/plugins/scd/scd index 1567d2736..39b28237d 100755 --- a/plugins/scd/scd +++ b/plugins/scd/scd @@ -11,20 +11,22 @@ fi local DOC='scd -- smart change to a recently used directory usage: scd [options] [pattern1 pattern2 ...] Go to a directory path that contains all fixed string patterns. Prefer -recently visited directories and directories with patterns in their tail -component. Display a selection menu in case of multiple matches. +recent or frequently visited directories as found in the directory index. +Display a selection menu in case of multiple matches. Options: - -a, --add add specified directories to the directory index - --unindex remove specified directories from the index - -r, --recursive apply options --add or --unindex recursively + -a, --add add specified directories to the directory index. + --unindex remove current or specified directories from the index. + -r, --recursive apply options --add or --unindex recursively. --alias=ALIAS create alias for the current or specified directory and - store it in ~/.scdalias.zsh + store it in ~/.scdalias.zsh. --unalias remove ALIAS definition for the current or specified - directory from ~/.scdalias.zsh - --list show matching directories and exit - -v, --verbose display directory rank in the selection menu - -h, --help display this message and exit + directory from ~/.scdalias.zsh. + -A, --all include all matching directories. Disregard matching by + directory alias and filtering of less likely paths. + --list show matching directories and exit. + -v, --verbose display directory rank in the selection menu. + -h, --help display this message and exit. ' local SCD_HISTFILE=${SCD_HISTFILE:-${HOME}/.scdhistory} @@ -35,9 +37,9 @@ local SCD_THRESHOLD=${SCD_THRESHOLD:-0.005} local SCD_SCRIPT=${RUNNING_AS_COMMAND:+$SCD_SCRIPT} local SCD_ALIAS=~/.scdalias.zsh -local ICASE a d m p i tdir maxrank threshold +local ICASE a d m p i maxrank threshold local opt_help opt_add opt_unindex opt_recursive opt_verbose -local opt_alias opt_unalias opt_list +local opt_alias opt_unalias opt_all opt_list local -A drank dalias local dmatching local last_directory @@ -56,7 +58,8 @@ zmodload -i zsh/zutil zmodload -i zsh/datetime zparseopts -D -- a=opt_add -add=opt_add -unindex=opt_unindex \ r=opt_recursive -recursive=opt_recursive \ - -alias:=opt_alias -unalias=opt_unalias -list=opt_list \ + -alias:=opt_alias -unalias=opt_unalias \ + A=opt_all -all=opt_all -list=opt_list \ v=opt_verbose -verbose=opt_verbose h=opt_help -help=opt_help \ || $EXIT $? @@ -68,6 +71,11 @@ fi # load directory aliases if they exist [[ -r $SCD_ALIAS ]] && source $SCD_ALIAS +# Private internal functions are prefixed with _scd_Y19oug_. +# Clean them up when the scd function returns. +setopt localtraps +trap 'unfunction -m "_scd_Y19oug_*"' EXIT + # works faster than the (:a) modifier and is compatible with zsh 4.2.6 _scd_Y19oug_abspath() { set -A $1 ${(ps:\0:)"$( @@ -123,11 +131,52 @@ if [[ -n $opt_unalias ]]; then $EXIT $? fi +# The "compress" function collapses repeated directories to +# one entry with a time stamp that gives equivalent-probability. +_scd_Y19oug_compress() { + awk -v epochseconds=$EPOCHSECONDS -v meanlife=$SCD_MEANLIFE ' + BEGIN { FS = "[:;]"; } + length($0) < 4096 && $2 > 0 { + tau = 1.0 * ($2 - epochseconds) / meanlife; + if (tau < -6.9078) tau = -6.9078; + prob = exp(tau); + sub(/^[^;]*;/, ""); + if (NF) { + dlist[last[$0]] = ""; + dlist[NR] = $0; + last[$0] = NR; + ptot[$0] += prob; + } + } + END { + for (i = 1; i <= NR; ++i) { + d = dlist[i]; + if (d) { + ts = log(ptot[d]) * meanlife + epochseconds; + printf(": %.0f:0;%s\n", ts, d); + } + } + } + ' $* +} + # Rewrite directory index if it is at least 20% oversized if [[ -s $SCD_HISTFILE ]] && \ (( $(wc -l <$SCD_HISTFILE) > 1.2 * $SCD_HISTSIZE )); then - m=( ${(f)"$(<$SCD_HISTFILE)"} ) - print -lr -- ${m[-$SCD_HISTSIZE,-1]} >| ${SCD_HISTFILE} + # compress repeated entries + m=( ${(f)"$(_scd_Y19oug_compress $SCD_HISTFILE)"} ) + # purge non-existent directories + m=( ${(f)"$( + for a in $m; do + if [[ -d ${a#*;} ]]; then print -r -- $a; fi + done + )"} + ) + # cut old entries if still oversized + if [[ $#m -gt $SCD_HISTSIZE ]]; then + m=( ${m[-$SCD_HISTSIZE,-1]} ) + fi + print -lr -- $m >| ${SCD_HISTFILE} fi # Determine the last recorded directory @@ -135,7 +184,6 @@ if [[ -s ${SCD_HISTFILE} ]]; then last_directory=${"$(tail -1 ${SCD_HISTFILE})"#*;} fi -# Internal functions are prefixed with "_scd_Y19oug_". # The "record" function adds its arguments to the directory index. _scd_Y19oug_record() { while [[ -n $last_directory && $1 == $last_directory ]]; do @@ -217,7 +265,7 @@ _scd_Y19oug_action() { # set global arrays dmatching and drank _scd_Y19oug_match() { ## single argument that is an existing directory or directory alias - if [[ $# == 1 ]] && \ + if [[ -z $opt_all && $# == 1 ]] && \ [[ -d ${d::=$1} || -d ${d::=${nameddirs[$1]}} ]] && [[ -x $d ]]; then _scd_Y19oug_abspath dmatching $d @@ -227,6 +275,8 @@ _scd_Y19oug_match() { # ignore case unless there is an argument with an uppercase letter [[ "$*" == *[[:upper:]]* ]] || ICASE='(#i)' + # support "$" as an anchor for the directory name ending + argv=( ${argv/(#m)?[$](#e)/${MATCH[1]}(#e)} ) # calculate rank of all directories in the SCD_HISTFILE and keep it as drank # include a dummy entry for splitting of an empty string is buggy @@ -237,10 +287,10 @@ _scd_Y19oug_match() { BEGIN { FS = "[:;]"; } length($0) < 4096 && $2 > 0 { tau = 1.0 * ($2 - epochseconds) / meanlife; - if (tau < -4.61) tau = -4.61; - prec = exp(tau); + if (tau < -6.9078) tau = -6.9078; + prob = exp(tau); sub(/^[^;]*;/, ""); - if (NF) ptot[$0] += prec; + if (NF) ptot[$0] += prob; } END { for (di in ptot) { print di; print ptot[di]; } }' )"} @@ -249,9 +299,12 @@ _scd_Y19oug_match() { # filter drank to the entries that match all arguments for a; do - p=${ICASE}"*${a}*" + p=${ICASE}"*(${a})*" drank=( ${(kv)drank[(I)${~p}]} ) done + # require at least one argument matches the directory name + p=${ICASE}"*(${(j:|:)argv})[^/]#" + drank=( ${(kv)drank[(I)${~p}]} ) # build a list of matching directories reverse-sorted by their probabilities dmatching=( ${(f)"$( @@ -261,26 +314,6 @@ _scd_Y19oug_match() { )"} ) - # if some directory paths match all patterns in order, discard all others - p=${ICASE}"*${(j:*:)argv}*" - m=( ${(M)dmatching:#${~p}} ) - [[ -d ${m[1]} ]] && dmatching=( $m ) - # if some directory names match last pattern, discard all others - p=${ICASE}"*${(j:*:)argv}[^/]#" - m=( ${(M)dmatching:#${~p}} ) - [[ -d ${m[1]} ]] && dmatching=( $m ) - # if some directory names match all patterns, discard all others - m=( $dmatching ) - for a; do - p=${ICASE}"*/[^/]#${a}[^/]#" - m=( ${(M)m:#${~p}} ) - done - [[ -d ${m[1]} ]] && dmatching=( $m ) - # if some directory names match all patterns in order, discard all others - p=${ICASE}"/*${(j:[^/]#:)argv}[^/]#" - m=( ${(M)dmatching:#${~p}} ) - [[ -d ${m[1]} ]] && dmatching=( $m ) - # do not match $HOME or $PWD when run without arguments if [[ $# == 0 ]]; then dmatching=( ${dmatching:#(${HOME}|${PWD})} ) @@ -302,6 +335,9 @@ _scd_Y19oug_match() { # discard all directories below the rank threshold threshold=$(( maxrank * SCD_THRESHOLD )) + if [[ -n ${opt_all} ]]; then + threshold=0 + fi dmatching=( ${^dmatching}(Ne:'(( ${drank[$REPLY]} >= threshold ))':) ) } @@ -339,6 +375,7 @@ fi ## here we have multiple matches - display selection menu a=( {a-z} {A-Z} ) +a=( ${a[1,${#dmatching}]} ) p=( ) for i in {1..${#dmatching}}; do [[ -n ${a[i]} ]] || break diff --git a/plugins/virtualenv/virtualenv.plugin.zsh b/plugins/virtualenv/virtualenv.plugin.zsh index 8e06450b1..e250eb63e 100644 --- a/plugins/virtualenv/virtualenv.plugin.zsh +++ b/plugins/virtualenv/virtualenv.plugin.zsh @@ -1,7 +1,6 @@ function virtualenv_prompt_info(){ - if [[ -n $VIRTUAL_ENV ]]; then - printf "%s[%s] " "%{${fg[yellow]}%}" ${${VIRTUAL_ENV}:t} - fi + [[ -n ${VIRTUAL_ENV} ]] || return + echo "${ZSH_THEME_VIRTUALENV_PREFIX:=[}${VIRTUAL_ENV:t}${ZSH_THEME_VIRTUALENV_SUFFIX:=]}" } # disables prompt mangling in virtual_env/bin/activate diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh index e59bee8c7..b7b75cf93 100644 --- a/plugins/xcode/xcode.plugin.zsh +++ b/plugins/xcode/xcode.plugin.zsh @@ -16,4 +16,9 @@ function xcsel { alias xcb='xcodebuild' alias xcp='xcode-select --print-path' -alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app' + +if [[ -d $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app ]]; then + alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app' +else + alias simulator='open $(xcode-select -p)/Applications/iOS\ Simulator.app' +fi diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme index f1057a9a9..d383ed583 100644 --- a/themes/gallois.zsh-theme +++ b/themes/gallois.zsh-theme @@ -11,19 +11,11 @@ git_custom_status() { fi } -#RVM and git settings -if [[ -s ~/.rvm/scripts/rvm ]] ; then - RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1' -else - if which rbenv &> /dev/null; then - RPS1='$(git_custom_status)%{$fg[red]%}[`rbenv version | sed -e "s/ (set.*$//"`]%{$reset_color%} $EPS1' - else - if [[ -n `which chruby_prompt_info` && -n `chruby_prompt_info` ]]; then - RPS1='$(git_custom_status)%{$fg[red]%}[`chruby_prompt_info`]%{$reset_color%} $EPS1' - else - RPS1='$(git_custom_status) $EPS1' - fi - fi -fi +# RVM component of prompt +ZSH_THEME_RVM_PROMPT_PREFIX="%{$fg[red]%}[" +ZSH_THEME_RVM_PROMPT_SUFFIX="]%{$reset_color%}" + +# Combine it all into a final right-side prompt +RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1' PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b ' diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 35e074297..4a0803210 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -1,7 +1,9 @@ -#!/bin/sh +#!/usr/bin/env zsh + +zmodload zsh/datetime function _current_epoch() { - echo $(($(date +%s) / 60 / 60 / 24)) + echo $(( $EPOCHSECONDS / 60 / 60 / 24 )) } function _update_zsh_update() { |