Skip to content

Commit cb8f2b8

Browse files
authored
[1.x] Adds domain, domain:list and domain:delete aliases (#208)
* Adds `domain`, `domain:list` and `domain:delete` aliases * Wording
1 parent f9e78bc commit cb8f2b8

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

src/Commands/ZoneCommand.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ protected function configure()
1616
{
1717
$this
1818
->setName('zone')
19-
->addArgument('zone', InputArgument::REQUIRED, 'The zone name')
20-
->setDescription('Create a new DNS zone');
19+
->setAliases(['domain'])
20+
->addArgument('domain', InputArgument::REQUIRED, 'The domain name')
21+
->setDescription('Add a domain');
2122
}
2223

2324
/**
@@ -30,11 +31,11 @@ public function handle()
3031
Helpers::ensure_api_token_is_available();
3132

3233
$zone = $this->vapor->createZone(
33-
$this->determineProvider('Which cloud provider should the zone belong to?'),
34-
$this->argument('zone')
34+
$this->determineProvider('Which cloud provider should the domain belong to?'),
35+
$this->argument('domain')
3536
);
3637

37-
Helpers::info('Zone created successfully.');
38+
Helpers::info('Domain added successfully.');
3839
Helpers::line();
3940
Helpers::info('Nameservers:');
4041
Helpers::line();

src/Commands/ZoneDeleteCommand.php

+9-8
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ protected function configure()
1616
{
1717
$this
1818
->setName('zone:delete')
19-
->addArgument('zone', InputArgument::REQUIRED, 'The zone name / ID')
20-
->setDescription('Delete a DNS zone');
19+
->setAliases(['domain:delete'])
20+
->addArgument('domain', InputArgument::REQUIRED, 'The domain name / ID')
21+
->setDescription('Delete a domain');
2122
}
2223

2324
/**
@@ -27,22 +28,22 @@ protected function configure()
2728
*/
2829
public function handle()
2930
{
30-
$zone = $this->argument('zone');
31-
32-
if (! is_numeric($zoneId = $this->argument('zone'))) {
31+
if (! is_numeric($zoneId = $this->argument('domain'))) {
3332
$zoneId = $this->findIdByName($this->vapor->zones(), $zoneId, 'zone');
3433
}
3534

3635
if (is_null($zoneId)) {
37-
Helpers::abort('Unable to find a zone with that name / ID.');
36+
Helpers::abort('Unable to find a domain with that name / ID.');
3837
}
3938

40-
if (! Helpers::confirm("Are you sure you want to delete the zone for {$zone}", false)) {
39+
$zone = $this->vapor->zone($zoneId);
40+
41+
if (! Helpers::confirm("Are you sure you want to delete [{$zone['zone']}] from Vapor", false)) {
4142
Helpers::abort('Action cancelled.');
4243
}
4344

4445
$this->vapor->deleteZone($zoneId);
4546

46-
Helpers::info('Zone deleted successfully.');
47+
Helpers::info('Domain successfully deleted from Vapor. Please note that the DNS zone will still persist on AWS.');
4748
}
4849
}

src/Commands/ZoneListCommand.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ protected function configure()
1515
{
1616
$this
1717
->setName('zone:list')
18-
->setDescription('List the DNS zones that belong to the current team');
18+
->setAliases(['domain:list'])
19+
->setDescription('List the domains that belong to the current team');
1920
}
2021

2122
/**
@@ -28,7 +29,7 @@ public function handle()
2829
Helpers::ensure_api_token_is_available();
2930

3031
$this->table([
31-
'ID', 'Zone', 'Nameservers',
32+
'ID', 'Domain', 'Nameservers',
3233
], collect($this->vapor->zones())->map(function ($zone) {
3334
return [
3435
$zone['id'],

0 commit comments

Comments
 (0)