pmt: reformat code.
Some checks failed
Mirror External Repo to GitHub / mirror (push) Has been cancelled
Some checks failed
Mirror External Repo to GitHub / mirror (push) Has been cancelled
This commit is contained in:
@@ -14,10 +14,11 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <libpartition_map/lib.hpp>
|
||||
#include <unistd.h>
|
||||
|
||||
int main() {
|
||||
if (getuid() != 0) return 2;
|
||||
@@ -31,7 +32,7 @@ int main() {
|
||||
|
||||
const auto map = MyMap.getAll();
|
||||
if (map.empty()) throw PartitionMap::Error("getAll() empty");
|
||||
for (const auto &[name, props] : map) {
|
||||
for (const auto& [name, props] : map) {
|
||||
std::cout << "Partition: " << name << ", size: " << props.size
|
||||
<< ", logical: " << props.isLogical << std::endl;
|
||||
}
|
||||
@@ -45,14 +46,14 @@ int main() {
|
||||
if (!logicals)
|
||||
throw PartitionMap::Error("getLogicalPartitionList() returned nullopt");
|
||||
std::cout << "Logical partitions: " << std::endl;
|
||||
for (const auto &name : *logicals)
|
||||
for (const auto& name : *logicals)
|
||||
std::cout << " - " << name << std::endl;
|
||||
|
||||
const auto physicals = MyMap.getPhysicalPartitionList();
|
||||
if (!physicals)
|
||||
throw PartitionMap::Error("getPhysicalPartitionList() returned nullopt");
|
||||
std::cout << "Physical partitions: " << std::endl;
|
||||
for (const auto &name : *physicals)
|
||||
for (const auto& name : *physicals)
|
||||
std::cout << " - " << name << std::endl;
|
||||
|
||||
if (const std::vector<PartitionMap::Info> parts =
|
||||
@@ -61,7 +62,7 @@ int main() {
|
||||
throw PartitionMap::Error(
|
||||
"operator std::vector<PartitionMap::Info>() returned empty vector");
|
||||
|
||||
auto func = [](const std::string &partition,
|
||||
auto func = [](const std::string& partition,
|
||||
const PartitionMap::BasicInf props) -> bool {
|
||||
std::ofstream f("parts.txt");
|
||||
f << "Partition: " << partition << ", size: " << props.size
|
||||
@@ -96,10 +97,10 @@ int main() {
|
||||
if (MyMap != MyMap2) std::cout << "map1 != map2" << std::endl;
|
||||
|
||||
std::cout << PartitionMap::getLibVersion() << std::endl;
|
||||
} catch (PartitionMap::Error &error) {
|
||||
} catch (PartitionMap::Error& error) {
|
||||
std::cerr << error.what() << std::endl;
|
||||
return 1;
|
||||
} catch (std::ios_base::failure &error) {
|
||||
} catch (std::ios_base::failure& error) {
|
||||
std::cerr << "fstream error: " << error.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user