Skip to content

Commit

Permalink
Merge pull request #110 from andrewwhitehead/print-version
Browse files Browse the repository at this point in the history
Add -v option to aca-py executable to print version
  • Loading branch information
nrempel authored Aug 1, 2019
2 parents a876e88 + 1f01a14 commit f9c03bf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion aries_cloudagent/commands/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from argparse import ArgumentParser
from typing import Sequence

from ..version import __version__


def execute(argv: Sequence[str] = None):
"""Execute the help command."""
Expand All @@ -12,11 +14,21 @@ def execute(argv: Sequence[str] = None):
subparsers = parser.add_subparsers()
for cmd in available_commands():
if cmd["name"] == "help":
parser.add_argument(
"-v",
"--version",
action="store_true",
help="print application version and exit",
)
continue
module = load_command(cmd["name"])
subparser = subparsers.add_parser(cmd["name"], help=cmd["summary"])
module.init_argument_parser(subparser)
parser.print_help()
args = parser.parse_args()
if args.version:
print(__version__)
else:
parser.print_help()


if __name__ == "__main__":
Expand Down

0 comments on commit f9c03bf

Please sign in to comment.