Add examples to the sub-commands
@@ -151,25 +151,25 @@ class ConfigurationCommand(Command):
)
def list_values(self, options, args):
- self._get_n_args(args, n=0)
+ self._get_n_args(args, "list", n=0)
for key, value in sorted(self.configuration.items()):
logger.info("%s=%r", key, value)
def get_name(self, options, args):
- key = self._get_n_args(args, n=1)
+ key = self._get_n_args(args, "get [name]", n=1)
value = self.configuration.get_value(key)
logger.info("%s", value)
def set_name_value(self, options, args):
- key, value = self._get_n_args(args, n=2)
+ key, value = self._get_n_args(args, "set [name] [value]", n=2)
self.configuration.set_value(key, value)
self._save_configuration()
def unset_name(self, options, args):
- key = self._get_n_args(args, n=1)
+ key = self._get_n_args(args, "unset [name]", n=1)
self.configuration.unset_value(key)
self._save_configuration()
@@ -189,13 +189,13 @@ class ConfigurationCommand(Command):
.format(e.returncode)
)
- def _get_n_args(self, args, n, example):
+ def _get_n_args(self, args, example, n):
"""Helper to make sure the command got the right number of arguments
"""
if len(args) != n:
msg = (
'Got unexpected number of arguments, expected {}. '
- '(example: "{} {}")'
+ '(example: "{} config {}")'
).format(n, get_prog(), example)
raise PipError(msg)
