option to print only the version of a package
Example: $ pbr info -s pkgname 1.2.3 Change-Id: Ic66848dbe44ed946800979fb73776ab6d00869f6 Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
This commit is contained in:
parent
e4c7dba0bd
commit
c715db6df9
|
@ -40,8 +40,11 @@ def get_sha(args):
|
|||
|
||||
|
||||
def get_info(args):
|
||||
print("{name}\t{version}\t{released}\t{sha}".format(
|
||||
**_get_info(args.name)))
|
||||
if args.short:
|
||||
print("{version}".format(**_get_info(args.name)))
|
||||
else:
|
||||
print("{name}\t{version}\t{released}\t{sha}".format(
|
||||
**_get_info(args.name)))
|
||||
|
||||
|
||||
def _get_info(name):
|
||||
|
@ -98,6 +101,8 @@ def main():
|
|||
'info', help='print version info for package')
|
||||
cmd_info.set_defaults(func=get_info)
|
||||
cmd_info.add_argument('name', help='package to print info of')
|
||||
cmd_info.add_argument('-s', '--short', action="store_true",
|
||||
help='only display package version')
|
||||
|
||||
cmd_freeze = subparsers.add_parser(
|
||||
'freeze', help='print version info for all installed packages')
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
Add an option to print only the version of a package
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ pbr info -s pkgname
|
||||
1.2.3
|
Loading…
Reference in New Issue