diff kitten: add options to ignore paths when comparing directories

Tested locally & over SSH:

    $ kitty +kitten diff /local/path /local/path2
    $ kitty +kitten diff /local/path ssh:remote:/path
This commit is contained in:
Suvayu Ali
2022-06-05 00:02:13 +02:00
parent a42200a430
commit fbf1ec43c7
6 changed files with 37 additions and 2 deletions

2
kittens/diff/main.py Normal file → Executable file
View File

@@ -655,6 +655,8 @@ def main(args: List[str]) -> None:
opts = init_config(cli_opts)
set_diff_command(opts.diff_cmd)
lines_for_path.replace_tab_by = opts.replace_tab_by
Collection.file_ignores = opts.file_ignores
Collection.ignore_paths = opts.ignore_paths
left, right = map(get_remote_file, (left, right))
if os.path.isdir(left) != os.path.isdir(right):
raise SystemExit('The items to be diffed should both be either directories or files. Comparing a directory to a file is not valid.')