mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Legacy
- Moved more legacy checking code to legacy.cpp.
This commit is contained in:
parent
66ca9add3a
commit
4495e93f8d
3 changed files with 63 additions and 54 deletions
|
@ -187,69 +187,17 @@ int CmdCustom::execute (std::string& output)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
void CmdCustom::validateReportColumns (std::vector <std::string>& columns)
|
||||
{
|
||||
// One-time initialization, on demand.
|
||||
static std::map <std::string, std::string> legacyMap;
|
||||
if (! legacyMap.size ())
|
||||
{
|
||||
legacyMap["priority_long"] = "priority.long"; // Deprecated.
|
||||
legacyMap["entry_time"] = "entry"; // Deprecated.
|
||||
legacyMap["start_time"] = "start"; // Deprecated.
|
||||
legacyMap["end_time"] = "end"; // Deprecated.
|
||||
legacyMap["countdown"] = "due.countdown"; // Deprecated.
|
||||
legacyMap["countdown_compact"] = "due.countdown"; // Deprecated.
|
||||
legacyMap["age"] = "entry.age"; // Deprecated.
|
||||
legacyMap["age_compact"] = "entry.age"; // Deprecated.
|
||||
legacyMap["active"] = "start.active"; // Deprecated.
|
||||
legacyMap["recurrence_indicator"] = "recur.indicator"; // Deprecated.
|
||||
legacyMap["tag_indicator"] = "tags.indicator"; // Deprecated.
|
||||
legacyMap["description_only"] = "description.desc"; // Deprecated.
|
||||
}
|
||||
|
||||
std::vector <std::string>::iterator i;
|
||||
for (i = columns.begin (); i != columns.end (); ++i)
|
||||
{
|
||||
// If a legacy column was used, complain about it, but modify it anyway.
|
||||
std::map <std::string, std::string>::iterator found = legacyMap.find (*i);
|
||||
if (found != legacyMap.end ())
|
||||
{
|
||||
context.footnote (format (STRING_CMD_CUSTOM_OLD_FIELD, *i, found->second));
|
||||
*i = found->second;
|
||||
}
|
||||
}
|
||||
legacyColumnMap (*i);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void CmdCustom::validateSortColumns (std::vector <std::string>& columns)
|
||||
{
|
||||
// One-time initialization, on demand.
|
||||
static std::map <std::string, std::string> legacyMap;
|
||||
if (! legacyMap.size ())
|
||||
{
|
||||
legacyMap["priority_long"] = "priority"; // Deprecated
|
||||
legacyMap["entry_time"] = "entry"; // Deprecated
|
||||
legacyMap["start_time"] = "start"; // Deprecated
|
||||
legacyMap["end_time"] = "end"; // Deprecated
|
||||
legacyMap["countdown"] = "due"; // Deprecated
|
||||
legacyMap["countdown_compact"] = "due"; // Deprecated
|
||||
legacyMap["age"] = "entry"; // Deprecated
|
||||
legacyMap["age_compact"] = "entry"; // Deprecated
|
||||
legacyMap["active"] = "start"; // Deprecated
|
||||
legacyMap["recurrence_indicator"] = "recur"; // Deprecated
|
||||
legacyMap["tag_indicator"] = "tags"; // Deprecated
|
||||
legacyMap["description_only"] = "description"; // Deprecated
|
||||
}
|
||||
|
||||
std::vector <std::string>::iterator i;
|
||||
for (i = columns.begin (); i != columns.end (); ++i)
|
||||
{
|
||||
// If a legacy column was used, complain about it, but modify it anyway.
|
||||
std::map <std::string, std::string>::iterator found = legacyMap.find (*i);
|
||||
if (found != legacyMap.end ())
|
||||
{
|
||||
context.footnote (format (STRING_CMD_CUSTOM_OLD_SORT, *i, found->second));
|
||||
*i = found->second;
|
||||
}
|
||||
}
|
||||
legacySortColumnMap (*i);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -42,4 +42,63 @@ void legacyAttributeCheck (const std::string& name)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void legacyColumnMap (std::string& name)
|
||||
{
|
||||
// One-time initialization, on demand.
|
||||
static std::map <std::string, std::string> legacyMap;
|
||||
if (! legacyMap.size ())
|
||||
{
|
||||
legacyMap["priority_long"] = "priority.long"; // Deprecated.
|
||||
legacyMap["entry_time"] = "entry"; // Deprecated.
|
||||
legacyMap["start_time"] = "start"; // Deprecated.
|
||||
legacyMap["end_time"] = "end"; // Deprecated.
|
||||
legacyMap["countdown"] = "due.countdown"; // Deprecated.
|
||||
legacyMap["countdown_compact"] = "due.countdown"; // Deprecated.
|
||||
legacyMap["age"] = "entry.age"; // Deprecated.
|
||||
legacyMap["age_compact"] = "entry.age"; // Deprecated.
|
||||
legacyMap["active"] = "start.active"; // Deprecated.
|
||||
legacyMap["recurrence_indicator"] = "recur.indicator"; // Deprecated.
|
||||
legacyMap["tag_indicator"] = "tags.indicator"; // Deprecated.
|
||||
legacyMap["description_only"] = "description.desc"; // Deprecated.
|
||||
}
|
||||
|
||||
// If a legacy column was used, complain about it, but modify it anyway.
|
||||
std::map <std::string, std::string>::iterator found = legacyMap.find (name);
|
||||
if (found != legacyMap.end ())
|
||||
{
|
||||
context.footnote (format (STRING_CMD_CUSTOM_OLD_FIELD, name, found->second));
|
||||
name = found->second;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void legacySortColumnMap (std::string& name)
|
||||
{
|
||||
// One-time initialization, on demand.
|
||||
static std::map <std::string, std::string> legacyMap;
|
||||
if (! legacyMap.size ())
|
||||
{
|
||||
legacyMap["priority_long"] = "priority"; // Deprecated
|
||||
legacyMap["entry_time"] = "entry"; // Deprecated
|
||||
legacyMap["start_time"] = "start"; // Deprecated
|
||||
legacyMap["end_time"] = "end"; // Deprecated
|
||||
legacyMap["countdown"] = "due"; // Deprecated
|
||||
legacyMap["countdown_compact"] = "due"; // Deprecated
|
||||
legacyMap["age"] = "entry"; // Deprecated
|
||||
legacyMap["age_compact"] = "entry"; // Deprecated
|
||||
legacyMap["active"] = "start"; // Deprecated
|
||||
legacyMap["recurrence_indicator"] = "recur"; // Deprecated
|
||||
legacyMap["tag_indicator"] = "tags"; // Deprecated
|
||||
legacyMap["description_only"] = "description"; // Deprecated
|
||||
}
|
||||
|
||||
// If a legacy column was used, complain about it, but modify it anyway.
|
||||
std::map <std::string, std::string>::iterator found = legacyMap.find (name);
|
||||
if (found != legacyMap.end ())
|
||||
{
|
||||
context.footnote (format (STRING_CMD_CUSTOM_OLD_SORT, name, found->second));
|
||||
name = found->second;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -80,6 +80,8 @@ void sort_tasks (std::vector <Task>&, std::vector <int>&, const std::string&);
|
|||
|
||||
// legacy.cpp
|
||||
void legacyAttributeCheck (const std::string&);
|
||||
void legacyColumnMap (std::string&);
|
||||
void legacySortColumnMap (std::string&);
|
||||
|
||||
// list template
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue