reply

Crates.ioreply
lib.rsreply
version0.0.1-beta.2
sourcesrc
created_at2023-03-17 19:11:20.757235
updated_at2023-03-18 23:28:33.825478
descriptionreply makes any command-line application a (stateless) REPL
homepagehttps://github.com/schneiderfelipe/getanswe.rs/tree/main/reply
repositoryhttps://github.com/schneiderfelipe/getanswe.rs
max_upload_size
id812941
size35,463
Felipe S. S. Schneider (schneiderfelipe)

documentation

README

reply

Crates.io version GitHub license Build CI Changelog CI Libraries.io SourceRank

reply📩 makes any command-line application a (stateless) REPL.

$ reply 'python | cowsay -f tux -n'
> print("Hello reply📩!")
 ________________
< Hello reply📩! >
 ----------------
   \
    \
        .--.
       |o_o |
       |:_/ |
      //   \ \
     (|     | )
    /'\_   _/`\
    \___)=(___/

>

Read the installation and usage instructions below.

Installation

From source (recommended)

Either clone the repository to your machine and install from it, or install directly from GitHub. Both options require Rust and Cargo to be installed.

# Option 1: cloning and installing from the repository
$ git clone https://github.com/schneiderfelipe/getanswe.rs.git
$ cd getanswe.rs && cargo install reply --path=reply/

# Option 2: installing directly from GitHub
$ cargo install reply --git=https://github.com/schneiderfelipe/getanswe.rs

If you're looking to contribute to the project's development, the first option is the way to go (and thank you for your interest!). However, if you simply want to install the development version, the second option is likely the better choice.

Usage

Using this tool is simple:

$ reply 'python'
>

Whatever you type in the prompt will be fed to the backend command (python in the example). The output of the command will be displayed in the terminal. For example:

$ reply 'python'
> print("Hello " + "python")
Hello python
>

However, there are a few things to keep in mind:

  • Only the standard output is captured. If nothing is printed, nothing will be shown.
  • The REPL is stateless, which means that there's no memory being carried out. If you define a variable, for example, it won't be available in the next prompt.

Here's an example:

$ reply 'python'
> a = 2              # no output
> print(f"a = {a}")  # no memory
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'a' is not defined

Therefore, it's the responsibility of the backend application to

  • Print out results to the standard output.
  • Implement memory (normally through a file).

Unsafe code usage

This project forbids unsafe code usage.

License: MIT

Commit count: 61

cargo fmt