michaeljabbour / michaeljabbour/altairbasic

Implement Enhanced CLI and Command History

Open
#5 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

# 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the interaction loop in src/main.cpp, then inspect I/O handling in src/io/io_system.cpp and platform behavior in src/platform/platform.cpp. Research a cross-platform line-editing library and determine how it fits the CMake dependency setup. Done means the CLI supports history, editing, completion, highlighting, multiline input, and persisted history with graceful behavior across Windows, macOS, and Linux.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
cli, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.