mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Enhancement
- When presenting lists of ambiguous command, attributes and modifiers to the user, it is now a sorted list.
This commit is contained in:
parent
96bd3ff8db
commit
e886f7635b
3 changed files with 14 additions and 6 deletions
|
@ -25,6 +25,7 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -253,6 +254,7 @@ bool Att::validNameValue (
|
|||
{
|
||||
std::string error = "Ambiguous attribute '" + name + "' - could be either of "; // TODO i18n
|
||||
|
||||
std::sort (matches.begin (), matches.end ());
|
||||
std::string combined;
|
||||
join (combined, ", ", matches);
|
||||
|
||||
|
@ -278,6 +280,7 @@ bool Att::validNameValue (
|
|||
{
|
||||
std::string error = "Ambiguous modifier '" + mod + "' - could be either of "; // TODO i18n
|
||||
|
||||
std::sort (matches.begin (), matches.end ());
|
||||
std::string combined;
|
||||
join (combined, ", ", matches);
|
||||
error += combined;
|
||||
|
|
14
src/Cmd.cpp
14
src/Cmd.cpp
|
@ -25,13 +25,14 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <iostream> // TODO Remove
|
||||
#include <algorithm>
|
||||
#include "Cmd.h"
|
||||
#include "Context.h"
|
||||
#include "util.h"
|
||||
#include "text.h"
|
||||
#include "i18n.h"
|
||||
#include "main.h"
|
||||
#include <Cmd.h>
|
||||
#include <Context.h>
|
||||
#include <util.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
#include <main.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
|
@ -94,6 +95,7 @@ void Cmd::parse (const std::string& input)
|
|||
{
|
||||
std::string error = "Ambiguous command '" + candidate + "' - could be either of "; // TODO i18n
|
||||
|
||||
std::sort (matches.begin (), matches.end ());
|
||||
std::string combined;
|
||||
join (combined, ", ", matches);
|
||||
throw error + combined;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
@ -397,6 +398,8 @@ void guess (
|
|||
|
||||
else
|
||||
{
|
||||
std::sort (matches.begin (), matches.end ());
|
||||
|
||||
std::string error = "Ambiguous "; // TODO i18n
|
||||
error += type;
|
||||
error += " '";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue