Skip to content

Commit

Permalink
#493 "-attach" command line switch.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbucher committed Aug 12, 2018
1 parent 8842a6f commit bdfd53b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
18 changes: 18 additions & 0 deletions Console/MainFrame.cpp
Expand Up @@ -151,6 +151,11 @@ void MainFrame::ParseCommandLine
}
}
}
else if( std::wstring(argv[i]) == std::wstring(L"-attach") )
{
// attach consoles
commandLineOptions.bAttachConsoles = true;
}
}

// make sure that startupTabTitles, startupDirs, and startupShellArgs are at least as big as startupTabs
Expand Down Expand Up @@ -266,6 +271,19 @@ LRESULT MainFrame::CreateInitialTabs

TabSettings& tabSettings = g_settingsHandler->GetTabSettings();

// attach consoles
if( commandLineOptions.bAttachConsoles )
{
::EnumWindows(MainFrame::ConsoleEnumWindowsProc, reinterpret_cast<LPARAM>(this));

bAtLeastOneStarted = !m_tabs.empty();

// if no tabs defined in command line
// then stop here
if( commandLineOptions.startupTabs.empty() )
return bAtLeastOneStarted ? 0 : -1;
}

// create initial console window(s)
if (commandLineOptions.startupTabs.empty() && commandLineOptions.startupWorkspaces.empty())
{
Expand Down
2 changes: 2 additions & 0 deletions Console/MainFrame.h
Expand Up @@ -45,6 +45,7 @@ struct CommandLineOptions
, visibility(ShowHideWindowAction::SHWA_DONOTHING)
, strWorkingDir()
, strEnvironment()
, bAttachConsoles(false)
{
}

Expand All @@ -59,6 +60,7 @@ struct CommandLineOptions
ShowHideWindowAction visibility;
std::wstring strWorkingDir;
std::wstring strEnvironment;
bool bAttachConsoles;
};

//////////////////////////////////////////////////////////////////////////////
Expand Down
28 changes: 18 additions & 10 deletions help/html/running.html
Expand Up @@ -9,14 +9,14 @@

<body>
<h1>Running ConsoleZ</h1>
<!--
<p>
Console setup creates shortcuts in the Start menu (Console group), on
the desktop and in the quick launch bar. Any of these shortcuts will
run ConsoleZ with its default configuration, read from console.xml file
located in ConsoleZ program directory.
</p>
-->
<!--
<p>
Console setup creates shortcuts in the Start menu (Console group), on
the desktop and in the quick launch bar. Any of these shortcuts will
run ConsoleZ with its default configuration, read from console.xml file
located in ConsoleZ program directory.
</p>
-->
<h2>Command line parameters</h2>

<p>
Expand Down Expand Up @@ -125,15 +125,23 @@ <h2>Command line parameters</h2>
</p>
<br />

<p class="block-row-name">-i</p>
<p class="block-row-description">
Specifies the instance name.
</p>
<br />

<p class="block-row-name">-reuse</p>
<p class="block-row-description">
Reuses another instance, if any exists, instead of starting a new one.
</p>
<br />

<p class="block-row-name">-i</p>
<p class="block-row-name">-attach</p>
<p class="block-row-description">
Specifies the instance name.
Attaches consoles to ConsoleZ. Each console is added in a new tab.
Only consoles that are not attached to an instance of ConsoleZ are selected.
ConsoleZ must have rights to hook console application.
</p>
<br />

Expand Down

0 comments on commit bdfd53b

Please sign in to comment.