Replace /FWPARS argument with /X as "daxgames" request.

This commit is contained in:
Ezio 2019-05-19 22:54:47 +02:00
parent 5def1c584a
commit 543c7ca6e9
3 changed files with 18 additions and 11 deletions

View File

@ -2,6 +2,12 @@
## [Unreleased] ## [Unreleased]
* Question issue: [#2094](https://github.com/cmderdev/cmder/issues/2094)
* Pull Request : [#2096](https://github.com/cmderdev/cmder/pull/2096)
* New argument created to ConEmu forwarding arguments.
* Syntax: `/x [ConEmu extras arguments]`
* e.g.: `Cmder.exe /x "-min -tsa"`
### Fixes ### Fixes
* Pull Request: [#2002](https://github.com/cmderdev/cmder/pull/2002) * Pull Request: [#2002](https://github.com/cmderdev/cmder/pull/2002)

View File

@ -50,7 +50,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can
| `/SINGLE` | Start Cmder in single mode. | | `/SINGLE` | Start Cmder in single mode. |
| `/START [start_path]` | Folder path to start in. | | `/START [start_path]` | Folder path to start in. |
| `/TASK [task_name]` | Task to start after launch. | | `/TASK [task_name]` | Task to start after launch. |
| `/FWPARS [ConEmu params]` | Forwads parameters to ConEmu | | `/X [ConEmu extras pars]` | Forwads parameters to ConEmu |
## Context Menu Integration ## Context Menu Integration

View File

@ -71,7 +71,7 @@ bool FileExists(const wchar_t * filePath)
return false; return false;
} }
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring pars2fw = L"") void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"")
{ {
#if USE_TASKBAR_API #if USE_TASKBAR_API
wchar_t appId[MAX_PATH] = { 0 }; wchar_t appId[MAX_PATH] = { 0 };
@ -98,7 +98,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
std::wstring cmderStart = path; std::wstring cmderStart = path;
std::wstring cmderTask = taskName; std::wstring cmderTask = taskName;
std::wstring cmderPars2CEmu = pars2fw; std::wstring cmderConEmuArgs = conemu_args;
std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath); std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath);
userConfigDirPath[cfgRoot.length()] = 0; userConfigDirPath[cfgRoot.length()] = 0;
@ -392,9 +392,9 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath); swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath);
} }
if (!streqi(cmderPars2CEmu.c_str(), L"")) if (!streqi(cmderConEmuArgs.c_str(), L""))
{ {
swprintf_s(args, L"%s %s", args, cmderPars2CEmu.c_str()); swprintf_s(args, L"%s %s", args, cmderConEmuArgs.c_str());
} }
SetEnvironmentVariable(L"CMDER_ROOT", exeDir); SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
@ -533,7 +533,7 @@ struct cmderOptions
std::wstring cmderStart = L""; std::wstring cmderStart = L"";
std::wstring cmderTask = L""; std::wstring cmderTask = L"";
std::wstring cmderRegScope = L"USER"; std::wstring cmderRegScope = L"USER";
std::wstring cmderPars2CEmu = L""; std::wstring cmderConEmuArgs = L"";
bool cmderSingle = false; bool cmderSingle = false;
bool cmderUserCfg = true; bool cmderUserCfg = true;
bool registerApp = false; bool registerApp = false;
@ -627,9 +627,10 @@ cmderOptions GetOption()
} }
} }
} }
else if (_wcsicmp(L"/fwpars", szArgList[i]) == 0) /* Used for passing arguments to conemu prog */
else if (_wcsicmp(L"/x", szArgList[i]) == 0)
{ {
cmderOptions.cmderPars2CEmu = szArgList[i + 1]; cmderOptions.cmderConEmuArgs = szArgList[i + 1];
i++; i++;
} }
else if (cmderOptions.cmderStart == L"") else if (cmderOptions.cmderStart == L"")
@ -647,13 +648,13 @@ cmderOptions GetOption()
} }
else else
{ {
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /fwpars [ConEmu parameters to fw]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
cmderOptions.error = true; cmderOptions.error = true;
} }
} }
else else
{ {
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /fwpars [ConEmu parameters to fw]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK); MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
cmderOptions.error = true; cmderOptions.error = true;
} }
} }
@ -695,7 +696,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
} }
else else
{ {
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderPars2CEmu); StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderConEmuArgs);
} }
return 0; return 0;