mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CLI: Added A2::dump
This commit is contained in:
parent
01bbc3d915
commit
8913eaf96f
2 changed files with 21 additions and 0 deletions
20
src/CLI.cpp
20
src/CLI.cpp
|
@ -79,6 +79,26 @@ const std::string A2::attribute (const std::string& name) const
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
const std::string A2::dump () const
|
||||||
|
{
|
||||||
|
auto output = Lexer::typeToString (_lextype);
|
||||||
|
|
||||||
|
// Dump attributes.
|
||||||
|
std::string atts;
|
||||||
|
for (const auto& a : _attributes)
|
||||||
|
atts += a.first + "='\033[33m" + a.second + "\033[0m' ";
|
||||||
|
|
||||||
|
// Dump tags.
|
||||||
|
std::string tags;
|
||||||
|
for (const auto& tag : _tags)
|
||||||
|
{
|
||||||
|
tags += "\033[32m" + tag + "\033[0m ";
|
||||||
|
}
|
||||||
|
|
||||||
|
return output + " " + atts + tags;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CLI::entity (const std::string& category, const std::string& name)
|
void CLI::entity (const std::string& category, const std::string& name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
void unTag (const std::string&);
|
void unTag (const std::string&);
|
||||||
void attribute (const std::string&, const std::string&);
|
void attribute (const std::string&, const std::string&);
|
||||||
const std::string attribute (const std::string&) const;
|
const std::string attribute (const std::string&) const;
|
||||||
|
const std::string dump () const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Lexer::Type _lextype {Lexer::Type::word};
|
Lexer::Type _lextype {Lexer::Type::word};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue