Skip to content

bignacio/replmk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REPLmk

Friendly custom TUI REPL (Read-Eval-Print Loop) building tool.

!! Beta version !!

image

Features

  • Custom commands definitions via configuration files
  • Save and restore command and output history

Usage

The simplest way to starting a REPL is just by, well, typing replmk in the terminal.

And to see what command line arguments are available, you can use the --help option:

replmk --help

The -c, --config argument is how you make the tool actually useful.

The config file is a yaml file where you define the commands you want to be available in your REPL, along side other specific options specific to your REPL usability requirements.

The config file has the following structure:

prompt: ">" # Prompt character or text, displayed in the command input box
initial_message: "Welcome to replmk!" # A Welcome message shown when the REPL starts

input_note: "Type a command" # Message shown in the command input box
alt_help_cmd: "help" # Default command to show the help screen
alt_help_desc: "Show this screen:" # Description of the help command in the help screen
alt_exit_cmd: "exit" # Default command to exit the REPL
alt_exit_desc: "Exit the REPL." # Description of the exit command in the help screen

commands: # List of accepted commands
  - name: <command name> # Command name
    description: "<command description>" # Command description
    type: <command type> # Command type. It can be single or shell
    exec: <command execution> # What should be executed when the command is entered. For single commands, it is a string. For shell commands, it is a string that can span multiple lines.

An example config file can be found in examples/simple.yaml.

You can also specify a file to save and load the command history as well as the output history. The arguments for that are:

-s, --command-history-file arg -> Optional path to a file where to save the command history
-o, --output-history-file arg -> Optional path to a file where to save the output history

If not specified, the default values for those arguments are:

  • Command history file: ~/.replmk_history
  • Output history file: ~/.replmk_output_history

Installation from source

Requirements:

  • CMake 3.27 or higher
  • A modern, C++23 compiler
  • Linux (sorry)
git clone https://github.com/bira/replmk.git

cmake -B build -DCMAKE_BUILD_TYPE=Release
make -C build

The binary will be in build/src/replmk

Dependencies

Many thanks to the people who created the great libraries and tools in use by this project. Here is a list of them:

About

Friendly custom REPL building tool

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages