diff --git a/src/cascadia/TerminalApp/AppCommandlineArgs.cpp b/src/cascadia/TerminalApp/AppCommandlineArgs.cpp index 0d8dbec1a71..691c50c2cf9 100644 --- a/src/cascadia/TerminalApp/AppCommandlineArgs.cpp +++ b/src/cascadia/TerminalApp/AppCommandlineArgs.cpp @@ -315,6 +315,9 @@ void AppCommandlineArgs::_addNewTerminalArgs(AppCommandlineArgs::NewTerminalSubc subcommand.startingDirectoryOption = subcommand.subcommand->add_option("-d,--startingDirectory", _startingDirectory, RS_A(L"CmdStartingDirArgDesc")); + subcommand.titleOption = subcommand.subcommand->add_option("--title", + _startingTitle, + RS_A(L"CmdTitleArgDesc")); // Using positionals_at_end allows us to support "wt new-tab -d wsl -d Ubuntu" // without CLI11 thinking that we've specified -d twice. @@ -372,6 +375,11 @@ NewTerminalArgs AppCommandlineArgs::_getNewTerminalArgs(AppCommandlineArgs::NewT args->StartingDirectory(winrt::to_hstring(_startingDirectory)); } + if (*subcommand.titleOption) + { + args->TabTitle(winrt::to_hstring(_startingTitle)); + } + return *args; } @@ -402,6 +410,7 @@ void AppCommandlineArgs::_resetStateToDefault() { _profileName.clear(); _startingDirectory.clear(); + _startingTitle.clear(); _commandline.clear(); _splitVertical = false; diff --git a/src/cascadia/TerminalApp/AppCommandlineArgs.h b/src/cascadia/TerminalApp/AppCommandlineArgs.h index 1a46d644b8a..a9e81fc9ff5 100644 --- a/src/cascadia/TerminalApp/AppCommandlineArgs.h +++ b/src/cascadia/TerminalApp/AppCommandlineArgs.h @@ -51,6 +51,7 @@ class TerminalApp::AppCommandlineArgs final CLI::Option* commandlineOption; CLI::Option* profileNameOption; CLI::Option* startingDirectoryOption; + CLI::Option* titleOption; }; // --- Subcommands --- @@ -64,6 +65,7 @@ class TerminalApp::AppCommandlineArgs final std::string _profileName; std::string _startingDirectory; + std::string _startingTitle; // _commandline will contain the command line with which we'll be spawning a new terminal std::vector _commandline; diff --git a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw index bdc3cf861e8..f72593eedb0 100644 --- a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw @@ -256,6 +256,10 @@ Open in the given directory instead of the profile's set "startingDirectory" {Locked="\"startingDirectory\""} + + Open the terminal with the provided title instead of the profile's set "title" + {Locked="\"title\""} + Display the application version