Skip to content
/ cli-cpp Public template

Template for Command Line Interface (CLI) tool in C++ using argparse

License

Notifications You must be signed in to change notification settings

swiftsoftwaregroup/cli-cpp

Repository files navigation

cli-cpp

Template for Command Line Interface (CLI) tool in C++ using argparse.

Development

Setup for macOS

Compilers

# install Command Line Tools (CLT) for Xcode:
xcode-select --install

Homebrew

# install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

cmake

# install
brew install cmake 

# verify
cmake --version

vcpkg

# install
git clone https://github.com/microsoft/vcpkg "$HOME/vcpkg"
cd $HOME/vcpkg && ./bootstrap-vcpkg.sh

doxygen

Needed for docs:

brew install doxygen

pyenv

Install Python version manager pyenv. Also needed for docs:

brew install pyenv

Visual Studio Code

Download and install from Visual Studio Code site.

Open Visual Studio Code and press Cmd + Shift + p. Select Shell Command: Install 'code' command in PATH.

Work on macOS

Configure project:

source configure.sh

Open the project in Visual Studio Code:

code .

Build

# list presets
cmake --list-presets

# configure and build Debug
cmake --preset Debug
cmake --build --preset Debug

# or to build Release
cmake --preset Release
cmake --build --preset Release

Run

echo "John" > name.txt

./build/Debug/cli-cpp greet name.txt
./build/Debug/cli-cpp greet --language es name.txt
./build/Debug/cli-cpp greet -l bg name.txt

Test

# run via ctest
ctest --preset Debug
ctest --preset Release

# run via GoogleTest
pushd ./build/Debug && ./cli-cpp-test && popd
pushd ./build/Release && ./cli-cpp-test && popd

Docs

Configure

This installs Sphinx, Breathe, and themes:

source configure-docs.sh

Build

./docs.sh

How to start docs?

mkdir -p docs
cd docs
sphinx-quickstart

About

Template for Command Line Interface (CLI) tool in C++ using argparse

Resources

License

Stars

Watchers

Forks