Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use prompt_toolkit to enable keyboard navigation in CLI #4649

Merged
merged 3 commits into from
Jun 11, 2023

Conversation

erik-megarad
Copy link
Contributor

Background

Keyboard arrow keys and shortcuts don't work in the CLI. We can use a library to help.

I saw #2838 but it's a super old branch so I started a new PR that has the smallest possible change.

This enables:

  • Left/right arrow to go back/forwards on the current line.
  • Keyboard shortcuts (e.g. to go back to the start of the line press ^a on mac/linux)
  • History (press up arrow to cycle through previous commands)

If we want in the future we can do autocomplete and stuff, but this is the smallest change with the biggest benefit.

Changes

  • Use prompt_toolkit over input

Documentation

No user change except it will be less annoying

Test Plan

  • Updated the mock in challenges
  • Tested manually on mac and linux (don't have a windows box but it's cross platform)

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes.
  • I have run the following commands against my code to ensure it passes our linters:
    black .
    isort .
    mypy
    autoflake --remove-all-unused-imports --recursive --ignore-init-module-imports --ignore-pass-after-docstring autogpt tests --in-place

@vercel
Copy link

vercel bot commented Jun 11, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview Jun 11, 2023 9:14pm

@github-actions github-actions bot added size/m and removed size/s labels Jun 11, 2023
@vercel vercel bot temporarily deployed to Preview June 11, 2023 05:36 Inactive
@codecov
Copy link

codecov bot commented Jun 11, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (bc5dbb6) 69.98% compared to head (5dac0b6) 70.01%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4649      +/-   ##
==========================================
+ Coverage   69.98%   70.01%   +0.02%     
==========================================
  Files          72       72              
  Lines        3595     3598       +3     
  Branches      572      572              
==========================================
+ Hits         2516     2519       +3     
  Misses        895      895              
  Partials      184      184              
Impacted Files Coverage Δ
autogpt/utils.py 62.62% <100.00%> (+1.16%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ariel-frischer
Copy link

This works for me on my mac os 🙏🏽.

@waynehamadi waynehamadi merged commit fd04db1 into Significant-Gravitas:master Jun 11, 2023
@Pwuts Pwuts added this to the v0.4.1 Release milestone Jun 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants