#! /usr/bin/env bash

if [ "z$1" == "z--help" ]; then
  echo "vscode [FILE]"
  echo "  Starts Visual Studio Code for Windows"
  echo "  If FILE is given (as a unix path) it will be opened."
  exit;
fi

winpath="C:\\Program Files\\Microsoft VS Code\\Code.exe"

progpath=`cygpath -u "$winpath"`

filepath=
if [ "z$1" != z ]; then
  filepath=`cygpath -w "$1"`
fi

cygstart "$progpath" "$filepath"