Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit 48e8093

Browse files
committed
Now the executable runs the console application
1 parent 6cf9cd2 commit 48e8093

File tree

6 files changed

+96
-8
lines changed

6 files changed

+96
-8
lines changed

composer.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
"license": "MIT",
66
"require": {
77
"php": "5.*,>=5.5.9",
8-
"symfony/console": "~2.8"
9-
},
10-
"require-dev": {
11-
"kherge/box": "~2.4"
8+
"symfony/console": "~3.0"
129
},
10+
"require-dev": {},
1311
"autoload": {
1412
"psr-4": { "Litipk\\JupyterPhpInstaller\\": "src/"}
1513
},

src/Command/InfoCommand.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,32 @@
55

66

77
use Symfony\Component\Console\Command\Command;
8+
use Symfony\Component\Console\Input\InputArgument;
89
use Symfony\Component\Console\Input\InputInterface;
10+
use Symfony\Component\Console\Input\InputOption;
911
use Symfony\Component\Console\Output\OutputInterface;
1012

1113

1214
final class InfoCommand extends Command
1315
{
1416
protected function configure()
1517
{
16-
18+
$this
19+
->setName('info')
20+
->setDescription('Shows info about installed Jupyter-PHP kernels.')
21+
->setDefinition([
22+
new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details.'),
23+
new InputArgument(
24+
'path',
25+
InputArgument::OPTIONAL,
26+
'If is provided, then instead of looking for install paths, uses the given one.'
27+
)
28+
])
29+
->setHelp(
30+
"The <info>info</info> command looks for installed Jupyter-PHP kernels\n".
31+
"and shows info about them.\n\n".
32+
"<info>php jupyter-php-installer.phar info</info>\n\n"
33+
);
1734
}
1835

1936
protected function execute(InputInterface $input, OutputInterface $output)

src/Command/InstallCommand.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,38 @@
55

66

77
use Symfony\Component\Console\Command\Command;
8+
use Symfony\Component\Console\Input\InputArgument;
89
use Symfony\Component\Console\Input\InputInterface;
10+
use Symfony\Component\Console\Input\InputOption;
911
use Symfony\Component\Console\Output\OutputInterface;
1012

1113

1214
final class InstallCommand extends Command
1315
{
1416
protected function configure()
1517
{
16-
18+
$this
19+
->setName('install')
20+
->setDescription('Installs a Jupyter-PHP kernel.')
21+
->setDefinition([
22+
new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details.'),
23+
new InputArgument(
24+
'path',
25+
InputArgument::OPTIONAL,
26+
'This is the path where the Jupyter-PHP kernel will be installed.'
27+
),
28+
new InputArgument(
29+
'composer_cmd',
30+
InputArgument::OPTIONAL,
31+
'The installer will use this command to execute Composer.'
32+
)
33+
])
34+
->setHelp(
35+
"The <info>install</info> command installs a Jupyter-PHP kernel in your\n".
36+
"system and makes possible that Jupyter uses it to create \"PHP\n".
37+
"Notebooks\"\n\n".
38+
"<info>php jupyter-php-installer.phar install</info>\n\n"
39+
);
1740
}
1841

1942
protected function execute(InputInterface $input, OutputInterface $output)

src/Command/UninstallCommand.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,37 @@
55

66

77
use Symfony\Component\Console\Command\Command;
8+
use Symfony\Component\Console\Input\InputArgument;
89
use Symfony\Component\Console\Input\InputInterface;
10+
use Symfony\Component\Console\Input\InputOption;
911
use Symfony\Component\Console\Output\OutputInterface;
1012

1113

1214
final class UninstallCommand extends Command
1315
{
1416
protected function configure()
1517
{
16-
18+
$this
19+
->setName('uninstall')
20+
->setDescription('Uninstalls a Jupyter-PHP kernel.')
21+
->setDefinition([
22+
new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details.'),
23+
new InputArgument(
24+
'path',
25+
InputArgument::OPTIONAL,
26+
'This is the path where the Jupyter-PHP kernel is installed.'
27+
),
28+
new InputArgument(
29+
'composer_cmd',
30+
InputArgument::OPTIONAL,
31+
'The installer will use this command to execute Composer.'
32+
)
33+
])
34+
->setHelp(
35+
"The <info>uninstall</info> command uninstalls a Jupyter-PHP kernel from your\n".
36+
"system.\n\n".
37+
"<info>php jupyter-php-installer.phar uninstall</info>\n\n"
38+
);
1739
}
1840

1941
protected function execute(InputInterface $input, OutputInterface $output)

src/Command/UpdateCommand.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,36 @@
55

66

77
use Symfony\Component\Console\Command\Command;
8+
use Symfony\Component\Console\Input\InputArgument;
89
use Symfony\Component\Console\Input\InputInterface;
10+
use Symfony\Component\Console\Input\InputOption;
911
use Symfony\Component\Console\Output\OutputInterface;
1012

1113

1214
final class UpdateCommand extends Command
1315
{
1416
protected function configure()
1517
{
16-
18+
$this
19+
->setName('update')
20+
->setDescription('Uninstalls a Jupyter-PHP kernel.')
21+
->setDefinition([
22+
new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details.'),
23+
new InputArgument(
24+
'path',
25+
InputArgument::OPTIONAL,
26+
'This is the path where the Jupyter-PHP kernel is installed.'
27+
),
28+
new InputArgument(
29+
'composer_cmd',
30+
InputArgument::OPTIONAL,
31+
'The installer will use this command to execute Composer.'
32+
)
33+
])
34+
->setHelp("The <info>update</info> command updates a previously installed Jupyter-PHP\n".
35+
"kernel.\n\n".
36+
"<info>php jupyter-php-installer.phar pdate</info>\n\n"
37+
);
1738
}
1839

1940
protected function execute(InputInterface $input, OutputInterface $output)

src/EntryPoint/main.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
#!/usr/bin/env php
22
<?php
33

4+
45
if ('cli' !== PHP_SAPI) {
56
echo 'Warning: This command should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
67
}
78

89
require_once __DIR__ . '/bootstrap.php';
910

11+
12+
use Litipk\JupyterPhpInstaller\Console\Application;
13+
14+
15+
$application = new Application();
16+
$application->run();

0 commit comments

Comments
 (0)