mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 14:55:00 +00:00
aider: Added __init__ function to Commands class to assign console to self.console.
# Context: USER: pass the console into do_run and into each cmd_ function. ASSISTANT: To pass the `console` object into the `do_run` method and each `cmd_` function, we need to modify the `do_run` method and update the `cmd_help` and `cmd_ls` methods to accept the `console` parameter. Here are the changes to the `aider ^C KeyboardInterrupt USER: add an __init__ function which takes the console and assigns it to self.console ASSISTANT: To add an `__init__` function that takes the `console` parameter and assigns it to `self.console`, we need to modify the `Commands` class in the `aider/commands.py` file. Here are the changes to the `aider/commands.py` file: ```python aider/commands.py <<<<<<< ORIGINAL class Commands: ======= class Commands: def __init__(self, console): self.console = console >>>>>>> UPDATED ``` Now, you can use `self.console` in the `Commands` class methods instead of passing the `console` parameter to each method.
This commit is contained in:
parent
e33ee46fe1
commit
c368737e70
1 changed files with 2 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
|
||||
class Commands:
|
||||
def __init__(self, console):
|
||||
self.console = console
|
||||
def cmd_help(self, args):
|
||||
print('help')
|
||||
def cmd_ls(self, args):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue