Skip to content

Commit cd42b95

Browse files
authored
Merge pull request #1 from nekogakure/main
最適化&C++への移植、UXの改善
2 parents 2c8c3c0 + a9205b5 commit cd42b95

6 files changed

Lines changed: 64 additions & 63 deletions

File tree

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
kryptinfo : kryptinfo.c
2-
clang -Wall -o kryptinfo kryptinfo.c
1+
CXX = clang++
2+
CXXFLAGS = -Wall -O2
3+
4+
kryptinfo: kryptinfo.cpp
5+
$(CXX) $(CXXFLAGS) -o $@ $^
6+
7+
clean:
8+
rm -f kryptinfo
9+

PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Maintainer: Itsuki Wada <175463719+Itsuki0222@users.noreply.github.com>
22

33
pkgname=kryptinfo
4-
pkgver=20240820
4+
pkgver=20250217
55
pkgrel=1
66
pkgdesc='Easily Check System Information'
77
arch=('x86_64')

kryptinfo

-15.5 KB
Binary file not shown.

kryptinfo.c

Lines changed: 0 additions & 60 deletions
This file was deleted.

kryptinfo.cpp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#include <iostream>
2+
#include <string>
3+
#include <unordered_map>
4+
#include <cstdlib>
5+
6+
void executeCommand(const std::string& command) {
7+
int result = std::system(command.c_str());
8+
if (result != 0) {
9+
std::cerr << "Failed to execute the command: " << command << std::endl;
10+
}
11+
}
12+
13+
void displayMenu() {
14+
std::cout << "\n\n\n\t==== System info ====" << std::endl;
15+
std::cout << "\t1: dmesg as superuser" << std::endl;
16+
std::cout << "\t2: lsb_release -a" << std::endl;
17+
std::cout << "\t3: lspci" << std::endl;
18+
std::cout << "\t4: uname -a" << std::endl;
19+
std::cout << "\t5: fastfetch" << std::endl;
20+
std::cout << "\t0: exit" << std::endl;
21+
std::cout << "\t=====================" << std::endl;
22+
}
23+
24+
int main() {
25+
std::unordered_map<std::string, std::string> commands = {
26+
{"1", "sudo dmesg"},
27+
{"2", "lsb_release -a"},
28+
{"3", "lspci"},
29+
{"4", "uname -a"},
30+
{"5", "fastfetch"}
31+
};
32+
33+
std::string choice;
34+
35+
do {
36+
displayMenu();
37+
std::cout << "> ";
38+
std::cin >> choice;
39+
40+
if (choice == "0") {
41+
std::cout << "\nexit the program." << std::endl;
42+
break;
43+
}
44+
45+
if (commands.find(choice) != commands.end()) {
46+
executeCommand(commands[choice]);
47+
} else {
48+
std::cout << "\nIt is an invalid option. Please specify 1~5 or 0.\n";
49+
}
50+
51+
} while (true);
52+
53+
return 0;
54+
}

kryptinfo.tar.gz

-1.97 KB
Binary file not shown.

0 commit comments

Comments
 (0)