1
0
Fork 0
chezmoi/bin/executable_handle_vscode
2023-06-23 09:27:11 +02:00

21 lines
454 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('/home/vladimir/jopixel/');
exec("git clone '$remote'");
chdir('/home/vladimir/jopixel/'.$repo);
pcntl_exec('/bin/zsh');