Live Template - PowerShell Follow
I am trying to add PowerShell commands to my profile so I can not spend half my day typing "php artisan" commands. There are several I'd like to add along with other commands from other tools. I have the following template in my PowerShell Profile File:
# Name> Key Generate
# Description> Set the application key
Set-Alias -Name key:generate -Value php-artisan-key-generate
php artisan key:generate
I'm attempting to turn this into a live template that would populate all the fields except the description. The issue I'm running into is defining the different areas so update respectively with the hyphen or colon. The example below sort of works but if you notice in the example further down it pushes the hyphen or colon to the right instead of keeping it between the words. I would also like everything except the Name to be lower case just like the example above.
Any suggestions on how I might accomplish this?
# Name> $NAME1$ $NAME2$
# Description> $DESCRIPTION$
Set-Alias -Name $NAME1$:$NAME2$ -Value php-artisan-$NAME1$-$NAME2$
php artisan $NAME1$:$NAME2$
Live Template Output
# Name> Make Cast
Set-Alias -Name Make Cast: -Value php-artisan-Make Cast-
function php-artisan-Make Cast-
php artisan Make Cast:
Please sign in to leave a comment.
I've tried your Live Template in a plain text file (123.txt) and it works:
The final result:
Looking at your output:
For me it looks like you have entered whole "Make Cast" into a single variable instead of separate two. Double check that.
To make lowercase replacements: you would need to introduce intermediate variables $NAME1low$ and $NAME2low$ (can be named differently) that will contain transformed (lowercase) values of the original corresponding variables:
Transformations can be set after hitting the "Edit variables" button:
Thank you for helping me understand this better. Now that I understand it slightly between I made a few additional changes which git me much closer than I had been.
Thanks again for the help!