1
0
Fork 0
chezmoi/bin/executable_handle_vscode.tmpl
2023-07-14 13:53:58 +02:00

21 lines
435 B
PHP

#!/bin/php
<?php
$url = parse_url($argv[1] ?? '');
if (($url['scheme'] ?? 'hovno') != 'vscode') {
exec('notify-send "Unknown scheme " "'.$url['scheme'].'" -u critical');
exit;
}
parse_str($url['query'], $query);
$remote = $query['url'];
preg_match('|/(?<repo>[^/]*)\.git$|', $remote, $res);
$repo = $res['repo'];
chdir("{{.chezmoi.homeDir }}/jopixel/");
exec("git clone '$remote'");
chdir($repo);
pcntl_exec('/bin/zsh');