Skip to content

Commit

Permalink
Moved -set-default into a private function.
Browse files Browse the repository at this point in the history
Its polluting the global namespace but doesn't have the `antigen` prefix, making
it hard to figure out where it came from.
  • Loading branch information
sharat87 committed Feb 21, 2013
1 parent 3c16e1f commit 3e92539
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions antigen.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ antigen-revert () {
}

antigen-selfupdate () {
# Initiate subshell
(
cd $_ANTIGEN_INSTALL_DIR
# Sanity checks
Expand Down Expand Up @@ -631,6 +630,15 @@ antigen () {
}
-antigen-env-setup () {
# Helper function: Same as `export $1=$2`, but will only happen if the name
# specified by `$1` is not already set.
-set-default () {
local arg_name="$1"
local arg_value="$2"
eval "test -z \"\$$arg_name\" && export $arg_name='$arg_value'"
}
# Pre-startup initializations.
-set-default ANTIGEN_DEFAULT_REPO_URL \
https://github.com/robbyrussell/oh-my-zsh.git
Expand All @@ -643,14 +651,9 @@ antigen () {
# Setup antigen's own completion.
compdef _antigen antigen
}
# Same as `export $1=$2`, but will only happen if the name specified by `$1` is
# not already set.
-set-default () {
local arg_name="$1"
local arg_value="$2"
eval "test -z \"\$$arg_name\" && export $arg_name='$arg_value'"
# Remove private functions.
unfunction -- -set-default
}
# Setup antigen's autocompletion
Expand Down

0 comments on commit 3e92539

Please sign in to comment.