GothenburgBitFactory / taskwarrior

Taskwarrior - Command line Task Management
https://taskwarrior.org
MIT License
4.51k stars 314 forks source link

[TW-1604] Enumeration attributes should be more forgiving regarding capitalization #1628

Open taskwarrior opened 6 years ago

taskwarrior commented 6 years ago

Jens Erat on 2015-04-27T09:34:16Z says:

With the changed priority attribute, priority:h cannot be entered any more (failing with "The 'priority' attribute does not allow a value of 'h'.").

I'd propose to handle enumeration attributes in a more forgiving way and accept different capitalization if the result is still unique, ie. compare the lower case values. An alternative might be some option that can be set within the UDA which makes it case-insensitive.

taskwarrior commented 6 years ago

Migrated metadata:

Created: 2015-04-27T09:34:16Z
Modified: 2017-01-16T17:34:05Z
taskwarrior commented 6 years ago

Paul Beckingham on 2015-04-27T21:07:36Z says:

Is the solution to this as simple as:

$ task config uda.priority.values H,h,M,m,L,l,
taskwarrior commented 6 years ago

Peter Rochen on 2015-04-29T07:56:53Z says:

Maybe somebody want to set priority.A.coefficient != priority.a.coefficient priority.B.coefficient != priority.b.coefficient priority.C.coefficient != priority.c.coefficient, etc One of positive, the other side is negative.

taskwarrior commented 6 years ago

Jens Erat on 2015-04-29T08:05:52Z says:

This would result in the result not being unique any more, which should be detected as I already proposed.

taskwarrior commented 6 years ago

Peter Rochen on 2015-04-29T08:56:19Z says:

So you will this?

If (input == [a-z])
  { unless exists( uppercase(input) ) 
      { priority = uppercase(input); }
  }
taskwarrior commented 6 years ago

Jens Erat on 2015-04-29T09:11:44Z says:

I'd go for a more general solution and compare all attribute values against all others.

Maybe a new option would be more reasonable, something like

{code}uda.priority.type=string-insensitive{code}

or

{code}uda.priority.case-sensitive=no{code}

taskwarrior commented 6 years ago

Jens Erat on 2015-05-05T11:58:31Z says:

(at)Paul Beckingham:

{code}$ task config uda.priority.values H,h,M,m,L,l,{code} doesn't really do it, because now we have separate "H" and "h" values. While we could add another set of urgency rules for the lower-case attribute values, it makes searching for specific values harder.

I'd guess a case-sensitivity attribute would be the cleanest solution, while providing a significant relief to some users (ie. me).

taskwarrior commented 6 years ago

Paul Beckingham on 2015-05-05T22:40:45Z says:

There are several problems with this.

The big one is that the notion of upper/lower case does not extend easily to Non-ASCII character sets and caseless comparisons are very limited. Look at the definition of isupper() for an unusably narrow-minded definition.

If this were to be done, I'd prefer it was done properly, with access to a Unicode database. That's a major undertaking. Achievable, but major.

Another is that I don't know what is the right thing to do with, say, a fully composed codepoint sequence versus decomposed codepoint. I know they are meant to be equivalent, but there exists no mapping, so how is it implemented?

My main concern though is that these are requests for significant amounts of work to be volunteered with no offer of help, and the payback is that it becomes unnecessary for some people to press a shift key, some of the time. I do t think it's worth it.

Please let future comments address the technical issues, rather than an "I want this" show of support.

taskwarrior commented 6 years ago

Paul Beckingham on 2015-05-06T03:48:04Z says:

I take back my upper/lower case comment - the UCD defines all case folding very well indeed, it's a 1,210-element character mapping between upper and lower, mostly 1:1, some 1:N. This is small enough to be actually encodable in a proper isupper() implementation.

taskwarrior commented 6 years ago

Jens Erat on 2015-05-06T07:03:57Z says:

Let's consider this the other way round:

I might tackle this in future (not within the next days, but it will happen), but not if it has no chances of getting upstream. Providing a rather small patch is fine for me, maintaing my own fork of Taskwarrior just for the sake of the shift key isn't.