-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdata.h
More file actions
48 lines (42 loc) · 1.26 KB
/
data.h
File metadata and controls
48 lines (42 loc) · 1.26 KB
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
#ifndef DATA_H
#define DATA_H
#include <string>
#include <unordered_map>
#include <set>
using namespace std;
string user;
string currentDirectory;
/*
They have to be here and initialized when the program starts
and only when user or directory changed.
*/
// command name + vaild options + number of vaild parameters
unordered_map<string, pair<set<char>, set<int>>> vaildCommands = {
{"clear", { {}, {0}}},
{"pwd", { {}, {0}}},
{"cd", { {}, {0,1}}},
{"ls", { {'l'}, {0, 1}}},
{"stat", { {}, {1}}},
{"touch", { {}, {1}}},
{"cat", { {}, {1,2,3}}},
{"rm", { {'f'}, {1}}},
{"mv", { {}, {2}}},
{"cp", { {}, {2}}},
{"mkdir", { {'p'}, {1}}},
{"rmdir", { {}, {1}}},
{"find", { {}, {1, 2}}},
{"exit", { {}, {0}}},
{"help", { {}, {0}}}
};
class colors {
public:
inline static const std::string reset = "\033[0m";
inline static const std::string red = "\033[31m";
inline static const std::string green = "\033[32m";
inline static const std::string yellow = "\033[33m";
inline static const std::string blue = "\033[34m";
inline static const std::string magenta = "\033[35m";
inline static const std::string cyan = "\033[36m";
inline static const std::string orange = "\033[38;5;214m";
};
#endif //DATA_H