adamghill / dj

Run commands with `dj {command_name}`. Use aliases defined in a simple config file or defaults to Django management commands.
MIT License
8 stars 0 forks source link

Expectations #2

Open adamghill opened 5 years ago

adamghill commented 5 years ago

Expectations are a way to look for text in a process's output and then send text back to the process.

Maybe defined on a per-command basis somewhat similar to the following in the .dj-config.json file:

"expectations":
[{
    "expect": "Password",
    "input": "p@ssw0rd!"
}]
adamghill commented 5 years ago

Renaming models fails because it misses the input.

(.venv) ➜  fake-dir git:(master) ✗ dj md
Running 'md' (./manage.py makemigrations && ./manage.py migrate)... failed. 😞
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "fake-dir/.venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "fake-dir/.venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "fake-dir/.venv/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "fake-dir/.venv/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "fake-dir/.venv/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "fake-dir/.venv/lib/python3.7/site-packages/django/core/management/commands/makemigrations.py", line 168, in handle
    migration_name=self.migration_name,
  File "fake-dir/.venv/lib/python3.7/site-packages/django/db/migrations/autodetector.py", line 43, in changes
    changes = self._detect_changes(convert_apps, graph)
  File "fake-dir/.venv/lib/python3.7/site-packages/django/db/migrations/autodetector.py", line 160, in _detect_changes
    self.generate_renamed_models()
  File "fake-dir/.venv/lib/python3.7/site-packages/django/db/migrations/autodetector.py", line 484, in generate_renamed_models
    if self.questioner.ask_rename_model(rem_model_state, model_state):
  File "fake-dir/.venv/lib/python3.7/site-packages/django/db/migrations/questioner.py", line 197, in ask_rename_model
    new_model_state.name), False)
  File "fake-dir/.venv/lib/python3.7/site-packages/django/db/migrations/questioner.py", line 87, in _boolean_input
    result = input("%s " % question)
EOFError: EOF when reading a line

Did you rename the fake_app.FakeModel model to NewFakeModel? [y/N]