dnf/SOURCES/0060-Document-shell-like-parameter-expansion-for-variable.patch

40 lines
1.4 KiB
Diff

From 41843856d1f09c8fe718630a6fa4318441c7be38 Mon Sep 17 00:00:00 2001
From: Evan Goode <mail@evangoo.de>
Date: Mon, 16 Oct 2023 18:44:53 +0000
Subject: [PATCH 04/11] Document shell-like parameter expansion for variables
=changelog=
msg: Support ${parameter:-word} and ${parameter:+word} parameter expansion in variables
type: enhancement
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1789346
---
doc/conf_ref.rst | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/doc/conf_ref.rst b/doc/conf_ref.rst
index 9397f0008..fdb34323c 100644
--- a/doc/conf_ref.rst
+++ b/doc/conf_ref.rst
@@ -829,6 +829,18 @@ Although users are encouraged to use named variables, the numbered environmental
[myrepo]
baseurl=https://example.site/pub/fedora/$DNF1/releases/$releasever
+A limited form of shell-like parameter expansion is supported for variables.
+
+``${my_variable:-word}`` If ``my_variable`` is unset or empty, then ``word`` will be substituted. Otherwise, the value of ``my_variable`` will be substituted.
+
+``${my_variable:+word}`` If ``my_variable`` is set and not empty, then ``word`` will be substituted. Otherwise, the empty string will be substituted.
+
+Parameter expansions can be nested up to a maximum depth of 32. For example::
+
+ ${my_defined_variable:+${my_undefined_variable:-foobar}}
+
+will evaluate to ``foobar``.
+
.. _conf_main_and_repo_options-label:
--
2.49.0