-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathCreatorCommand.php
More file actions
54 lines (42 loc) · 1.44 KB
/
CreatorCommand.php
File metadata and controls
54 lines (42 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace Madeny\lhttps;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Madeny\lhttps\Config;
use Madeny\lhttps\Init;
class CreatorCommand extends Command
{
protected static $defaultName = 'HTTPS:Certificate Generator';
protected function configure()
{
$this
->setName('create')
->addArgument("domain", InputArgument::REQUIRED, 'Add a custom domain name defualt domain is localhost')
->setDescription('Creates a new certificate.')
->setHelp('This command allows you to create a root certificate...');
$this
->addOption(
'a',
null,
InputOption::VALUE_NONE,
// 'This will add your root certificate on your OS trusted list?'
'Config your certificate for trust policy.'
);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$domain = $input->getArgument('domain');
$init = new Init($domain);
$sign = $init->make($domain);
if ($sign == 0) {
$output->writeln('<error>Domain already exist!</error>');
} else {
$msg = exec("ls ".__DIR__."/../cert");
$output->writeln("<info>Certificate created successfully!</info>");
}
return 0;
}
}