Hi, all !

Paul Wise :
>
> Package: diffoscope
> Severity: wishlist
> Tags: newcomer
>
> Please add argument completion. Using the Python 3 argcomplete module
> makes this relatively simple. This project can be used as an example:
>
> https://anonscm.debian.org/cgit/collab-maint/check-all-the-things.git/

Please find an attached patch which enables argument completion for diffoscope.
Looking forward to review and feedback.

Thanks!
Satyam Zode
From 50dffe772b38355eb673994fdea49d9d74be7cac Mon Sep 17 00:00:00 2001
From: Satyam Zode <satyamz...@gmail.com>
Date: Sat, 11 Jun 2016 16:26:28 +0530
Subject: [PATCH] Added support for argument completion. Closes #826711

---
 bin/diffoscope         | 1 +
 debian/control         | 1 +
 diffoscope/__main__.py | 7 +++++++
 3 files changed, 9 insertions(+)

diff --git a/bin/diffoscope b/bin/diffoscope
index 2393807..2422b70 100755
--- a/bin/diffoscope
+++ b/bin/diffoscope
@@ -1,4 +1,5 @@
 #!/usr/bin/env python3
+# PYTHON_ARGCOMPLETE_OK
 # -*- coding: utf-8 -*-
 #
 # diffoscope: in-depth comparison of files, archives, and directories
diff --git a/debian/control b/debian/control
index 19619d7..733d3be 100644
--- a/debian/control
+++ b/debian/control
@@ -20,6 +20,7 @@ Build-Depends:
  python3-rpm,
  python3-setuptools,
  python3-tlsh (>= 3.4.1),
+ python3-argcomplete,
  vim-common,
 Standards-Version: 3.9.8
 Homepage: https://diffoscope.org/
diff --git a/diffoscope/__main__.py b/diffoscope/__main__.py
index ac7913c..ab3739f 100644
--- a/diffoscope/__main__.py
+++ b/diffoscope/__main__.py
@@ -1,4 +1,5 @@
 #!/usr/bin/env python3
+# PYTHON_ARGCOMPLETE_OK
 # -*- coding: utf-8 -*-
 #
 # diffoscope: in-depth comparison of files, archives, and directories
@@ -30,6 +31,10 @@ try:
     import tlsh
 except ImportError:
     tlsh = None
+try:
+    import argcomplete
+except ImportError:
+    argcomplete = None
 from diffoscope import logger, VERSION, set_locale, clean_all_temp_files
 import diffoscope.comparators
 from diffoscope.config import Config
@@ -89,6 +94,8 @@ def create_parser():
     parser.add_argument('file2', help='second file to compare')
     if not tlsh:
         parser.epilog = 'File renaming detection based on fuzzy-matching is currently disabled. It can be enabled by installing the “tlsh” module available at https://github.com/trendmicro/tlsh'
+    if argcomplete:
+        argcomplete.autocomplete(parser)
     return parser
 
 
-- 
1.9.1

_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to