Closed jeeboyer closed 7 months ago
Check the readme. There are some examples there and some limitations to be aware of.
Thank you for your reply. I have manage to make it work fallowing the readme. I would need to had a label but I am not quite sure how to do this. The readme explain how to get a label as fallow value|label|description|detail using the separator field. I am not able to make it work. your help will be appreciated.
launch.json
{
"name": "GDB test 2",,
"type": "cppdbg",
"request": "launch",
"preLaunchTask": "MainTask",,
"program": "${input:promptPathDgbAppl}",
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"miDebuggerServerAddress" : "${input:GetStuffRuntime}:41882",
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
},
{
"id": "GetStuffRuntime",
"type": "command",
"command": "shellCommand.execute",
"args": {
"command": "docker ps --format '{{.Names}}' | xargs -I {} PlSimGetIP.sh {}",
}
},
this return the IP address to the miDebuggerServerAddress attribute properly after the user choose one.
How can I display the container name as label in the prompt window using the docker ps --format '{{.Names}} while returning only the IP value to the miDebuggerServerAddress attribute
I try the fallowing but without sucess.
{
"id": "GetStuffRuntime2",
"type": "command",
"command": "shellCommand.execute",
"args": {
"command": "docker ps --format '{{.Names}}' | xargs -I {} PlSimGetIP.sh {} | docker ps --format '{{.Names}}'",
"fieldSeparator": "|",
"description": "Select the process to attach to"
}
},
your help would be much appreciated thank you
I think you are mixing up the field separator |
and the bash pipe |
. Let's use this configuration to make things less confusing:
"fieldSeparator": ";",
In bash, if you use the |
character, that means that the output from the command on the left is "piped" into the input of the command on the right.
It sounds like you want something like this. Is that correct?
Container Name 4; 172.18.0.4
Container Name 3; 172.18.0.3
Container Name 2; 172.18.0.2
Container Name 1; 172.18.0.1
I don't know the contents of PlSimGetIP.sh
so it's hard for me to say how to fix it. Maybe you could do something like this:
docker ps --format '{{.Names}}' | xargs -I {} sh -c 'echo "{}; $(PlSimGetIP.sh {})"'
sh
so that you can use subshells that depend on the container name{}
, the field separator ;
, and then the result of PlSimGetIP.sh {}
using a subshell.Another option would be to have PlSimGetIP.sh
print the container name too:
# PlSimGetIP.sh
containerName="${1}"
ip=....
echo "${containerName};${ip}"
And then you just need:
docker ps --format '{{.Names}}' | xargs PlSimGetIP.sh
Thank you for your reply. I have solve my issue in an other way, but I will try the above when I have some time.
Is there a way to fetch an other input inside and input like this, using your plugin?