Skip to content

Commit

Permalink
Improving output of blt:alias. (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmash committed Jun 9, 2016
1 parent ec641ba commit 41597dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions template/build/core/phing/tasks/blt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</target>

<target name="blt:alias" description="Installs the BLT alias for command line usage.">
<!-- @todo Check to see if alias is already present. -->

This comment has been minimized.

Copy link
@danepowell

danepowell Jun 13, 2016

Contributor

install-alias.sh already checks if the alias is present (see around line 14, grep 'function blt'). It's a little hackish but should basically work.

This comment has been minimized.

Copy link
@grasmash

grasmash Jun 13, 2016

Author Contributor

Right, but I'd rather it not prompt you at all if it already exists. Right now, it prompts you to install it even if it's already installed.

This comment has been minimized.

Copy link
@danepowell

danepowell Jun 13, 2016

Contributor

Gotcha... yeah I see why that'd be annoying.

<echo>BLT can automatically create a Bash alias to make it easier to run BLT tasks.</echo>
<echo>This alias may be created in .bash_profile or .bashrc depending on your system architecture.</echo>
<propertyprompt propertyName="create_alias" defaultValue="y" useExistingValue="true" promptText="Create a bash alias now? (y/n)" />
Expand Down
9 changes: 6 additions & 3 deletions template/scripts/blt/install-alias.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ if [ ! -z "$DETECTED_PROFILE" ]; then
exit
fi
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cat $DIR/alias >> $DETECTED_PROFILE

echo "Added alias for blt to $DETECTED_PROFILE"
echo "Restart your terminal session to use the new command."
if cat $DIR/alias >> $DETECTED_PROFILE; then
echo "Added alias for blt to $DETECTED_PROFILE"
echo "Restart your terminal session to use the new command."
else
echo "Error: Could not modify $DETECTED_PROFILE."
fi
else
echo "Could not install blt alias. No profile found. Tried ~/.zshrc, ~/.bashrc, ~/.bash_profile and ~/.profile."
fi

0 comments on commit 41597dc

Please sign in to comment.