Permalink
Browse files

Moved `-set-default` into a private function.

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...
1 parent 3c16e1f commit 3e92539689534f4e563fb95416ecb5c39f72c2c5 @sharat87 sharat87 committed Feb 21, 2013
Showing with 11 additions and 8 deletions.
  1. +11 −8 antigen.zsh
View
@@ -293,7 +293,6 @@ antigen-revert () {
}
antigen-selfupdate () {
- # Initiate subshell
(
cd $_ANTIGEN_INSTALL_DIR
# Sanity checks
@@ -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
@@ -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

0 comments on commit 3e92539

Please sign in to comment.