aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Command/TagAllCommand.php
diff options
context:
space:
mode:
authorNicolas Hart <contact@nclshart.net>2017-07-29 00:30:22 +0200
committerNicolas Hart <contact@nclshart.net>2017-07-29 11:09:02 +0200
commite1b33efb3dd7c9ebb4dcfb23a2ca5efbda0a05f6 (patch)
treecc4a14dca4b1d533671c45b871d441308cdee545 /src/Wallabag/CoreBundle/Command/TagAllCommand.php
parent233eb91be4bd381ff48de0a15aff94415a3f2797 (diff)
downloadwallabag-e1b33efb3dd7c9ebb4dcfb23a2ca5efbda0a05f6.tar.gz
wallabag-e1b33efb3dd7c9ebb4dcfb23a2ca5efbda0a05f6.tar.zst
wallabag-e1b33efb3dd7c9ebb4dcfb23a2ca5efbda0a05f6.zip
Better rendering for all core commands
Diffstat (limited to 'src/Wallabag/CoreBundle/Command/TagAllCommand.php')
-rw-r--r--src/Wallabag/CoreBundle/Command/TagAllCommand.php14
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;
7use Symfony\Component\Console\Input\InputArgument; 7use Symfony\Component\Console\Input\InputArgument;
8use Symfony\Component\Console\Input\InputInterface; 8use Symfony\Component\Console\Input\InputInterface;
9use Symfony\Component\Console\Output\OutputInterface; 9use Symfony\Component\Console\Output\OutputInterface;
10use Symfony\Component\Console\Style\SymfonyStyle;
10 11
11class TagAllCommand extends ContainerAwareCommand 12class 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 /**