Added shell detection for alias

This commit is contained in:
reallynniroprobably
2026-03-16 21:12:00 +11:00
parent 3b3e53f02b
commit 35dea6d6b0

View File

@@ -1,3 +1,5 @@
#include <filesystem>
#include <ios>
#include <iostream>
#include <string>
#include <vector>
@@ -42,5 +44,21 @@ int main(int argc, char *argv[]) {
for (int i = 0; i < tokens.size(); i++) {
std::cout << i + 1 << ". " << tokens[i] << "\n";
}
if (std::getenv("BASH_VERSION")) {
std::cout << "Running under bash\n";
} else if (std::getenv("ZSH_VERSION")) {
std::cout << "Running under zsh\n";
} else if (std::getenv("FISH_VERSION")) {
std::cout << "Running under fish\n";
} else {
const char* shell = std::getenv("SHELL");
if (shell) {
std::cout << "Default shell: " << shell << "\n";
} else {
std::cout << "Shell could not be detected\n";
}
}
return 0;
}