Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit deca33e

Browse files
Merge pull request #33 from bakfile:ChanceNCounter/bak-diff-using-program
Closes #32
2 parents 3bf5b32 + 809dfe6 commit deca33e

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

bak/__main__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ def bak_off(filename, quietly):
6565

6666

6767
@bak.command("show", help="View a .bakfile in an external program")
68-
@click.option("--using", "--in", help="Program to open (default: $PAGER or less)", required=False)
68+
@click.option("--using", "--in",
69+
help="Program to open (default: $PAGER or less)",
70+
required=False)
6971
@click.argument("filename", required=True, type=click.Path(exists=True))
7072
def bak_print(filename, using):
7173
commands.bak_print_cmd(filename, using)
@@ -83,9 +85,12 @@ def bak_get(to_where_you_once_belonged):
8385

8486

8587
@bak.command("diff")
88+
@click.option("--using", "--in",
89+
help="Program to use instead of system diff",
90+
required=False)
8691
@click.argument("filename", required=True, type=click.Path(exists=True))
87-
def bak_diff(filename):
88-
commands.bak_diff_cmd(filename)
92+
def bak_diff(filename, using):
93+
commands.bak_diff_cmd(filename, command=using)
8994

9095

9196
if __name__ == "__main__":

bak/commands/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ def bak_getfile_cmd(bak_to_get: (str, bakfile.BakFile)):
247247
click.echo(bak_to_get.bakfile_loc)
248248

249249

250-
def bak_diff_cmd(filename):
251-
# TODO configurable diff executable
250+
def bak_diff_cmd(filename, command='diff'):
251+
# TODO write tests for this (mildly tricky)
252252
bak_to_diff = _get_bakfile_entry(expandpath(filename))
253-
call(['diff', bak_to_diff.bakfile_loc, bak_to_diff.orig_abspath])
253+
call([command if command else 'diff',
254+
bak_to_diff.bakfile_loc, bak_to_diff.orig_abspath])

0 commit comments

Comments
 (0)