mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Allow tags to be enclosed in double quotes
Closes #159 Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This commit is contained in:
parent
fd6d57dbc2
commit
0460656afe
4 changed files with 9 additions and 7 deletions
|
@ -219,7 +219,7 @@ void CLI::lexArguments ()
|
||||||
if (lex.token (lexeme, type) &&
|
if (lex.token (lexeme, type) &&
|
||||||
lex.isEOS ())
|
lex.isEOS ())
|
||||||
{
|
{
|
||||||
A2 a (Lexer::dequote (_original_args[i].attribute ("raw")), type);
|
A2 a (_original_args[i].attribute ("raw"), type);
|
||||||
if (quoted)
|
if (quoted)
|
||||||
a.tag ("QUOTED");
|
a.tag ("QUOTED");
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <TagInfoDatabase.h>
|
#include <TagInfoDatabase.h>
|
||||||
#include <format.h>
|
#include <format.h>
|
||||||
#include <TagInfo.h>
|
#include <TagInfo.h>
|
||||||
|
|
||||||
#include "timew.h"
|
#include "timew.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -54,11 +54,6 @@ std::string escape (const std::string& input, int c)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string quoteIfNeeded (const std::string& input)
|
std::string quoteIfNeeded (const std::string& input)
|
||||||
{
|
{
|
||||||
if (input[0] == '"' || input[0] == '\'')
|
|
||||||
{
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto quote = input.find ('"');
|
auto quote = input.find ('"');
|
||||||
auto space = input.find (' ');
|
auto space = input.find (' ');
|
||||||
auto op = input.find_first_of ("+-/()<^!=~_%");
|
auto op = input.find_first_of ("+-/()<^!=~_%");
|
||||||
|
|
|
@ -277,6 +277,14 @@ class TestStart(TestCase):
|
||||||
self.t("start 1h ago proja")
|
self.t("start 1h ago proja")
|
||||||
code, out, err = self.t("start 2h ago proja :adjust")
|
code, out, err = self.t("start 2h ago proja :adjust")
|
||||||
|
|
||||||
|
def test_start_with_one_quoted_and_one_non_quoted_tag(self):
|
||||||
|
"""Start will allow tags encased in quotes"""
|
||||||
|
self.t("start 1h ago foo '\"bar\"' :debug")
|
||||||
|
|
||||||
|
j = self.t.export()
|
||||||
|
self.assertOpenInterval(j[0],
|
||||||
|
expectedTags=["\"bar\"", "foo"])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from simpletap import TAPTestRunner
|
from simpletap import TAPTestRunner
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue