• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Cecilapp / Cecil / 5045835811

pending completion
5045835811

Pull #1697

github

GitHub
Merge c3e3c7443 into a16355c73
Pull Request #1697: perf: native_function_invocation

321 of 321 new or added lines in 62 files covered. (100.0%)

2784 of 4121 relevant lines covered (67.56%)

0.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Command/OpenWith.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of Cecil.
7
 *
8
 * Copyright (c) Arnaud Ligny <arnaud@ligny.fr>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13

14
namespace Cecil\Command;
15

16
use Cecil\Exception\RuntimeException;
17
use Cecil\Util;
18
use Symfony\Component\Console\Input\InputArgument;
19
use Symfony\Component\Console\Input\InputDefinition;
20
use Symfony\Component\Console\Input\InputInterface;
21
use Symfony\Component\Console\Input\InputOption;
22
use Symfony\Component\Console\Output\OutputInterface;
23

24
/**
25
 * Open pages with an editor.
26
 */
27
class OpenWith extends AbstractCommand
28
{
29
    /**
30
     * {@inheritdoc}
31
     */
32
    protected function configure()
33
    {
34
        $this
×
35
            ->setName('open')
×
36
            ->setDescription('Open pages directory with the editor')
×
37
            ->setDefinition(
×
38
                new InputDefinition([
×
39
                    new InputArgument('path', InputArgument::OPTIONAL, 'Use the given path as working directory'),
×
40
                    new InputOption('editor', null, InputOption::VALUE_REQUIRED, 'Editor to use'),
×
41
                ])
×
42
            )
×
43
            ->setHelp('Open pages directory with the editor defined in the configuration file.');
×
44
    }
45

46
    /**
47
     * {@inheritdoc}
48
     *
49
     * @throws RuntimeException
50
     */
51
    protected function execute(InputInterface $input, OutputInterface $output)
52
    {
53
        try {
54
            if (null === $editor = $input->getOption('editor')) {
×
55
                if (!$this->getBuilder()->getConfig()->has('editor')) {
×
56
                    $output->writeln('<comment>No editor configured.</comment>');
×
57

58
                    return 0;
×
59
                }
60
                $editor = (string) $this->getBuilder()->getConfig()->get('editor');
×
61
            }
62
            $output->writeln(sprintf('<info>Opening pages directory with %s...</info>', ucfirst($editor)));
×
63
            $this->openEditor(Util::joinFile($this->getPath(), (string) $this->getBuilder()->getConfig()->get('pages.dir')), $editor);
×
64
        } catch (\Exception $e) {
×
65
            throw new RuntimeException(sprintf($e->getMessage()));
×
66
        }
67

68
        return 0;
×
69
    }
70
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc