Skip to content

Commit

Permalink
Modificasiones leves
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorH028 committed Jul 6, 2024
1 parent 3fbaeab commit d21f942
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 14 deletions.
55 changes: 55 additions & 0 deletions .deb/i-haklab/home/.zsh/cache/history
Original file line number Diff line number Diff line change
Expand Up @@ -9243,3 +9243,58 @@ pkg install mingw-w64\
: 1720239922:0;nvim include/command_line_argument_parser.h
: 1720240142:0;cat include/command_line_argument_parser.h
: 1720240496:0;git add --all
: 1720240602:0;git commit -m "Se separa el codigo en mas clases para un mejor entendimiento"
: 1720240610:0;git push
: 1720240672:0;bat include/below_zero.h
: 1720240694:0;nvim include/below_zero.h
: 1720240797:0;nvim src/below_zero.cpp
: 1720241084:0;nvim include/below_zero.h
: 1720241137:0;nvi. src/below_zero.cpp
: 1720241144:0;nvim src/below_zero.cpp
: 1720241315:0;i-haklab --help
: 1720241329:0;i-haklab --about
: 1720241334:0;i-haklab --about "holl"
: 1720241355:0;nvim include/command_line_argument_parser.h
: 1720241505:0;nvim src/below_zero.cpp
: 1720241589:0;bash build_sh.sh
: 1720241657:0;i-haklab
: 1720241666:0;i-haklab --help
: 1720241699:0;i-haklab --about lop
: 1720241761:0;nvim include/command_line_argument_parser.h
: 1720241777:0;nvim src/below_zero.cpp
: 1720241902:0;nvim include/below_zero.h
: 1720241940:0;nvin include/command_line_argument_parser.h
: 1720241952:0;nvim include/command_line_argument_parser.h
: 1720242162:0;i-haklab --about lop
: 1720242167:0;i-haklab --about "lop"
: 1720242352:0;nvim include/command_line_argument_parser.h
: 1720242396:0;bash build_sh.sh
: 1720242463:0;i-haklab --help
: 1720242487:0;i-haklab --about lop
: 1720242491:0;i-haklab --about jajaja
: 1720242503:0;i-haklab --about soy un jenio
: 1720242565:0;nvim include/command_line_argument_parser.h
: 1720242904:0;nvim src/below_zero.cpp
: 1720243273:0;bash build_sh.sh
: 1720243332:0;i-haklab
: 1720243338:0;i-haklab --help
: 1720243353:0;nvim include/command_line_argument_parser.h
: 1720243490:0;bash build_sh.sh
: 1720243525:0;nvim include/command_line_argument_parser.h
: 1720243548:0;nvim src/below_zero.cpp
: 1720243600:0;bat include/syntax.h
: 1720243758:0;bash build_sh.sh
: 1720243836:0;i-haklab --help
: 1720243852:0;i-haklab --about
: 1720243857:0;fg
: 1720243882:0;nvim include/command_line_argument_parser.h
: 1720244051:0;nvim src/below_zero.cpp
: 1720244079:0;nvim include/command_line_argument_parser.h
: 1720244145:0;bash build_sh.sh
: 1720244210:0;i-haklab --about
: 1720244218:0;i-haklab --help
: 1720244239:0;i-haklab --about rax2
: 1720244245:0;i-haklab --about ra
: 1720244262:0;rax2
: 1720244287:0;nvim include/below_zero.h
: 1720244298:0;git add --all
Binary file modified build/CMakeFiles/i-haklab.dir/main.cpp.o
Binary file not shown.
Binary file modified build/i-haklab
Binary file not shown.
Binary file modified build/src/CMakeFiles/below_zero.dir/below_zero.cpp.o
Binary file not shown.
Binary file modified build/src/libbelow_zero.so
Binary file not shown.
4 changes: 2 additions & 2 deletions include/below_zero.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ static void k_boom(int signum);
*/
void runCommand(const string &command);

class Haklab {
class Haklab : public command_line_argument_parser {
private:
void os_check();
public:
Haklab() = default;
int run(int argc, const char *argv[]);
// void ctrl_c() { signal(SIGINT, k_boom); }
void about(fs::path db, string commad);
string about(fs::path db, string commad);
template <typename Func> void Loading(Func func);
}; // end class

Expand Down
18 changes: 13 additions & 5 deletions include/command_line_argument_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ class arguments {

class command_line_argument_parser {
private:
boost::program_options::options_description desc;

boost::program_options::options_description desc{"Options"};
boost::program_options::options_description info{"Info"};
boost::program_options::options_description All;
public:
command_line_argument_parser() {
desc.add_options()
(arguments::help_option, "Show message and exit" )
(arguments::about_option_name, boost::program_options::value<vector<string>>()->value_name("commd"),
(arguments::help_option, "Show message and exit" );
info.add_options()
(arguments::about_option_name, boost::program_options::value<string>()->value_name("commd"),
"Show informations about tool/framework");
}

Expand All @@ -48,16 +50,22 @@ class command_line_argument_parser {
boost::program_options::positional_options_description p;
// p.add(arguments::files_option_name, -1);

All.add(desc).add(info);

boost::program_options::store(
boost::program_options::command_line_parser(argc, argv)
.options(desc)
.options(All)
.positional(p)
.run(),
variables);

boost::program_options::notify(variables);

return arguments(variables);
}

boost::program_options::options_description getDesc() const {
return desc;
}
};

Expand Down
18 changes: 11 additions & 7 deletions src/below_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ int Haklab::run(int argc,const char *argv[]){
}

if (args.help()){
// command_line_argument_parser::
cout << getDesc() << endl;
}

cout << "Username set to '" << args.about() << "'" << endl;

if (std::strlen(args.about().c_str()) > 0){
fs::path db = string(getenv("HOME")) + "/.local/etc/i-Haklab/Tools/Readme";
startSyntax(about(db , args.about().c_str()));
}


} catch (po::error &ex) {
Expand Down Expand Up @@ -54,8 +56,8 @@ void k_boom(int signum){
'-=k-boom!!='
|; :|
_____.,-#########-,._____⏎)";
startSyntax(k_boom);
exit(1);
// startSyntax(k_boom);
exit(1);
}

template <typename Func>
Expand All @@ -80,23 +82,25 @@ void runCommand(const string &command){
}


void Haklab::about(fs::path db, string command){
string Haklab::about(fs::path db, string command){
if (!fs::is_directory(db)) {
cerr << "[ERROR] No found " << db << endl;
};
string txtCommand{};
db /= "/" + std::string(1, std::toupper(command[0]));
std::fstream fd(db.c_str() + string("/") + command.c_str() + ".md");
if (fd.is_open()) {
std::stringstream buffer;
buffer << fd.rdbuf();
fd.close();
startSyntax(buffer.str());
txtCommand = buffer.str();
} else {
cout << "Con la inicial " << command[0] << " tengo :" << endl;
for (fs::directory_entry &entry : fs::directory_iterator(db)) {
cout << entry.path().stem() << endl;
}
}
return txtCommand;
} // about


Expand Down

0 comments on commit d21f942

Please sign in to comment.