-
-
Save ModulesUnraveled/d94e358b8f9ba92c8554e12a38ddf93f to your computer and use it in GitHub Desktop.
4k - Cross platform/language/team/etc. command scripting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Installation: | |
# - Copy this file to /usr/local/bin/k4 | |
# - Make it executable `chmod +x /usr/local/bin/4k` | |
# | |
# Use: | |
# - Run `4k <command>` | |
# - If you haven't configured that command for the current project | |
# you'll be asked to configure it now | |
# - If you have already configured it, it'll be run | |
# | |
# Example: | |
# - `4k rebuild` can be configure to run: | |
# - `aquifer run rebuild` in an old D7 site | |
# - `gulp run -t rebuild` in a project that uses gulp for build tasks | |
command=$(git config --get alias.$@) | |
if [ "$command" = '' ]; | |
then | |
echo "No command" | |
read -p "Do you want to enter it now? [y/n]: " -n 1 -r | |
echo "\n" | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
read -p "Enter the command for $@: " input; | |
echo "git config alias.$@ $input" | |
git config alias.$@ "$input" | |
else | |
echo "Okie doke. Nothing saved." | |
fi | |
else | |
echo "\nRunning \"$command\"\n" | |
$command | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment