Skip to content

Implement Enhanced CLI and Command History #5

Description

@michaeljabbour

Implement Enhanced CLI and Command History

Issue Description

The current command-line interface (CLI) for the interpreter is basic and lacks features that would improve user experience, particularly in interactive mode. Adding command history, line editing, and other modern CLI features would make the interpreter more usable.

Desired Features

  1. Command History: Allow navigating through previously entered commands using up/down arrows
  2. Line Editing: Enable editing the current line with left/right arrow keys, backspace, delete, etc.
  3. Auto-completion: Provide tab completion for BASIC keywords and variables
  4. Syntax Highlighting: Add basic colorization of code elements
  5. Multi-line Editing: Support for editing multi-line statements
  6. Save/Load History: Persist command history between sessions

Technical Approach

  1. Integrate a library like GNU Readline, libedit, or a cross-platform alternative
  2. Implement a history manager that saves and restores command history
  3. Add syntax highlighting using ANSI escape sequences
  4. Create an auto-completion engine for BASIC keywords and context-aware completion

Platform Considerations

  • Ensure functionality works across Windows, macOS, and Linux
  • Handle terminal differences appropriately
  • Provide graceful fallback for environments that don't support all features

Implementation Steps

  1. Research available libraries for line editing (readline, libedit, etc.)
  2. Add the selected library as a dependency in CMake
  3. Create a CLI wrapper class to handle terminal interaction
  4. Implement history management with file storage
  5. Add syntax highlighting for BASIC keywords
  6. Implement auto-completion logic

Priority

Medium - This enhances usability but isn't critical for core functionality

Related Components

  • src/main.cpp - Main interaction loop
  • src/io/io_system.cpp - I/O handling
  • src/platform/platform.cpp - Platform-specific terminal features

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions