fix print type

This commit is contained in:
Joseph Aquino 2025-12-25 19:32:34 -05:00
parent fbf703b35c
commit ea552af646
2 changed files with 4 additions and 6 deletions

View File

@ -15,7 +15,6 @@ int main()
while (!exit)
{
std::string input;
std::cout << std::unitbuf;
std::cout << "$ ";
std::getline(std::cin, input);
std::optional<std::string> result;

View File

@ -61,22 +61,21 @@ namespace sh
void printType(const std::string& input)
{
const std::string_view command {input.substr(0, input.find(' '))};
if (commandMap.contains(command))
if (commandMap.contains(input))
{
std::cout << command;
std::cout << input;
std::cout << " is a shell builtin\n";
return;
}
if (const auto fullPath {isExec(input)})
{
std::cout << command;
std::cout << input;
std::cout << " is " << fullPath.value() << "\n";
return;
}
std::cout << command;
std::cout << input;
std::cout << ": not found\n";
}
}