Shpp - Call c++ functions from a shell with any arguments of any types parsed automatically

Related tags

CLI shpp
Overview

shpp

Call c++ functions from a shell with any arguments of any types parsed automatically

Declare a variable or define a function and register it in shpp with a simple command. Your function will be available to be called by a shell that parses the arguments automatically to the types of the arguments of your function.

Usage

git clone --recursive https://github.com/GrossoMoreira/shpp
cd shpp
make
bin/example

Features

  • list available functions, including their return type and parameter types
  • call functions with any number of arguments of any primitive types or stl-like non-associative containers
  • read and write variables (const/read-only variables supported)
  • when a function is called, output its return value (of any supported type)
  • interactive and non interactive mode
  • auto-complete
  • command history
  • reverse search
  • sourcing commands from files

Interface

#include "shpp/shpp.h"

shpp::service svc;	// create a service

svc.provide_command("function_name", function_ptr);
svc.provide_value("variable_name", variable_ref);

shpp::shell sh(svc);	// create a shell for this service
sh.start();			// start shell

Interactive shell

Interactive shell demo

Supported types

  • primitive types
  • stl-like non-associative containers (std::vector, std::list...) that implement the push_back() method, parsed/serialized as JSON objects
  • containers of containers
Sample std::vector<std::list<int>> :

[[0,2,4],[1,3,5],[]]

..can be used as a function parameter or return type.

Dependencies

  • GNU readline

Todo

  • support arguments of user-defined types
  • support asynchronous execution of commands
  • call functions remotely
You might also like...
LwSHELL is lightweight, platform independent, command line shell for embedded systems.

LwSHELL is lightweight, platform independent, command line shell for embedded systems. It targets communication with embedded systems from remote terminal to quickly send commands and the retrieve data from the device.

LSH is a simple implementation of a shell in C

It demonstrates the basics of how a shell works. That is: read, parse, fork, exec, and wait. Since its purpose is demonstration (not feature completeness or even fitness for casual use), it has many limitations

Yori is a CMD replacement shell that supports backquotes, job control, and improves tab completion, file matching, aliases, command history, and more.

Yori is a CMD replacement shell that supports backquotes, job control, and improves tab completion, file matching, aliases, command history, and more.

An implementation of shell commands in C++
An implementation of shell commands in C++

ShellSynergy An implementation of shell commands in C++ using std::filesystem Build To run the project execute command: [email protected]:~$ ./RUN.sh Short shel

 A C-based Mini Shell: mumsh
A C-based Mini Shell: mumsh

A C-based Mini Shell: mumsh This project is a course project in VE482 Operating System @UM-SJTU Joint Institute. In this project, a mini shell mumsh i

Linux Shell Implementation In C - Language

Linux-Shell ASSIGNMENT 2 Name : Naman Anand Roll no : 200101070 SUBJECT : CS242 ASSIGNMENT : 2 COMPILING AND FOR RUNNING COMMANDS :- 1)gcc -o 2001010

Flexible and fast Z-shell plugin manager that will allow installing everything from GitHub and other sites.
Flexible and fast Z-shell plugin manager that will allow installing everything from GitHub and other sites.

ZINIT News Zinit Wiki Quick Start Install Automatic Installation (Recommended) Manual Installation Usage Introduction Plugins and snippets Upgrade Zin

Mini Shell in C implementing the basic command line functionalities

Mini-Shell Mini Shell in C implementing the basic command line functionalities Instructions to execute the shell: Download the readline library using

Linux Shell Implementation In C - Language

Linux-Mini-Shell This is a C code for Linux Shell (a mini version). The code is designed to work properly in LINUX terminal. To compile the code and r

Comments
  • Compilation error on Ubuntu14.04

    Compilation error on Ubuntu14.04

    g++ -std=c++11 -Wl,-rpath=/home/ubuntu/workspace/shpp/bin -Iinclude -Ijsoncons/src example/main.cpp -o bin/example -Lbin  -lreadline -lshpp
    bin/libshpp.so: undefined reference to `rl_completion_matches'
    bin/libshpp.so: undefined reference to `rl_attempted_completion_function'
    bin/libshpp.so: undefined reference to `readline'
    bin/libshpp.so: undefined reference to `add_history'
    collect2: error: ld returned 1 exit status
    make: *** [bin/example] Error 1
    
    opened by aggsol 2
Owner
Pedro Moreira
Pedro Moreira
simple c program thats spawns a shell wants executed, this shell will detect your os and upon entering will erase or reset the system V1.0

kill-shell simple c program thats spawns a shell wants executed, this shell will detect your os and upon entering will erase or reset the system V1.0

RE43P3R 1 Oct 18, 2021
Pine's ok shell, a shell in C++

POSH Pine's ok shell, a shell in C++ Answers to questions nobody asked. "Is your name Pine?" No, although that would be neat. Pine is supposed to be a

Boops-Boops 1 Nov 6, 2021
SimPle SHell - minimalist Unix interactive shell written in a single C file

SimPle SHell - minimalist Unix interactive shell written in a single C file. The shell does not support scripting yet and is in an early stage of development. If you notice any bug, please open an issue on github.

sewe2000 2 Oct 24, 2021
A single header C++ library for parsing command line arguments and options with minimal amount of code

Quick Arg Parser Tired of unwieldy tools like getopt or argp? Quick Arg Parser is a single header C++ library for parsing command line arguments

null 47 Dec 21, 2022
Parse command line arguments by defining a struct

Parse command line arguments by defining a struct Quick Start #include <structopt/app.hpp> struct Options { // positional argument // e.g., .

Pranav 420 Dec 20, 2022
C++ getopt wrapper to make it easier to parse command line arguments

Options is a simple C++ wrapper for getopt that makes it easier to handle command line argument parsing in C++. See demo.cc and the Makefile for an e

Gary Hollis 1 Oct 30, 2021
EAMain provides a multi-platform entry point used for platforms that don't support console output, return codes and command-line arguments.

EAMain provides a multi-platform entry point used for platforms that don't support console output, return codes and command-line arguments.

Electronic Arts 34 Oct 1, 2022
a shell written in C

shell a shell written in C. CREDITS = https://github.com/brenns10/lsh/blob/master/src/main.c -for most of the template code. This project has a 10% ch

Arin 13 Jan 3, 2023
A Windows Shell Extension for the Pixar USD file format.

Activision USD Shell Extension A Windows Shell Extension for the Pixar USD file format. Windows Explorer Features Hydra Realtime Preview Thumbnails Co

null 319 Dec 28, 2022
IDAShell is a shell extension for launching IDA from the context menu of executables.

IDAShell About IDAShell is a shell extension for launching IDA from the context menu of executables. Usage Just install and it works. If you moved IDA

null 174 Dec 18, 2022