Skip to content

ntoskrnl7/util-linux-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

util-linux-cpp

A Header-only library that makes it easy to use Linux utility commands.


Contents


Dependencies


Features

lsblk

Supported lsblk command versions: 2.29.2 or later (Test on 2.29.2 and 2.33.1)

Examples

#include <util_linux/lsblk.hpp>

nlohmann::json result = util_linux::lsblk();
std::cout << result.dump(4) << std::endl;

util_linux::lsblk("/dev/sda");

Usage

CMake

CMakeLists.txt

cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

# create project
project(MyProject)

# add executable
add_executable(tests tests.cpp)

# add dependencies
include(cmake/CPM.cmake)
CPMAddPackage("gh:ntoskrnl7/util-linux-cpp@0.1.2")

# link dependencies
target_link_libraries(tests util-linux)

Test

cd tests
mkdir build && cd build
cmake ..
cmake --build .
./unittest