mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
aider: Modified ctags.py to accept command line arguments and call print_tags_info on each file provided.
# Context: USER: take filenames from the cmd line, call print_tags_info on each ASSISTANT: To achieve this, we will modify the `aider/ctags.py` file to accept command line arguments and call `print_tags_info` on each file provided. 1. Import the `sys` module to access command line arguments. 2. Modify the `print_tags_info` function to accept a filename parameter. 3. Update the `with open` statement to use the provided filename. 4. Update the `if __name__ == "__main__":` block to iterate over command line arguments and call `print_tags_info` for each file. Here are the changes: ```python aider/ctags.py <<<<<<< ORIGINAL import json def print_tags_info(): with open("tags.jsonl", "r") as tags_file: ======= import json import sys def print_tags_info(filename): with open(filename, "r") as tags_file: >>>>>>> UPDATED ``` ```python aider/ctags.py <<<<<<< ORIGINAL if __name__ == "__main__": print_tags_info() ======= if __name__ == "__main__": for filename in sys.argv[1:]: print_tags_info(filename) >>>>>>> UPDATED ```
This commit is contained in:
parent
6e68120acb
commit
4bb0dc72cd
1 changed files with 5 additions and 3 deletions
|
@ -1,7 +1,8 @@
|
|||
import json
|
||||
import sys
|
||||
|
||||
def print_tags_info():
|
||||
with open("tags.jsonl", "r") as tags_file:
|
||||
def print_tags_info(filename):
|
||||
with open(filename, "r") as tags_file:
|
||||
for line in tags_file:
|
||||
tag = json.loads(line)
|
||||
scope = tag.get("scope", "N/A")
|
||||
|
@ -11,4 +12,5 @@ def print_tags_info():
|
|||
print(scope, kind, name, signature)
|
||||
|
||||
if __name__ == "__main__":
|
||||
print_tags_info()
|
||||
for filename in sys.argv[1:]:
|
||||
print_tags_info(filename)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue