Massive reformating and cleanup

This commit is contained in:
2024-12-06 21:07:54 +01:00
parent 79390b94b7
commit d2cbdc2910
33 changed files with 1030 additions and 1100 deletions

View File

@ -3,44 +3,38 @@
namespace fsh {
void CommandNode::print(int indent) {
std::string t = "";
for(int i=0; i<indent;i++) {
t+="\t";
void CommandNode::print(int indent) {
std::string t = "";
for (int i = 0; i < indent; i++) { t += "\t"; }
std::cout << t << gname() << "\n";
std::cout << t << "\tCommand_Name = " << cmd_name << "\n";
if (flag) std::cout << t << "\tFlagOpt = " << *flag << "\n";
for (const auto& x : args)
std::cout << t << "\tArgs: " << x->gvalue() << " " << util::tokens[x->gtoken_type()] << "\n";
if (redirects) {
auto out = redirects->goutput();
auto in = redirects->ginput();
if (in) std::cout << t << "\tinput = " << *in << "\n";
if (out) std::cout << t << "\toutput = " << *out << " " << redirects->gappend() << "\n";
}
}
std::cout<<t<< gname() << "\n";
std::cout<<t<<"\tCommand_Name = " << cmd_name << "\n";
if(flag) std::cout<<t<<"\tFlagOpt = " << *flag << "\n";
for(const auto& x : args)
std::cout<<t<<"\tArgs: " << x->gvalue() <<" "<< util::tokens[x->gtoken_type()]<< "\n";
if(redirects) {
auto out = redirects->goutput();
auto in = redirects->ginput();
if(in) std::cout<<t<<"\tinput = " << *in << "\n";
if(out) std::cout<<t<<"\toutput = " << *out << " " << redirects->gappend() << "\n";
}
}
void PipeLineNode::print(int indent) {
std::string t = "";
for(int i=0; i<indent;i++) {
t+="\t";
void PipeLineNode::print(int indent) {
std::string t = "";
for (int i = 0; i < indent; i++) { t += "\t"; }
std::cout << t << gname() << "\n";
std::cout << "left_cmd:\n";
if (l_command) l_command->print(indent + 1);
std::cout << "right_cmd:\n";
if (r_command) r_command->print(indent + 1);
}
std::cout<<t<< gname() << "\n";
std::cout<<"left_cmd:\n";
if(l_command) l_command->print(indent + 1);
std::cout<<"right_cmd:\n";
if(r_command) r_command->print(indent + 1);
}
void CommandLineNode::print(int indent) {
std::string t = "";
for(int i=0; i<indent;i++) {
t+="\t";
void CommandLineNode::print(int indent) {
std::string t = "";
for (int i = 0; i < indent; i++) { t += "\t"; }
std::cout << t << gname() << "\n";
if (command) command->print(indent + 1);
if (pipe) pipe->print(indent + 1);
}
std::cout<<t<< gname() << "\n";
if(command) command->print(indent + 1);
if(pipe) pipe->print(indent + 1);
}
}