Skip to content

Commit 4a7f491

Browse files
committed
Add --version flag
1 parent c981a5a commit 4a7f491

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jgo/jgo.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import traceback
1212
import zipfile
1313

14+
from .version_info import _version as version
15+
1416
# A script to execute a main class of a Maven artifact
1517
# which is available locally or from Maven Central.
1618
#
@@ -246,6 +248,7 @@ def jgo_parser():
246248
parser.add_argument( '--additional-endpoints', nargs='+', help='Add additional endpoints', default=[], required=False)
247249
parser.add_argument('--ignore-jgorc', action='store_true', help='Ignore ~/.jgorc')
248250
parser.add_argument('--link-type', default=None, type=str, help='How to link from local maven repository into jgo cache. Defaults to the `links\' setting in ~/.jrunrc or \'auto\' if not specified.', choices=('hard', 'soft', 'copy', 'auto'))
251+
parser.add_argument('--version', action='version', version=str(version))
249252

250253
return parser
251254

@@ -513,7 +516,7 @@ def run(parser, argv=sys.argv[1:], stdout=None, stderr=None):
513516

514517
endpoint_index = find_endpoint(argv, shortcuts)
515518
if endpoint_index == -1:
516-
raise HelpRequested(argv) if '-h' in argv or '--help' in argv else NoEndpointProvided(argv)
519+
raise HelpRequested(argv) if any(arg in argv for arg in ('--help', '-h', '--version')) else NoEndpointProvided(argv)
517520

518521
args, unknown = parser.parse_known_args(argv[:endpoint_index])
519522
jvm_args = unknown if unknown else []

0 commit comments

Comments
 (0)