This repository has been archived by the owner on Mar 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzahlen.kalem
203 lines (156 loc) · 4.82 KB
/
zahlen.kalem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
// MIT License
//
// Copyright (c) 2021 Ferhat Geçdoğan All Rights Reserved.
// Distributed under the terms of the MIT License.
//
// Import STL C++ libraries
#import <ios>
#import <vect>
#import <filesys>
// Import PlusPlus libraries
#import "libraries/FileSystemPlusPlus.h"
#import "libraries/IntelligenTUI.hpp"
#defn RED_COLOR "\033[0;31m"
#defn GREEN_COLOR "\033[0;32m"
#defn YELLOW_COLOR "\033[0;33m"
#defn BLUE_COLOR "\033[0;34m"
#defn MAGENTA_COLOR "\033[0;35m"
#defn CYAN_COLOR "\033[0;36m"
#defn LIGHT_BLACK_COLOR "\033[0;90m"
#defn LIGHT_RED_COLOR "\033[0;91m"
#defn LIGHT_GREEN_COLOR "\033[0;92m"
#defn LIGHT_YELLOW_COLOR "\033[0;93m"
#defn LIGHT_BLUE_COLOR "\033[0;94m"
#defn LIGHT_MAGENTA_COLOR "\033[0;95m"
#defn LIGHT_CYAN_COLOR "\033[0;96m"
#defn LIGHT_WHITE_COLOR "\033[0;97m"
// Default bold** color definitions
#defn BOLD_RED_COLOR "\033[1;31m"
#defn BOLD_GREEN_COLOR "\033[1;32m"
#defn BOLD_YELLOW_COLOR "\033[01;33m"
#defn BOLD_BLUE_COLOR "\033[1;34m"
#defn BOLD_MAGENTA_COLOR "\033[1;35m"
#defn BOLD_CYAN_COLOR "\033[1;36m"
#defn BOLD_LIGHT_BLACK_COLOR "\033[1;90m"
#defn BOLD_LIGHT_RED_COLOR "\033[1;91m"
#defn BOLD_LIGHT_GREEN_COLOR "\033[1;92m"
#defn BOLD_LIGHT_YELLOW_COLOR "\033[1;93m"
#defn BOLD_LIGHT_BLUE_COLOR "\033[1;94m"
#defn BOLD_LIGHT_MAGENTA_COLOR "\033[1;95m"
#defn BOLD_LIGHT_CYAN_COLOR "\033[1;96m"
#defn BOLD_LIGHT_WHITE_COLOR "\033[1;97m"
@PushDirectories(vect < string > &dirs) void {
#DIR *directory;
#struct dirent *entryname;
#struct stat filestat;
unsign i = 0
#directory = opendir(fsplusplus::GetCurrentWorkingDir().c_str());
#if(directory == NULL) {
@print "Error: Directory not found.\n"
}
while ((entryname = readdir(directory))) {
#stat(entryname->d_name, &filestat);
if (entryname->d_type == DT_DIR) {
@print BOLD_LIGHT_BLUE_COLOR
@print "["
@print BOLD_YELLOW_COLOR
@print i
@print BOLD_LIGHT_BLUE_COLOR
@print "] "
@print BOLD_LIGHT_WHITE_COLOR
@print entryname->d_name
@print "\n"
#i++;
#dirs.push_back(entryname->d_name);
}
els {
@print BOLD_LIGHT_BLUE_COLOR
@print "["
@print BOLD_YELLOW_COLOR
@print i
@print BOLD_LIGHT_BLUE_COLOR
@print "] "
@print BOLD_LIGHT_BLACK_COLOR
@print entryname->d_name
@print "\n"
#i++;
#dirs.push_back(entryname->d_name);
}
}
#closedir(directory);
}
@Size(string path) void {
#itui::clear_buffer();
#std::filesystem::path _path = std::filesystem::current_path() / path;
#try {
@print "Size: "
#std::cout << std::filesystem::file_size(_path);
@print "byte\n"
#} catch(std::filesystem::filesystem_error& e) {
@print "Huh!: "
@print e.what();
#}
}
@InformationBuffer(string file) void {
#itui::clear_buffer();
@print "Name: "
@print file
@print "\n"
#Size(file);
}
@CurrentDirBuffer void {
@print BOLD_LIGHT_BLUE_COLOR
@print fsplusplus::GetCurrentWorkingDir()
@print "\n"
}
@main int {
string _number = ""
unsign _type = 0
#std::vector<std::string> files;
@retry:
#itui::clear_buffer();
@CurrentDirBuffer()
if (_type == 0) {
#PushDirectories(files);
}
elsif (_type == 1) {
#InformationBuffer(files[atoi(_number.c_str())]);
}
elsif (_type == 2) {
@print BOLD_LIGHT_WHITE_COLOR
@print fsplusplus::ReadFileWithReturn(files[atoi(_number.c_str())])
}
@print BOLD_LIGHT_WHITE_COLOR
@print "\n>> "
#std::getline(std::cin, _number);
while (_type >= 0) {
if (_number == "q") {
if (_type != 0) {
#_type = 0;
@goto retry
}
els {
#break;
}
}
if (_number[0] == '-' && _number[1] == '-') {
if (_number[2] == 'i') {
#/* --i <number> */
#_number = _number.erase(0, 3);
#_type = 1;
}
@goto retry
}
elsif (fsplusplus::TypeOf(files[atoi(_number.c_str())]) == 1) {
#_type = 2;
@goto retry
}
#chdir(files[atoi(_number.c_str())].c_str());
#itui::clear_buffer();
#itui::refresh_buffer();
#files.clear();
@goto retry
}
#itui::clear_buffer();
@return 0
}