Template for Command Line Interface (CLI) tool in C++ using argparse.
# install Command Line Tools (CLT) for Xcode:
xcode-select --install# install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"# install
brew install cmake
# verify
cmake --version# install
git clone https://github.com/microsoft/vcpkg "$HOME/vcpkg"
cd $HOME/vcpkg && ./bootstrap-vcpkg.shNeeded for docs:
brew install doxygenInstall Python version manager pyenv. Also needed for docs:
brew install pyenvDownload and install from Visual Studio Code site.
Open Visual Studio Code and press Cmd + Shift + p. Select Shell Command: Install 'code' command in PATH.
Configure project:
source configure.shOpen the project in Visual Studio Code:
code .# 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 Releaseecho "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# 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 && popdThis installs Sphinx, Breathe, and themes:
source configure-docs.sh./docs.shmkdir -p docs
cd docs
sphinx-quickstart