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

Run code blocks #22

Merged
merged 37 commits into from
Sep 20, 2023
Merged

Run code blocks #22

merged 37 commits into from
Sep 20, 2023

Conversation

glcraft
Copy link
Owner

@glcraft glcraft commented Sep 18, 2023

Improvements

From #21 : Run code blocks

Ask for execute code from block if the language is specified after the three backticks.

Supported languages:

  • unix shells
  • powershell
  • nushell
  • python
  • rust (compile then run)

Add a flag :

  • -r, --run <RUN>: Run code block if the language is supported
    Possible values:
    • no: Doesn't run anything
    • ask: Ask to run code
    • force: Run code without asking
      default to no

From #23 : Replace lazy_static to once_cell crate

New engine from-file

Using this new engine, you can read file and interpret it like it comes from AI. Useful for debugging or testing.

Example:

aio -e from-file ./test.md

@glcraft glcraft added the enhancement New feature or request label Sep 18, 2023
src/arguments.rs Outdated Show resolved Hide resolved
src/arguments.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/runner/program/mod.rs Outdated Show resolved Hide resolved
src/runner/program/mod.rs Show resolved Hide resolved
src/runner/program/mod.rs Show resolved Hide resolved
src/runner/program/mod.rs Outdated Show resolved Hide resolved
Comment on lines +41 to +42
NotFound,
Error(SearchError)
Copy link

Choose a reason for hiding this comment

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

isn't NotFound a kind of Error ?

Copy link
Owner Author

Choose a reason for hiding this comment

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

It can be. But Errors are differently managed where the search is queried. if found or not found, the function continue to run, but if it is an Error, it returns.
At first, SearchStatus was a Result<Option<Box<dyn Program>, SearchError>. As you can see, this is pretty much the same structure.

src/runner/program/python.rs Outdated Show resolved Hide resolved
src/runner/program/mod.rs Outdated Show resolved Hide resolved
@glcraft glcraft merged commit 8c24dc4 into dev Sep 20, 2023
@glcraft glcraft deleted the run-code branch September 20, 2023 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants