Repository: benchopt/benchopt (python)

Issue:
benchopt autocomplete for file now outputs the full file path
example:


![image](https://user-images.githubusercontent.com/8993218/170273526-90f9dd8b-9fd9-4f2b-a0a5-8f994d7f6089.png)


I find it a bit long, before it was just the relative file path and that was friendlier to me

Pull request description:
FIX autocompletion for paths
fix #410 

Patch:
diff --git a/benchopt/cli/completion.py b/benchopt/cli/completion.py
index 5f416cf..7546d31 100644
--- a/benchopt/cli/completion.py
+++ b/benchopt/cli/completion.py
@@ -81,7 +81,13 @@ def complete_output_files(ctx, param, incomplete):
     if benchmark is None:
         return []
     output_folder = benchmark.get_output_folder()
-    candidates = list(output_folder.glob('*.csv'))
+
+    # Only use absolute path to make sure we can use relative_to to
+    # autocompletion with relative paths
+    cwd = Path().resolve()
+    candidates = [
+        p.resolve().relative_to(cwd) for p in output_folder.glob('*.csv')
+    ]
     return propose_from_list(candidates, incomplete)
 
 
@@ -92,7 +98,13 @@ def complete_config_files(ctx, param, incomplete):
     if benchmark is None:
         return []
     benchmark_folder = benchmark.benchmark_dir
-    candidates = list(benchmark_folder.glob('*.yml'))
+
+    # Only use absolute path to make sure we can use relative_to to
+    # autocompletion with relative paths
+    cwd = Path().resolve()
+    candidates = [
+        p.resolve().relative_to(cwd) for p in benchmark_folder.glob('*.yml')
+    ]
     return propose_from_list(candidates, incomplete)
 
 


Test patch:
diff --git a/benchopt/tests/test_cli.py b/benchopt/tests/test_cli.py
index c99d199..bbdf497 100644
--- a/benchopt/tests/test_cli.py
+++ b/benchopt/tests/test_cli.py
@@ -419,6 +419,7 @@ class TestPlotCmd:
         assert len(result_files) == 1, out.output
         result_file = result_files[0]
         cls.result_file = result_file
+        cls.result_file = str(Path(result_file).relative_to(Path().resolve()))
 
     @classmethod
     def teardown_class(cls):