Skip to content

[cli] Add configuration system for REPL to set all items per line#208

Merged
forfudan merged 2 commits intodevfrom
cli
Apr 15, 2026
Merged

[cli] Add configuration system for REPL to set all items per line#208
forfudan merged 2 commits intodevfrom
cli

Conversation

@forfudan
Copy link
Copy Markdown
Owner

@forfudan forfudan commented Apr 15, 2026

This PR adds a REPL configuration system so users can change calculator display/computation options via :... meta-commands or inline expr:... one-off overrides.

Changes:

  • Introduce Settings, parse_settings, and split_inline_settings for REPL configuration parsing.
  • Integrate settings/meta-commands + inline overrides into the REPL loop; add extensive unit tests for the settings parser.
  • Expand docstrings across CLI calculator modules and update planning/docs; adjust CLI delimiter flag (removes -D).

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a REPL configuration system so users can change calculator display/computation options via :... meta-commands or inline expr:... one-off overrides.

Changes:

  • Introduce Settings, parse_settings, and split_inline_settings for REPL configuration parsing.
  • Integrate settings/meta-commands + inline overrides into the REPL loop; add extensive unit tests for the settings parser.
  • Expand docstrings across CLI calculator modules and update planning/docs; adjust CLI delimiter flag (removes -D).

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/decimal128/test_decimal128_from_int.mojo Fixes Decimal128.from_int(..., scale) calls to pass UInt32 scales.
tests/cli/test_settings.mojo Adds thorough tests for settings parsing and inline settings splitting.
src/cli/main.mojo Removes the -D short flag for --delimiter.
src/cli/calculator/tokenizer.mojo Adds docstrings for token kinds and tokenizer helpers.
src/cli/calculator/settings.mojo New settings model + parser and inline-settings splitter.
src/cli/calculator/repl.mojo REPL now supports : meta-commands and inline expr:settings overrides via Settings.
src/cli/calculator/parser.mojo Docstring improvements (args/returns).
src/cli/calculator/io.mojo Docstring improvements (args/returns/examples).
src/cli/calculator/evaluator.mojo Docstring improvements (args/returns).
src/cli/calculator/engine.mojo Docstring improvements (args/returns).
src/cli/calculator/display.mojo Docstring improvements and more documented ANSI constants.
src/cli/calculator/init.mojo Re-exports the new settings API.
pixi.toml Extends doc-generation task to include CLI calculator modules.
docs/plans/line_editor.md Adds a detailed future plan for a Mojo line editor package.
docs/plans/cli_calculator.md Updates roadmap/status notes for REPL features and CLI flag naming.
Comments suppressed due to low confidence (1)

src/cli/main.mojo:81

  • Removing the delimiter short option (-D) is a breaking CLI change and will cause existing CLI integration tests and docs to fail (e.g. tests/test_cli.sh and docs/user_manual_cli.md still use -D). Either restore the short flag or update the tests/docs (and any completion/help output expectations) to match the new interface.
    var delimiter: Option[
        String,
        long="delimiter",
        help="Digit-group separator inserted every 3 digits (e.g. '_' gives 1_234.567_89)",
        default="",
        value_name="CHAR",
        group="Formatting",
    ]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/cli/calculator/display.mojo Outdated
Comment thread docs/plans/cli_calculator.md Outdated
Comment thread docs/plans/cli_calculator.md
Comment thread src/cli/calculator/repl.mojo
Comment thread src/cli/calculator/repl.mojo Outdated
Comment thread src/cli/calculator/settings.mojo Outdated
Comment thread src/cli/calculator/settings.mojo
@forfudan forfudan merged commit 9fad8e0 into dev Apr 15, 2026
11 checks passed
@forfudan forfudan deleted the cli branch April 15, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants