I need to implement a command list for windows terminal which store commands to select one of pre-configured commands to enter it in command line prompt by entering/clicking on it. Then we can complete or fill placeholders before executing.
For example:
git commit -a -m "$"
I have searched for it but I have not found the best solution.
Not necessarily with the placeholders bit, but you can do something similar with the sendInput
action. For example, I have something like the following in my actions
in the settings.json
:
{
"command":
{
"action": "sendInput",
"input": "git add --all\r"
},
"name": "add all"
},
{
"command":
{
"action": "sendInput",
"input": "git commit -m \"\"\u001b[D"
},
"name": "commit..."
},
{
"command":
{
"action": "sendInput",
"input": "git fetch & git pull\r"
},
"name": "fetch&pull"
},
{
"command":
{
"action": "sendInput",
"input": "git merge origin/main\r"
},
"name": "merge main"
},
{
"command":
{
"action": "sendInput",
"input": "git log --graph --abbrev-commit --decorate --format=format:\"%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)\" --all\r"
},
"name": "graph"
},
Then you can just open the Command Palette with Ctrl+Shift+P, and fuzzy-find them in there.
(I even go a step further and nest these all under a git...
entry, so they're all grouped together.)
addenda: