Skip to content

A library for easy handling of command line options for C++

License

Notifications You must be signed in to change notification settings

vstan02/conixpp

Repository files navigation

ConixPP

A library for easy handling of command line options for C++

Version: v0.1.0 License: GPL v3

Contents

Usage

Here is an example of usage (for the full version see demo/main.cpp file):

cnx::cli("my_app", "2.8.1")
	.add({ // Adding some options for handling:
		// cnx::option -> { name, description, handler, payload }
		{	{ "-a", "--about" }, "Display something", about_option },
		{ { "-p", "--print" }, "Display passed arguments", print_args_option },

		// Handlers for "-v, --version" and "-h, --help" are added
		// by default, but you can add your own handlers for them.
		{ { "-v", "--version" }, "Display version", version_option },

		// Handler for "--default" is called when are no arguments passed
		{ { "--default" }, "Default option", index_option },

		// Handler for "*" is called when is passed an unknown cli option.
		// By default it has the same handler as the "-h, --help" option.
		{ { "*" }, not_found_option }
	})
	.run(argc, argv);

After project building you can run this example as you can see here.

Building and Installation

Dependencies

  • C++ compiler
  • cmake

These packages can usually be installed through your distributions package manager.

Building the project

To build the project, we first need to create a separate build directory:

mkdir build

Now that we've created our build directory (assuming it's created in the project root), we can cd into it and run cmake and pass the parent directory path to it, which is where the CMakeLists.txt file is located:

cd build
cmake ..

Once cmake is done generating makefiles, we can build the library by running make inside our build directory:

make

Running demo

./demo

Running tests

./test

Installing

To install the library run:

sudo make install

By default the libraries and headers will be installed in /usr/local/lib and /usr/local/include directories.

License

ConixPP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. For more details, see LICENSE file.

Contributing

Contributions are welcome. If you have a feature request, or have found a bug, feel free to open a new issue. If you wish to contribute code, see CONTRIBUTING.md for more details.

About

A library for easy handling of command line options for C++

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published