Skip to content

Commit 8e21510

Browse files
authored
Merge pull request #76 from olehermanse/macros
2 parents 0d1eb02 + 55e9d94 commit 8e21510

3 files changed

Lines changed: 52 additions & 0 deletions

File tree

src/cfengine_cli/format.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,9 @@ def _needs_blank_line_before(child: Node, indent: int, line_length: int) -> bool
606606
return prev.type == "bundle_section"
607607

608608
if child.type == "promise":
609+
# An @if macro already provides visual separation
610+
if prev.type == "macro" and text(prev).startswith("@if"):
611+
return False
609612
# Skip past macros to find the content-bearing previous sibling,
610613
# so we detect promise groups separated by macro-split halves.
611614
prev_content = prev

tests/format/011_macros.expected.cf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,29 @@ bundle agent half_with_comment
8383
string => "old_value";
8484
@endif
8585
}
86+
87+
bundle common cfe_internal_inputs
88+
# @brief Include internal self management policies
89+
{
90+
vars:
91+
enterprise_edition.(policy_server|am_policy_hub)::
92+
"input[enterprise_hub_specific]"
93+
string => "cfe_internal/enterprise/CFE_hub_specific.cf",
94+
comment => "Lorem ipsum.";
95+
@if minimum_version(3.12.0)
96+
"input[enterprise_hub_federation]"
97+
string => "cfe_internal/enterprise/federation/federation.cf",
98+
comment => "Lorem ipsum.";
99+
@endif
100+
enterprise_edition::
101+
"input[enterprise_knowledge]"
102+
string => "cfe_internal/enterprise/CFE_knowledge.cf",
103+
comment => "Lorem ipsum.";
104+
105+
"input[enterprise_main]"
106+
string => "cfe_internal/enterprise/main.cf",
107+
comment => "Lorem ipsum.";
108+
109+
any::
110+
"inputs" slist => getvalues("input");
111+
}

tests/format/011_macros.input.cf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,26 @@ string => "new_value";
8282
string => "old_value";
8383
@endif
8484
}
85+
bundle common cfe_internal_inputs
86+
# @brief Include internal self management policies
87+
{
88+
vars:
89+
enterprise_edition.(policy_server|am_policy_hub)::
90+
"input[enterprise_hub_specific]"
91+
string => "cfe_internal/enterprise/CFE_hub_specific.cf",
92+
comment => "Lorem ipsum.";
93+
@if minimum_version(3.12.0)
94+
"input[enterprise_hub_federation]"
95+
string => "cfe_internal/enterprise/federation/federation.cf",
96+
comment => "Lorem ipsum.";
97+
@endif
98+
enterprise_edition::
99+
"input[enterprise_knowledge]"
100+
string => "cfe_internal/enterprise/CFE_knowledge.cf",
101+
comment => "Lorem ipsum.";
102+
"input[enterprise_main]"
103+
string => "cfe_internal/enterprise/main.cf",
104+
comment => "Lorem ipsum.";
105+
any::
106+
"inputs" slist => getvalues("input");
107+
}

0 commit comments

Comments
 (0)