Skip to content

Commit b5db016

Browse files
committed
Add new Shell API
1 parent 42ce4e9 commit b5db016

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

src/Facades/Shell.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Native\Laravel\Facades;
4+
5+
use Illuminate\Support\Facades\Facade;
6+
7+
class Shell extends Facade
8+
{
9+
protected static function getFacadeAccessor()
10+
{
11+
return \Native\Laravel\Shell::class;
12+
}
13+
}

src/Shell.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace Native\Laravel;
4+
5+
use Native\Laravel\Client\Client;
6+
7+
class Shell
8+
{
9+
public function __construct(protected Client $client)
10+
{
11+
}
12+
13+
public function showInFolder(string $path): void
14+
{
15+
$this->client->post('shell/show-item-in-folder', [
16+
'path' => $path,
17+
]);
18+
}
19+
20+
public function openFile(string $path): string
21+
{
22+
return $this->client->post('shell/open-item', [
23+
'path' => $path,
24+
])->json('result');
25+
}
26+
27+
public function openExternal(string $url): void
28+
{
29+
$this->client->post('shell/open-external', [
30+
'url' => $url,
31+
]);
32+
}
33+
34+
public function displays(): array
35+
{
36+
return $this->client->get('screen/displays')->json('displays');
37+
}
38+
}

0 commit comments

Comments
 (0)