# Command Interface - C++ 프로그램에 REPL 추가하기

> Clean Markdown view of GeekNews topic #5214. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=5214](https://news.hada.io/topic?id=5214)
- GeekNews Markdown: [https://news.hada.io/topic/5214.md](https://news.hada.io/topic/5214.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2021-10-18T09:55:01+09:00
- Updated: 2021-10-18T09:55:01+09:00
- Original source: [github.com](https://github.com/empirical-soft/command-interface)
- Points: 3
- Comments: 0

## Topic Body

- 헤더만 있는 라이브러리

- 함수를 코맨드로 등록해서 간단한 REPL 구현 가능

register_command(add, "add", "Add two numbers");

register_command(&Arithmetic::inc, "inc", "Increment a number");

ㅤ→ add,inc 함수를 코맨드로 추가

[동작 화면]

>>> help

add   Add two numbers

inc   Increment a number

help  Show this help

>>> add 3 4

7

>>> inc 21

22

>>> add 3 4 5

Error: expected 2 arguments; got 3

## Comments



_No public comments on this page._
