diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2017-07-30 08:31:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-30 08:31:04 +0200 |
commit | 882da5c5eb283cbc7a869182b26a69b8fbebda2b (patch) | |
tree | aae7d4b497a77a1b2eeb5b82c1a0f2d56865e64b /src/Wallabag/CoreBundle/Command/TagAllCommand.php | |
parent | 4fc7eba34904a062cddf1e61956c48f27cb2e06c (diff) | |
parent | e1b33efb3dd7c9ebb4dcfb23a2ca5efbda0a05f6 (diff) | |
download | wallabag-882da5c5eb283cbc7a869182b26a69b8fbebda2b.tar.gz wallabag-882da5c5eb283cbc7a869182b26a69b8fbebda2b.tar.zst wallabag-882da5c5eb283cbc7a869182b26a69b8fbebda2b.zip |
Merge pull request #3297 from nclsHart/commands-better-rendering
Better rendering for all core commands
Diffstat (limited to 'src/Wallabag/CoreBundle/Command/TagAllCommand.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Command/TagAllCommand.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Wallabag/CoreBundle/Command/TagAllCommand.php b/src/Wallabag/CoreBundle/Command/TagAllCommand.php index 9843674e..4afac2d4 100644 --- a/src/Wallabag/CoreBundle/Command/TagAllCommand.php +++ b/src/Wallabag/CoreBundle/Command/TagAllCommand.php | |||
@@ -7,6 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | |||
7 | use Symfony\Component\Console\Input\InputArgument; | 7 | use Symfony\Component\Console\Input\InputArgument; |
8 | use Symfony\Component\Console\Input\InputInterface; | 8 | use Symfony\Component\Console\Input\InputInterface; |
9 | use Symfony\Component\Console\Output\OutputInterface; | 9 | use Symfony\Component\Console\Output\OutputInterface; |
10 | use Symfony\Component\Console\Style\SymfonyStyle; | ||
10 | 11 | ||
11 | class TagAllCommand extends ContainerAwareCommand | 12 | class TagAllCommand extends ContainerAwareCommand |
12 | { | 13 | { |
@@ -25,21 +26,22 @@ class TagAllCommand extends ContainerAwareCommand | |||
25 | 26 | ||
26 | protected function execute(InputInterface $input, OutputInterface $output) | 27 | protected function execute(InputInterface $input, OutputInterface $output) |
27 | { | 28 | { |
29 | $io = new SymfonyStyle($input, $output); | ||
30 | |||
28 | try { | 31 | try { |
29 | $user = $this->getUser($input->getArgument('username')); | 32 | $user = $this->getUser($input->getArgument('username')); |
30 | } catch (NoResultException $e) { | 33 | } catch (NoResultException $e) { |
31 | $output->writeln(sprintf('<error>User "%s" not found.</error>', $input->getArgument('username'))); | 34 | $io->error(sprintf('User "%s" not found.', $input->getArgument('username'))); |
32 | 35 | ||
33 | return 1; | 36 | return 1; |
34 | } | 37 | } |
35 | $tagger = $this->getContainer()->get('wallabag_core.rule_based_tagger'); | 38 | $tagger = $this->getContainer()->get('wallabag_core.rule_based_tagger'); |
36 | 39 | ||
37 | $output->write(sprintf('Tagging entries for user « <comment>%s</comment> »... ', $user->getUserName())); | 40 | $io->text(sprintf('Tagging entries for user <info>%s</info>...', $user->getUserName())); |
38 | 41 | ||
39 | $entries = $tagger->tagAllForUser($user); | 42 | $entries = $tagger->tagAllForUser($user); |
40 | 43 | ||
41 | $output->writeln('<info>Done.</info>'); | 44 | $io->text('Persist entries... '); |
42 | $output->write(sprintf('Persist entries ... ', $user->getUserName())); | ||
43 | 45 | ||
44 | $em = $this->getDoctrine()->getManager(); | 46 | $em = $this->getDoctrine()->getManager(); |
45 | foreach ($entries as $entry) { | 47 | foreach ($entries as $entry) { |
@@ -47,7 +49,9 @@ class TagAllCommand extends ContainerAwareCommand | |||
47 | } | 49 | } |
48 | $em->flush(); | 50 | $em->flush(); |
49 | 51 | ||
50 | $output->writeln('<info>Done.</info>'); | 52 | $io->success('Done.'); |
53 | |||
54 | return 0; | ||
51 | } | 55 | } |
52 | 56 | ||
53 | /** | 57 | /** |