fzyzcjy / dart_interactive

REPL (interactive shell) for Dart, supporting 3rd party packages, hot reload, and full grammar
https://github.com/fzyzcjy/dart_interactive
MIT License
146 stars 12 forks source link

feat: Auto Import and Run Configuration Dot File #98

Open mcmah309 opened 3 days ago

mcmah309 commented 3 days ago

Hello fzyzcjy :wave:

Is your feature request related to a problem? Please describe.

Almost always when I open a repl I will reach for two packages:

This becomes tedious

Describe the solution you'd like

It would a huge time saver if dart_interactive read from a dot file, maybe even a configuration.toml, where I can specify packages to include (e.g. sheller: ^0.5.6) and commands to run import 'dart:io'; import 'package:sheller/sync.dart'; at the start of each repl session.

welcome[bot] commented 3 days ago

Hi! Thanks for opening your first issue here! :smile:

fzyzcjy commented 3 days ago

That looks reasonable!

For simplicity, the first version may be as simple as

prelude: |-
  !dart pub add sheller
  import 'dart:io'; import 'package:sheller/sync.dart';

And the implementation is as simple as "execute line-by-line as-is".

Only a nit: To make it consistent with flutter ecosystem, maybe it is named dart_interactive.yaml.

Feel free to PR for this! I may not have enough time to implement this recently, but is happy to review/merge PRs.