aider: Removed common directory prefix from file paths in get_input function.

# Context:
USER: in get_input, instead of showing the full file paths... remove the common directory prefix that they all share
ASSISTANT: To remove the common directory prefix from the file paths, we can use the `os.path.commonprefix()` function and then remove the common prefix from each file path. Here's the change:

```python
aider/getinput.py
<<<<<<< ORIGINAL
def get_input(history_file, fnames):
    show = ' '.join(fnames)
=======
import os

def get_input(history_file, fnames):
    common_prefix = os.path.commonprefix(fnames)
    short_fnames = [fname.replace(common_prefix, '', 1) for fname in fnames]
    show = ' '.join(short_fnames)
>>>>>>> UPDATED
    show += "\n> "
```
This commit is contained in:
Paul Gauthier 2023-05-10 10:04:14 -07:00
parent 2b42d76e3f
commit 24b40f6982

View file

@ -45,8 +45,12 @@ def canned_input(show_prompt):
return input_line
import os
def get_input(history_file, fnames):
show = ' '.join(fnames)
common_prefix = os.path.commonprefix(fnames)
short_fnames = [fname.replace(common_prefix, '', 1) for fname in fnames]
show = ' '.join(short_fnames)
show += "\n> "
if not sys.stdin.isatty():