Support partial substitution in `substitute`

未关闭
#1,322 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
cpp
领域
tooling

调研方向

从 utils.substitute 入口点开始,审查当前基于 libfmt 的实现及其中引用的限制。定义并验证部分替换、默认值和可选子字符串所需的行为,并通过测试和文档覆盖约定的语法及验收结果。

由索引模型根据 Issue 内容生成。

描述

difficulty/hard good first issue help wanted

What

  • Allow partial substitution in utils.substitute without throwing an exception, e.g. such that we can do substitute("image.{frame}.{view}.exr", {"view": "right"}) == "image.{frame}.right.exr".
  • Support for providing a default value, e.g. {variable:format-default} - TSC feedback
  • Enhance syntax to support optional substrings e.g. /mnt</lhs{show}/rhs>/file, where /lhs and /rhs won't print if {show} is not provided - TSC feedback.

Why

We suspect that partial, or gradual, substitution will be useful in OpenAssetIO, especially in the context of serialisation and multi-component systems. However, the current implementation relies on libfmt, which does not support this in its public interface.

If a substitution variable is not provided, the source of the string (host/manager) may wish to provide a good default.

To make strings more re-usable e.g. across different but related file system layouts, it's useful to have a mechanism to make substrings around a token only printed when the token is substituted.

主要语言
C++
星标
352
派生
48
平均合并
4 天 14 小时
30 天内合并 PR
5

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OpenAssetIO/OpenAssetIO 的其他 Issue

查看 OpenAssetIO/OpenAssetIO 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。