|
17 | 17 | @options.shed_owner_option()
|
18 | 18 | @options.shed_name_option()
|
19 | 19 | @options.shed_target_option()
|
| 20 | +@click.option( |
| 21 | + "-o", "--output", |
| 22 | + type=click.Path(file_okay=True, resolve_path=True), |
| 23 | + help="Send diff output to specified file.", |
| 24 | + default=None, |
| 25 | +) |
20 | 26 | @click.option(
|
21 | 27 | '--shed_target_source',
|
22 | 28 | help="Source Tool Shed to diff against (will ignore local project info"
|
@@ -55,7 +61,10 @@ def diff_in(ctx, working, path, **kwds):
|
55 | 61 | shed_target_source = kwds.get("shed_target_source", None)
|
56 | 62 |
|
57 | 63 | label_a = "_%s_" % (shed_target_source if shed_target_source else "local")
|
58 |
| - label_b = "_%s_" % kwds.get("shed_target", "B") |
| 64 | + shed_target = kwds.get("shed_target", "B") |
| 65 | + if "/" in shed_target: |
| 66 | + shed_target = "custom_shed" |
| 67 | + label_b = "_%s_" % shed_target |
59 | 68 |
|
60 | 69 | mine = os.path.join(working, label_a)
|
61 | 70 | other = os.path.join(working, label_b)
|
@@ -87,4 +96,7 @@ def diff_in(ctx, working, path, **kwds):
|
87 | 96 | cmd_template = 'mkdir "%s"; tar -xzf "%s" -C "%s"; rm -rf %s'
|
88 | 97 | shell(cmd_template % (mine, tar_path, mine, tar_path))
|
89 | 98 |
|
90 |
| - shell('cd "%s"; diff -r %s %s' % (working, label_a, label_b)) |
| 99 | + cmd = 'cd "%s"; diff -r %s %s' % (working, label_a, label_b) |
| 100 | + if kwds["output"]: |
| 101 | + cmd += "> '%s'" % kwds["output"] |
| 102 | + shell(cmd) |
0 commit comments