{
    "tasks": [
        {
            "type": "shell",
            "label": "构建 chsrc",
            "command": "just",
            "args": [
                "build"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "dependsOn": "停止程序",
            "detail": "先停止原有程序，然后使用 just build 编译"
        },
        {
            "type": "shell",
            "label": "构建 debug 版 chsrc",
            "command": "just",
            "args": [
                "build-in-debug-mode"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": false
            },
        },
        {
            "type": "shell",
            "label": "测试 chsrc",
            "command": "just",
            "args": [
                "test"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "test",
                "isDefault": true
            },
            "detail": "使用 just test 测试"
        },
        {
            "type": "shell",
            "label": "测试 framework",
            "command": "just",
            "args": [
                "test-fw"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "test",
                "isDefault": false
            },
            "detail": "使用 just test-fw 测试 framework"
        },
        {
            "type": "shell",
            "label": "测试 xy.h",
            "command": "just",
            "args": [
                "test-xy"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "test",
                "isDefault": false
            },
            "detail": "使用 just test-xy 测试 xy.h"
        },
        {
            "type": "shell",
            "label": "停止 debug 程序",
            "windows": {
                "command": "powershell",
                "args": [
                    "-c",
                    "Get-Process -Name \"chsrc-debug\" -ErrorAction SilentlyContinue | Stop-Process -Force;",
                    "Get-Process -Name \"gdb\" -ErrorAction SilentlyContinue | Stop-Process -Force;",
                    "Get-Process -Name \"WindowsDebugLauncher\" -ErrorAction SilentlyContinue | Stop-Process -Force;"
                ]
            },
            "linux": {
                "command": "bash",
                "args": [
                    "-c",
                    "if pgrep -f chsrc-debug > /dev/null; then pkill -f chsrc-debug; fi"
                ]
            },
            "osx": {
                "command": "bash",
                "args": [
                    "-c",
                    "if pgrep -f chsrc-debug > /dev/null; then pkill -f chsrc-debug; fi"
                ]
            },
            "group": "build",
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
                "clear": false
            },
            "detail": "停止 debug 版本的 chsrc"
        },
        {
            "type": "shell",
            "label": "停止程序",
            "windows": {
                "command": "powershell",
                "args": [
                    "-c",
                    "Get-Process -Name \"chsrc\" -ErrorAction SilentlyContinue | Stop-Process -Force;"
                ]
            },
            "linux": {
                "command": "bash",
                "args": [
                    "-c",
                    "if pgrep -f chsrc > /dev/null; then pkill -f chsrc; fi"
                ]
            },
            "osx": {
                "command": "bash",
                "args": [
                    "-c",
                    "if pgrep -f chsrc > /dev/null; then pkill -f chsrc; fi"
                ]
            },
            "group": "build",
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
                "clear": false
            },
            "detail": "跨平台停止 chsrc"
        }
    ],
    "version": "2.0.0"
}