Skip to content

Commit

Permalink
fix messages (UX)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrohel committed Feb 9, 2017
1 parent 12fb4c4 commit 97221a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions dnf/cli/commands/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ def onecmd(self, line):
cmd.cli.demands = copy.deepcopy(self.cli.demands)
cmd.configure()
cmd.run()
except:
pass
except Exception as e:
logger.error(_("Error:") + " " + e.value)
else:
self._help()

Expand Down Expand Up @@ -170,6 +170,9 @@ def _repo(self, args=None):
if r:
getattr(r, cmd)()
self.base.fill_sack()
else:
logger.critical(_("Error:") + " " + _("Unknown repo: '%s'"),
self.base.output.term.bold(repo))

def _resolve(self, args=None):
if self.cli.base.transaction is None:
Expand Down
5 changes: 3 additions & 2 deletions dnf/cli/option_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def _main_parser(self):
# has set something or whether we are getting a default.
main_parser = argparse.ArgumentParser(dnf.const.PROGRAM_NAME,
add_help=False)
main_parser._optionals.title = _("Optional arguments")
main_parser.add_argument("-c", "--config", dest="config_file_path",
default=None, metavar='[config file]',
help=_("config file location"))
Expand Down Expand Up @@ -327,8 +328,8 @@ def add_commands(self, cli_cmds, group):

def get_usage(self):
""" get the usage information to show the user. """
desc = {'main': _('List of Main Commands'),
'plugin': _('List of Plugin Commands')}
desc = {'main': _('List of Main Commands:'),
'plugin': _('List of Plugin Commands:')}
name = dnf.const.PROGRAM_NAME
usage = '%s [options] COMMAND\n' % name
for grp in ['main', 'plugin']:
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/test_option_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ def test_get_usage(self):
output = [
u'dnf [options] COMMAND',
u'',
u'List of Main Commands',
u'List of Main Commands:',
u'',
u'test-cmd summary',
u'',
u'List of Plugin Commands',
u'List of Plugin Commands:',
u'',
u'test-cmd2 summary2',
u'']
Expand Down

0 comments on commit 97221a9

Please sign in to comment.