diff --git a/laravel.php b/laravel.php index b8c9a18..e2b71b7 100644 --- a/laravel.php +++ b/laravel.php @@ -8,7 +8,16 @@ require __DIR__ . '/vendor/autoload.php'; $query = $argv[1]; -$branch = empty($_ENV['branch']) ? 'master' : $_ENV['branch']; + +preg_match('/^\h*?v?(master|(?:[\d]+)(?:\.[\d]+)?(?:\.[\d]+)?)?\h*?(.*?)$/', $query, $matches); + +if (! empty(trim($matches[1]))) { + $branch = $matches[1]; + $query = $matches[2]; +} else { + $branch = empty($_ENV['branch']) ? 'master' : $_ENV['branch']; +} + $subtext = empty($_ENV['alfred_theme_subtext']) ? '0' : $_ENV['alfred_theme_subtext']; $workflow = new Workflow;