diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-10-04 18:05:36 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-10-05 09:28:37 +0000 |
commit | be10e08a2fcb0610f12e43571cc8c58b0802da62 (patch) | |
tree | 4f6d585f6dfa8fe89354bad730cd2c612cab7734 /src/app | |
parent | e62cb46a6bed9284dc026f232563ecba373239d9 (diff) |
Fix shell command
- Use the build environment rather than the system environment (that's
the whole point of the command).
- Remove the need for a specific product.
- Use a more sensible prompt.
- Strip down the list of supported options.
- Fix typo in comment.
Change-Id: I8e4040d44ab6a95e60a7265e05d5b66fb3dfa878
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/qbs/commandlinefrontend.cpp | 11 | ||||
-rw-r--r-- | src/app/qbs/parser/parsercommand.cpp | 7 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/app/qbs/commandlinefrontend.cpp b/src/app/qbs/commandlinefrontend.cpp index 261863c38..231bbebe9 100644 --- a/src/app/qbs/commandlinefrontend.cpp +++ b/src/app/qbs/commandlinefrontend.cpp @@ -425,7 +425,16 @@ void CommandLineFrontend::makeClean() int CommandLineFrontend::runShell() { - const ProductData productToRun = getTheOneRunnableProduct(); + ProductData productToRun; + switch (m_parser.products().count()) { + case 0: // No specific product, use project-global environment. + break; + case 1: + productToRun = productsToUse().values().first().first(); + break; + default: + throw ErrorInfo(Tr::tr("The command '%1' cannot take more than one product.")); + } RunEnvironment runEnvironment = m_projects.first().getRunEnvironment(productToRun, m_parser.installOptions(m_projects.first().profile()), QProcessEnvironment::systemEnvironment(), m_settings); diff --git a/src/app/qbs/parser/parsercommand.cpp b/src/app/qbs/parser/parsercommand.cpp index 75b385348..70d6893d9 100644 --- a/src/app/qbs/parser/parsercommand.cpp +++ b/src/app/qbs/parser/parsercommand.cpp @@ -420,9 +420,6 @@ QString ShellCommand::longDescription() const .arg(representation()); description += Tr::tr("Opens a shell in the same environment that a build with the given " "parameters would use.\n"); - const ProductsOption * const option = optionPool().productsOption(); - description += Tr::tr("The '%1' option may be omitted if and only if the project has " - "exactly one product.").arg(option->longRepresentation()); return description += supportedOptionsDescription(); } @@ -436,10 +433,6 @@ QList<CommandLineOption::Type> ShellCommand::supportedOptions() const return QList<CommandLineOption::Type>() << CommandLineOption::FileOptionType << CommandLineOption::BuildDirectoryOptionType - << CommandLineOption::LogLevelOptionType - << CommandLineOption::VerboseOptionType - << CommandLineOption::QuietOptionType - << CommandLineOption::ShowProgressOptionType << CommandLineOption::ProductsOptionType; } |