Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for --title to the wt.exe commandline args #6296

Merged
1 commit merged into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/cascadia/TerminalApp/AppCommandlineArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -402,6 +410,7 @@ void AppCommandlineArgs::_resetStateToDefault()
{
_profileName.clear();
_startingDirectory.clear();
_startingTitle.clear();
_commandline.clear();

_splitVertical = false;
Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/TerminalApp/AppCommandlineArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class TerminalApp::AppCommandlineArgs final
CLI::Option* commandlineOption;
CLI::Option* profileNameOption;
CLI::Option* startingDirectoryOption;
CLI::Option* titleOption;
};

// --- Subcommands ---
Expand All @@ -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<std::string> _commandline;
Expand Down
4 changes: 4 additions & 0 deletions src/cascadia/TerminalApp/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@
<value>Open in the given directory instead of the profile's set "startingDirectory"</value>
<comment>{Locked="\"startingDirectory\""}</comment>
</data>
<data name="CmdTitleArgDesc" xml:space="preserve">
<value>Open the terminal with the provided title instead of the profile's set "title"</value>
<comment>{Locked="\"title\""}</comment>
</data>
<data name="CmdVersionDesc" xml:space="preserve">
<value>Display the application version</value>
</data>
Expand Down