[PR #5336] [MERGED] Import fmtlib/fmt@6.2.0, a C++20-style format library #26259

Open
opened 2026-01-31 09:14:59 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/5336
Author: @DHowett
Created: 4/13/2020
Status: ✅ Merged
Merged: 4/14/2020
Merged by: @DHowett-MSFT

Base: master ← Head: dev/duhowett/dep/fmt


📝 Commits (4)

  • f7b8955 Import fmtlib/fmt@6.2.0, a C++20-style format library
  • d47a1ae Consume fmt in the entire project
  • 32d70a7 ...
  • be32112 Add {fmt} to Notices

📊 Changes

24 files changed (+11495 additions, -4 deletions)

View changed files

📝 NOTICE.md (+39 -1)
📝 OpenConsole.sln (+24 -0)
➕ dep/fmt/LICENSE.rst (+27 -0)
➕ dep/fmt/MAINTAINER_README.md (+17 -0)
➕ dep/fmt/cgmanifest.json (+13 -0)
➕ dep/fmt/include/fmt/chrono.h (+1119 -0)
➕ dep/fmt/include/fmt/color.h (+568 -0)
➕ dep/fmt/include/fmt/compile.h (+595 -0)
➕ dep/fmt/include/fmt/core.h (+1789 -0)
➕ dep/fmt/include/fmt/format-inl.h (+1403 -0)
➕ dep/fmt/include/fmt/format.h (+3648 -0)
➕ dep/fmt/include/fmt/locale.h (+78 -0)
➕ dep/fmt/include/fmt/os.h (+392 -0)
➕ dep/fmt/include/fmt/ostream.h (+143 -0)
➕ dep/fmt/include/fmt/posix.h (+2 -0)
➕ dep/fmt/include/fmt/printf.h (+721 -0)
➕ dep/fmt/include/fmt/ranges.h (+387 -0)
➕ dep/fmt/src/format.cc (+176 -0)
➕ dep/fmt/src/os.cc (+316 -0)
📝 src/cascadia/WindowsTerminalUniversal/WindowsTerminalUniversal.vcxproj (+1 -1)

...and 4 more files

📄 Description

We received a request from our localization team to switch from
printf-style format strings (%s, %u) to format strings with positional
argument support. I've been hoping for a long time to take a dependency
on C++20's std::format, but we're just not somewhere we can do that.
Enter fmt. fmt is exactly the library we need.

Minor comparison:

then

std::wstring_view world = /* ... */;
auto str{ wil::str_printf<std::wstring>(L"hello %.*s",
	   gsl::narrow_cast<size_t>(world.size()),
	   world.data()) };

now

auto str{ fmt::format(L"hello {0}", world) };

If you really want to use the print specifiers:

auto str{ fmt::printf(L"hello %s", world) };

It's got optional compile-time checking for format strings and is
MIT-licensed. Eventually, we should be able to replace fmt:: with std::
and end up pretty much where we left off.
What more could you ask for?

It has a header-only mode, but it seemed easier on the compiler (and the
linker) to throw together a quick static library project that produces
the source-level components of fmt.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/5336 **Author:** [@DHowett](https://github.com/DHowett) **Created:** 4/13/2020 **Status:** ✅ Merged **Merged:** 4/14/2020 **Merged by:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Base:** `master` ← **Head:** `dev/duhowett/dep/fmt` --- ### 📝 Commits (4) - [`f7b8955`](https://github.com/microsoft/terminal/commit/f7b8955842d831c4b45d6ae84b2d402a2f22a7f9) Import fmtlib/fmt@6.2.0, a C++20-style format library - [`d47a1ae`](https://github.com/microsoft/terminal/commit/d47a1ae793288c16e5c23fbd6778b8895ee63bc7) Consume fmt in the entire project - [`32d70a7`](https://github.com/microsoft/terminal/commit/32d70a7b374d97a88b2b903709375992bcb946b1) ... - [`be32112`](https://github.com/microsoft/terminal/commit/be32112fe7a48d2173c4add05f755a3afb18a0bb) Add {fmt} to Notices ### 📊 Changes **24 files changed** (+11495 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `NOTICE.md` (+39 -1) 📝 `OpenConsole.sln` (+24 -0) ➕ `dep/fmt/LICENSE.rst` (+27 -0) ➕ `dep/fmt/MAINTAINER_README.md` (+17 -0) ➕ `dep/fmt/cgmanifest.json` (+13 -0) ➕ `dep/fmt/include/fmt/chrono.h` (+1119 -0) ➕ `dep/fmt/include/fmt/color.h` (+568 -0) ➕ `dep/fmt/include/fmt/compile.h` (+595 -0) ➕ `dep/fmt/include/fmt/core.h` (+1789 -0) ➕ `dep/fmt/include/fmt/format-inl.h` (+1403 -0) ➕ `dep/fmt/include/fmt/format.h` (+3648 -0) ➕ `dep/fmt/include/fmt/locale.h` (+78 -0) ➕ `dep/fmt/include/fmt/os.h` (+392 -0) ➕ `dep/fmt/include/fmt/ostream.h` (+143 -0) ➕ `dep/fmt/include/fmt/posix.h` (+2 -0) ➕ `dep/fmt/include/fmt/printf.h` (+721 -0) ➕ `dep/fmt/include/fmt/ranges.h` (+387 -0) ➕ `dep/fmt/src/format.cc` (+176 -0) ➕ `dep/fmt/src/os.cc` (+316 -0) 📝 `src/cascadia/WindowsTerminalUniversal/WindowsTerminalUniversal.vcxproj` (+1 -1) _...and 4 more files_ </details> ### 📄 Description We received a request from our localization team to switch from printf-style format strings (%s, %u) to format strings with positional argument support. I've been hoping for a long time to take a dependency on C++20's std::format, but we're just not somewhere we can do that. Enter fmt. fmt is _exactly_ the library we need. Minor comparison: ### then ```c++ std::wstring_view world = /* ... */; auto str{ wil::str_printf<std::wstring>(L"hello %.*s", gsl::narrow_cast<size_t>(world.size()), world.data()) }; ``` ### now ```c++ auto str{ fmt::format(L"hello {0}", world) }; ``` If you really want to use the print specifiers: ``` auto str{ fmt::printf(L"hello %s", world) }; ``` It's got optional compile-time checking for format strings and is MIT-licensed. Eventually, we should be able to replace fmt:: with std:: and end up pretty much where we left off. What more could you ask for? It has a header-only mode, but it seemed easier on the compiler (and the linker) to throw together a quick static library project that produces the source-level components of fmt. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:14:59 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26259