diff --git a/pubs/commands/doc_cmd.py b/pubs/commands/doc_cmd.py index 5cdd84d..daa13c0 100644 --- a/pubs/commands/doc_cmd.py +++ b/pubs/commands/doc_cmd.py @@ -105,7 +105,7 @@ def command(conf, args): if not path.endswith('/'): path += '/' else: - ui.error('{} is not a directory. Quit.'.format( + ui.error('{} is not a directory.'.format( color.dye_err(args.path[0], 'filepath'))) ui.exit(1) @@ -130,7 +130,7 @@ def command(conf, args): paper = rp.pull_paper(citekey) if paper.docpath is None: - ui.error('No document associated with the entry {}. Quit.'.format( + ui.error('No document associated with the entry {}.'.format( color.dye_err(citekey, 'citekey'))) ui.exit() diff --git a/pubs/commands/rename_cmd.py b/pubs/commands/rename_cmd.py index e87daec..abe9fd6 100644 --- a/pubs/commands/rename_cmd.py +++ b/pubs/commands/rename_cmd.py @@ -1,4 +1,5 @@ from ..uis import get_ui +from .. import color from .. import repo from ..utils import resolve_citekey @@ -24,3 +25,6 @@ def command(conf, args): key = resolve_citekey(repo=rp, citekey=args.citekey, ui=ui, exit_on_fail=True) paper = rp.pull_paper(key) rp.rename_paper(paper, args.new_citekey) + ui.message("The '{}' citekey has been renamed into '{}'".format( + color.dye_out(args.citekey, 'citekey'), + color.dye_out(args.new_citekey, 'citekey'))) diff --git a/pubs/uis.py b/pubs/uis.py index 23bc548..47b973e 100644 --- a/pubs/uis.py +++ b/pubs/uis.py @@ -69,8 +69,8 @@ class PrintUI(object): print(*messages, **kwargs) def info(self, message, **kwargs): - kwargs['file'] = self._stderr - print(u'{}: {}'.format(color.dye_err('info', 'ok'), message), **kwargs) + kwargs['file'] = self._stdout + print(u'{}: {}'.format(color.dye_out('info', 'ok'), message), **kwargs) def warning(self, message, **kwargs): kwargs['file'] = self._stderr diff --git a/pubs/utils.py b/pubs/utils.py index 381f1b5..2af0fa2 100644 --- a/pubs/utils.py +++ b/pubs/utils.py @@ -16,12 +16,12 @@ def resolve_citekey(repo, citekey, ui=None, exit_on_fail=True): elif len(citekeys) == 1: if citekeys[0] != citekey: if ui is not None: - ui.info("Provided citekey '{}' has been autocompleted into [{}].".format(color.dye_out(citekey, 'citekey'), color.dye_out(citekeys[0], 'citekey'))) + ui.info("'{}' has been autocompleted into '{}'.".format(color.dye_out(citekey, 'citekey'), color.dye_out(citekeys[0], 'citekey'))) citekey = citekeys[0] elif citekey not in citekeys: if ui is not None: citekeys = sorted(citekeys) - ui.error("Be more specific; Provided citekey '{}' matches multiples citekeys:".format( + ui.error("Be more specific; '{}' matches multiples citekeys:".format( citekey)) for c in citekeys: p = repo.pull_paper(c) diff --git a/tests/test_usecase.py b/tests/test_usecase.py index 191fed2..fafae4f 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -363,6 +363,7 @@ class TestUsecase(DataCommandTestCase): '\n', '', 'network search\n', + 'info: Assuming search to be a tag.\n' '[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) | network,search\n', ] @@ -508,7 +509,7 @@ class TestUsecase(DataCommandTestCase): 'pubs tag junk' ] outs = self.execute_cmds(cmds) - self.assertEqual(1, len(outs[2].splitlines())) + self.assertEqual(2, len(outs[2].splitlines())) def test_doc_open(self): cmds = ['pubs init',