mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-27 15:55:00 +00:00
wip: Refactor get_input to handle single file input.
This commit is contained in:
parent
24b40f6982
commit
000c917302
1 changed files with 10 additions and 3 deletions
|
@ -1,4 +1,7 @@
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from prompt_toolkit.styles import Style
|
from prompt_toolkit.styles import Style
|
||||||
|
|
||||||
from prompt_toolkit import prompt
|
from prompt_toolkit import prompt
|
||||||
|
@ -45,11 +48,15 @@ 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):
|
||||||
|
fnames = list(fnames)
|
||||||
|
if len(fnames) > 1:
|
||||||
common_prefix = os.path.commonprefix(fnames)
|
common_prefix = os.path.commonprefix(fnames)
|
||||||
short_fnames = [fname.replace(common_prefix, '', 1) for fname in fnames]
|
short_fnames = [fname.replace(common_prefix, '', 1) for fname in fnames]
|
||||||
|
else:
|
||||||
|
short_fnames = [Path(fnames[0]).name]
|
||||||
|
|
||||||
show = ' '.join(short_fnames)
|
show = ' '.join(short_fnames)
|
||||||
show += "\n> "
|
show += "\n> "
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue