Commit Graph

28 Commits

Author SHA1 Message Date
Martchus a19ee41a39 Apply cmake-format and clang-format 2023-05-16 21:39:10 +02:00
Martchus 0d0685d4c7 Simplify workaround for starting console and CLI-wrapper
* Disable workaround by default; with the CLI-wrapper available it makes no
  sense to run this code unnecassarily when the main executable is invoked
    * Remove check for Mintty; with the workaround disabled by default it
      is no longer necassary to avoid it
* Simplify the CLI-wrapper to rely on main application for enabling UTF-8
  and virtual terminal processing as it relies on it for attaching to the
  parent's console anyways
2023-05-09 00:16:28 +02:00
Martchus caace3ac63 Improve workaround for starting console from GUI app
It is still not perfect but now at least:

* Redirections to a file and pipes are no longer broken with `cmd.exe`
* Pipes are no longer broken in PowerShell
* It works at all when using MSVC
* The whole workaround is skipped for Mintty (as it is not needed at all)
* Sending a return key to the terminal in the end has been removed as it
  caused more harm than good in certain terminals and did not work in
  terminals other than `cmd.exe` anyways
2023-05-07 20:39:22 +02:00
Martchus 5e325d0b92 Avoid unqualified call to `std::move` 2023-05-05 01:06:06 +02:00
Martchus da830dcef5 Apply clang-format and cmake-format 2023-01-28 20:20:47 +01:00
Martchus d1eeae83c6 Fix includes for command-line utilities
Most importantly, import `io.h` under Windows as it is required for using
`_open_osfhandle`.
2023-01-26 22:26:42 +01:00
Martchus 0cf59b654b Make `isEnvVariableSet()` public API 2022-10-08 22:29:32 +02:00
Martchus b1b811c57f Apply clang-format 2022-06-26 11:04:23 +02:00
Martchus 9e036a3f72 Allow enabling virtual terminal processing under Windows
* or disable use of ANSI-escape codes if not possible
* See https://github.com/Martchus/syncthingtray/issues/132
2022-06-07 16:46:54 +02:00
Martchus b3ebe5ce38 Fix typos found via `codespell --skip .git -w` 2021-07-03 19:07:49 +02:00
Martchus 1ac1104535 Add workaround for Windows-specific console problems
* Allow disabling the hack for creating a console for
  a GUI application via `ENABLE_CONSOLE=0` to workaround
  downsides of this hack (pipes not working, possibly
  spawns an additional console)
* Set the console's character set to UTF-8 by default
  because this actually seems to work now and
  non-ASCII characters are displayed correctly. There
  is still an opt-out via `ENABLE_CP_UTF8=0`.
* Note that with mintty it just works anyways so using
  that terminal emulator is still the best workaround.
2021-05-28 19:15:09 +02:00
Martchus b48b2f5c06 Have everything in one top-level namespace 2019-06-10 21:56:46 +02:00
Steven Penny e07782ae16 commandlineutils.cpp: correct rows and columns
From here:

http://docs.microsoft.com/windows/console/coord-str

- X is columns
- Y is rows

currently that is reversed with the codebase
2017-10-16 18:04:35 -05:00
Martchus 6e80640db5 Add method to determine terminal size 2017-09-29 20:56:50 +02:00
Martchus 37a84d64f1 Fix warnings about use of NULL in startConsole()
Can't fix warnings about old-style casts because those
macros are defined in windows headers.
2017-09-24 19:57:13 +02:00
Martchus db46948f2f Apply clang-format 2017-05-04 22:44:15 +02:00
Martchus 59e20b1043 Apply clang-format 2017-05-01 03:13:11 +02:00
Martchus 89e79275e0 Ensure the console prompt is shown when app terminates 2017-03-22 02:35:28 +01:00
Martchus 5dac8fc76b Improve startConsole()
* Also try to allocate new console
* Don't set buffer info (seems to have not
  effect anyways)
2017-03-22 02:09:27 +01:00
Martchus 9a395a45d3 Fix convertArgsToUtf8() 2017-03-22 00:59:34 +01:00
Martchus 737f73e71a Make forcing UTF-8 codepage optional 2016-12-24 16:08:09 +01:00
Martchus 59a8dfe833 Convert args to UTF-8 under Windows 2016-12-19 23:44:34 +01:00
Martchus 89cb027786 Ensure console output is UTF-8 under Windows 2016-12-19 23:43:24 +01:00
Martchus 03094a1f61 Add support for bash completion 2016-07-04 02:46:54 +02:00
Martchus 4d6bf67188 fixed includes 2015-09-06 20:19:09 +02:00
Martchus ae494cc425 added platform condition 2015-09-01 20:26:56 +02:00
Martchus 79faa46da0 added method to activate stdout/stderr for GUI app on Windows 2015-09-01 20:05:38 +02:00
Martchus f335c262b2 added commandline utilities 2015-06-24 00:44:16 +02:00