mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
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:
parent
2b42d76e3f
commit
24b40f6982
1 changed files with 5 additions and 1 deletions
|
@ -45,8 +45,12 @@ def canned_input(show_prompt):
|
||||||
return input_line
|
return input_line
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
def get_input(history_file, fnames):
|
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> "
|
show += "\n> "
|
||||||
|
|
||||||
if not sys.stdin.isatty():
|
if not sys.stdin.isatty():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue