VSCodeのタスクでOS判定が簡単だった

全然情報が出てこないのは、複数のOSで作業するってことが少ないのかな…

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "task-name",
            "type": "shell",
            "windows":{
                "command": "$(date -format 'yyyymmddhhmm')"
            },
            "linux":{
                "command": "$(date '+%Y%m%d%H%M')"
            }
        }
    ]
}

dateコマンドがWindowsのPower ShellとLinuxのShellとで引数が違うので少し困ってた。

comments powered by Disqus

Projects