Add license and Semaphore build badges
[minishell-2.git] / Headers / input.h
blob2183134ed2e664b47ee322be56a1ae26dfa23d21
1 /*
2 * miniSHELL-2
3 * https://github.com/vrmiguel/minishell-2
5 * Copyright (c) 2020 Vinícius R. Miguel <vinicius.miguel at unifesp.br>
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
26 #ifndef INPUT_H
27 #define INPUT_H
29 #include <string> // strings
30 #include <vector> // vectors
32 using std::string;
33 using std::vector;
35 #define RED_ANSI "\x1b[31m" // ANSI escape code for red
36 #define BLUE_ANSI "\x1b[34m" // ANSI escape code for blue
37 #define RESET_ANSI "\x1b[0m" // ANSI escape code to reset stdout's color
38 #define KEY_UP 72 // ASCII code for arrow key up
39 #define KEY_LEFT 75 // ASCII code for arrow key left
40 #define KEY_RIGHT 77 // ASCII code for arrow key right
41 #define KEY_DOWN 80 // ASCII code for arrow key down
43 extern bool is_verbose;
44 extern bool cwd_changed;
46 class CLIInputs
48 public:
49 /*!
50 * \brief Constructor for CLIInputs.
51 * \param argc Command-line argument count.
52 * \param argv Array of strings that representing the command-line argument given.
54 CLIInputs(unsigned short argc, char ** argv);
57 class Prompt
59 string last_dir;
60 vector<string> tokens;
61 public:
62 void get_last_dir();
63 void print();
64 short int run();
65 void parse(string input);
66 Prompt();
69 #endif // INPUT_H