| 480 | } |
| 481 | |
| 482 | QString ExecuteTerminalCommandTool::getCommandDescription() const |
| 483 | { |
| 484 | const QStringList allowed = getAllowedCommands(); |
| 485 | const QString allowedList = allowed.isEmpty() ? "none" : allowed.join(", "); |
| 486 | |
| 487 | #ifdef Q_OS_LINUX |
| 488 | const QString osInfo = " Running on Linux."; |
| 489 | #elif defined(Q_OS_MACOS) |
| 490 | const QString osInfo = " Running on macOS."; |
| 491 | #elif defined(Q_OS_WIN) |
| 492 | const QString osInfo = " Running on Windows."; |
| 493 | #else |
| 494 | const QString osInfo = ""; |
| 495 | #endif |
| 496 | |
| 497 | return QString( |
| 498 | "Execute a terminal command in the project directory. " |
| 499 | "Only commands from the allowed list can be executed. " |
| 500 | "Currently allowed commands for this OS: %1. " |
| 501 | "The command will be executed in the root directory of the active project. " |
| 502 | "Commands have a %2 second timeout. " |
| 503 | "Returns the command output (stdout and stderr) or an error message if the command fails.%3") |
| 504 | .arg(allowedList) |
| 505 | .arg(commandTimeoutMs() / 1000) |
| 506 | .arg(osInfo); |
| 507 | } |
| 508 | |
| 509 | } // namespace QodeAssist::Tools |
| 510 | |