How to change Statamic's please CLI tool to work on just please
Statamic comes with a useful CLI tool called please. Using please, you can do all sorts of things, from deleting content to adding new users, clearing the cache to generating assets using presets.
However by default, Statamic's please can only be triggered by calling php please
. It's a minor thing, but the whole idea of it being called please is a bit annoying if you need to prepend php to the command. php please clear:site
doesn't exactly have the same ring to it as please clear:site
, does it?
Luckily, removing the need to add php before please is easy.
Code
Open your terminal and open your bash profile with a text editor. (I'll be using nano for this tutorial).
nano ~/.bash_profile
Go to a new line and type:
alias please="php please"
Press Ctrl+O to save and then Ctrl+X to exit.
Navigate to a Statamic site and enter please
. It should bring up the options available with the please cli tool.
That's it.
Of course, this is really flexible. As the guys over at Statamic pointed out over on Twitter, you could easily set it to plz
.
Or even “plz”! Save those precious characters while you’re at it!
— Statamic (@statamic) 18 May 2018