Skip to content

Instantly share code, notes, and snippets.

@jasonvarga
Last active May 2, 2017 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonvarga/321575cf83c3ecef021cfab6f41cffb6 to your computer and use it in GitHub Desktop.
Save jasonvarga/321575cf83c3ecef021cfab6f41cffb6 to your computer and use it in GitHub Desktop.
Interchangeable "please" and "artisan" regardless of Laravel/Statamic project type.
alias artisan='art_plz'
alias please='art_plz'
alias art='art_plz'
alias plz='art_plz'
function art_plz {
if [ -e artisan ]; then
php artisan "$@"
elif [ -e please ]; then
php please "$@"
else
echo "No artisan binary detected."
fi
}
@curtisblackwell
Copy link

Alternatively, use please or artisan regardless of project.

alias art='artisan'
# If you use oh-my-zsh, please is aliased to sudo.
alias please='please'

# Run `php please` for Statamic or `php artisan` for Laravel.
function please {
  # Find either the `please` or `artisan` executable.
  PLEASE="$(find . -name please -maxdepth 2 -type f -print -quit)";
  ARTISAN="$(find . -name artisan -maxdepth 2 -type f -print -quit)";

  if [[ $PLEASE =~ 'please' ]];
  then
    php $PLEASE "$@";
  elif [[ $ARTISAN =~ 'artisan' ]];
  then
    php $ARTISAN "$@";
  fi
}

# Call above please function.
function artisan {
  please "$@";
}

@jasonvarga
Copy link
Author

That's exactly what it's doing, unless I'm missing something.

@curtisblackwell
Copy link

Very slight difference. Negligible for most people. Searches a couple dirs deep, b/c I don't keep Statamic at root of my repo. Also, you don't have to change the command. It's artisan or please rather than art_plz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment