FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
unshare.hpp
Go to the documentation of this file.
1
8
9#pragma once
10
11#include <filesystem>
12#include <print>
13
15
24namespace ns_cmd::ns_unshare
25{
26
27namespace
28{
29
30namespace fs = std::filesystem;
31
32}
33
41[[nodiscard]] inline Value<void> set(fs::path const& path_file_binary
42 , std::set<ns_reserved::ns_unshare::Unshare> const& unshares
43)
44{
45 ns_reserved::ns_unshare::Unshares manager(path_file_binary);
46 Pop(manager.set(unshares));
47 return {};
48}
49
57[[nodiscard]] inline Value<void> add(fs::path const& path_file_binary
58 , std::set<ns_reserved::ns_unshare::Unshare> const& unshares
59)
60{
61 ns_reserved::ns_unshare::Unshares manager(path_file_binary);
62 Pop(manager.add(unshares));
63 return {};
64}
65
73[[nodiscard]] inline Value<void> del(fs::path const& path_file_binary
74 , std::set<ns_reserved::ns_unshare::Unshare> const& unshares
75)
76{
77 ns_reserved::ns_unshare::Unshares manager(path_file_binary);
78 Pop(manager.del(unshares));
79 return {};
80}
81
88[[nodiscard]] inline Value<void> clear(fs::path const& path_file_binary)
89{
90 ns_reserved::ns_unshare::Unshares manager(path_file_binary);
91 Pop(manager.clear());
92 return {};
93}
94
101[[nodiscard]] inline Value<void> list(fs::path const& path_file_binary)
102{
103 ns_reserved::ns_unshare::Unshares manager(path_file_binary);
104 auto unshares = Pop(manager.to_strings());
105 for(auto const& unshare : unshares)
106 {
107 std::println("{}", unshare);
108 }
109 return {};
110}
111
112} // namespace ns_cmd::ns_unshare
113
114/* vim: set expandtab fdm=marker ts=2 sw=2 tw=100 et :*/
Manages FlatImage unshare options stored in reserved space.
Definition unshare.hpp:134
Value< void > set(std::set< Unshare > const &unshares)
Sets the specified unshare options (replaces existing)
Definition unshare.hpp:184
Value< void > del(std::set< Unshare > const &unshares)
Removes unshare options from existing configuration.
Definition unshare.hpp:204
Value< void > clear() noexcept
Clears all unshare options.
Definition unshare.hpp:227
Value< std::set< std::string > > to_strings() const noexcept
Converts enabled unshare options to string representations.
Definition unshare.hpp:236
Value< void > add(std::set< Unshare > const &unshares)
Adds unshare options to existing configuration.
Definition unshare.hpp:194
Unshare namespace options command implementation.
Value< void > list(fs::path const &path_file_binary)
Lists all enabled unshare options.
Definition unshare.hpp:101
Value< void > add(fs::path const &path_file_binary, std::set< ns_reserved::ns_unshare::Unshare > const &unshares)
Adds unshare options to existing configuration.
Definition unshare.hpp:57
Value< void > clear(fs::path const &path_file_binary)
Clears all unshare options.
Definition unshare.hpp:88
Value< void > set(fs::path const &path_file_binary, std::set< ns_reserved::ns_unshare::Unshare > const &unshares)
Sets the unshare options (replaces existing)
Definition unshare.hpp:41
Value< void > del(fs::path const &path_file_binary, std::set< ns_reserved::ns_unshare::Unshare > const &unshares)
Removes unshare options from existing configuration.
Definition unshare.hpp:73
Manages the unshare namespace options reserved space.
Enhanced expected type with integrated logging capabilities.
Definition expected.hpp:44