Rev 2097 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
964 | jag | 1 | /* |
2 | * help.cc |
||
2302 | jag | 3 | * DIN Is Noise is copyright (c) 2006-2025 Jagannathan Sampath |
1713 | jag | 4 | * DIN Is Noise is released under GNU Public License 2.0 |
1479 | jag | 5 | * For more information, please visit https://dinisnoise.org/ |
964 | jag | 6 | */ |
7 | |||
8 | #include "help.h" |
||
9 | #include "console.h" |
||
10 | #include <fstream> |
||
11 | using namespace std; |
||
12 | extern console cons; |
||
13 | extern string user_data_dir; |
||
14 | help::help (const string& fname) { |
||
15 | string s; |
||
16 | ifstream file ((user_data_dir + fname).c_str(), ios::in); |
||
1965 | jag | 17 | if (!file) lines.push_back (fname); else while (getline(file, s)) lines.push_back (s); |
18 | dlog << "help file: " << fname << " loaded, num_lines = " << lines.size () << endl; |
||
964 | jag | 19 | } |
20 | void help::operator() () { |
||
21 | cons.rollup (0); |
||
1965 | jag | 22 | for (int i = 0, j = lines.size(); i < j; ++i) { |
23 | dlog << lines[i] << endl; |
||
24 | cons << CYAN << lines[i] << eol; |
||
25 | } |
||
964 | jag | 26 | cons.last (); |
27 | } |