Skip to content

Commit 23dbbb7

Browse files
committed
Add --resolve-only option
When the option is provided, only the workspace is created and the location is printed to the command line. This can then be used, for example, as classpath for another tool. ```shell $ jgo --resolve-only org.scijava:parsington /home/hanslovskyp/.jgo/org/scijava/parsington/RELEASE $ ls /home/hanslovskyp/.jgo/org/scijava/parsington/RELEASE mainClass parsington-1.0.4.jar pom.xml ``` This is experimental (for now) but might be merged at some point in the future
1 parent 142796f commit 23dbbb7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

jgo/jgo.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ def jgo_parser():
246246
parser.add_argument( '--additional-endpoints', nargs='+', help='Add additional endpoints', default=[], required=False)
247247
parser.add_argument('--ignore-jgorc', action='store_true', help='Ignore ~/.jgorc')
248248
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'))
249+
parser.add_argument('--resolve-only', action='store_true', help='Only resolve dependencies and print workspace location. Will not run any code.', required=False)
249250

250251
return parser
251252

@@ -551,6 +552,12 @@ def run(parser, argv=sys.argv[1:], stdout=None, stderr=None):
551552
shortcuts = shortcuts,
552553
verbose = args.verbose,
553554
link_type = link_type)
555+
if args.resolve_only:
556+
print(workspace)
557+
class MockObject(object):
558+
def check_returncode(self):
559+
pass
560+
return MockObject()
554561

555562
main_class_file = os.path.join(workspace, primary_endpoint.main_class, 'mainClass') if primary_endpoint.main_class else os.path.join(workspace, 'mainClass')
556563

0 commit comments

Comments
 (0)