fix print type
This commit is contained in:
parent
fbf703b35c
commit
ea552af646
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue