Skip to content

Commit a424c52

Browse files
committed
Pass color setting to tags table
1 parent 106b451 commit a424c52

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/TagsTable.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ TagsTable::Builder& TagsTable::Builder::withTagDescriptions (std::vector <TagDes
4040
return *this;
4141
}
4242

43+
////////////////////////////////////////////////////////////////////////////////
44+
TagsTable::Builder& TagsTable::Builder::withColor (bool forceColor)
45+
{
46+
_force_color = forceColor;
47+
return *this;
48+
}
49+
4350
////////////////////////////////////////////////////////////////////////////////
4451
Table TagsTable::Builder::build ()
4552
{
@@ -51,6 +58,11 @@ Table TagsTable::Builder::build ()
5158
table.add ("Tag");
5259
table.add ("Description");
5360

61+
if (_force_color)
62+
{
63+
table.forceColor ();
64+
}
65+
5466
for (const auto& tagDescription : _tagDescriptions)
5567
{
5668
auto row = table.addRow ();

src/TagsTable.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ class TagsTable
3737
{
3838
public:
3939
Builder& withTagDescriptions (std::vector <TagDescription>&);
40+
Builder& withColor (bool);
4041

4142
Table build ();
4243

4344
private:
4445
std::vector <TagDescription> _tagDescriptions {};
46+
bool _force_color {false};
4547
};
4648

4749
public:

src/commands/CmdTags.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ int CmdTags (
8080

8181
auto table = TagsTable::builder()
8282
.withTagDescriptions (tagDescriptions)
83+
.withColor (rules.getBoolean ("color"))
8384
.build ();
8485

8586
std::cout << '\n'

0 commit comments

Comments
 (0)