Coder Social home page Coder Social logo

Fulltext tag values about tmsu HOT 6 CLOSED

oniony avatar oniony commented on May 23, 2024
Fulltext tag values

from tmsu.

Comments (6)

oniony avatar oniony commented on May 23, 2024

This is something I have considered. Indeed it's on the TODO list list (under 'low').

It would certainly be possible to do, for values at least. I don't think it would require any special option: the quotes alone should make the intent clear.

I'll see if I can squeeze it into the next release. For now you can use '-' or '_' to separate words, as a workaround:

$ tmsu tag spaced.doc full-name=totally-spaced

from tmsu.

tomassedovic avatar tomassedovic commented on May 23, 2024

Oh, cool!

Not sure the quotes will be enough, though. I just tried argv in Python and C (don't have Go installed now but I imagine it'll work the same). Passing comments="Best. Song. Ever." means the program receives the string comments=Best. Song. Ever. (no quotes). But there are other ways (e.g. if the value is invalid, treat it as full text).

I may send you a pull request at some point if you're open to it. In case you are, do you want to just extend values to accept whitespace and punctuation or have the fulltext ones treated separately?

from tmsu.

oniony avatar oniony commented on May 23, 2024

Yeah, it'll take some care but it should be fairly straightforward.

I'm happy for pull requests but please don't be offended if I don't apply them verbatim. I see this as simply handling whitespace rather than new 'fulltext' funcitonality so I wouldn't expect there to be any new option: simply that the following will then be possible:

$ tmsu tag somefile tag="value with spaces"
$ tmsu tag somefile tag='value with spaces'
$ tmsu tag somefile tag=value\ with\ spaces

When I've thought about this in the past it seemed relatively straightforward as the shell should do the parsing for you and put the whole string, spaces and all, into a single ARGV array element. I.e. 'tmsu tag somefile tag=value with spaces' should result in ['tag=', 'value', 'with', 'spaces'] whereas 'tmsu tag somefile tag='value with spaces' should be received as ['tag=value with spaces'].

The complications come from other aspects:

  • 'tmsu files' supports queries and so TMSU currently joins the ARGV arguments together with spaces between before parsing the query language. This could potentially be handled by enquoting each element before joining with spaces and then upgrading the query parser to handle quotes.
  • 'tmsu tag -' allows the user to tag from standard input or other file in which case there is no shell parsing support.
  • The virtual filesystem exposes the tags/values as directories. I imagine this will work fine without changes but there could be unforeseen problems.

from tmsu.

oniony avatar oniony commented on May 23, 2024

It would also have to support spaces in the --tags option:

tmsu tag --tags="tag='value with spaces' othertag"
tmsu tag --tags='tag="value with spaces" othertag'
tmsu tag --tags="tag=value\ with\ spaces othertag"

from tmsu.

oniony avatar oniony commented on May 23, 2024

There is a tokenizer in tmsu/common/text for tokenising a string into fields with consideration for quotes.

from tmsu.

oniony avatar oniony commented on May 23, 2024

This is being implemented as part of issue #45.

from tmsu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.