Skip to content

Tag and Value Names

Paul Ruane edited this page Apr 11, 2017 · 6 revisions

Valid Tag Names

As of TMSU v0.6.0, the restrictions on tag and value names have been relaxed. The following are the current rule: please see the page history for restrictions applicable to earlier versions.

A legal tag name consists of one or more characters from the following Unicode categories:

  • Letter (L*)
  • Number (N*)
  • Punctuation (P*)
  • Symbol (S*)
  • Space (Z*)

Examples of valid tag names:

  • banana
  • 123
  • 6all00n
  • under_scored
  • high-fun
  • !@%&
  • 日本語
  • in space

Illegal Tag Names

The following names are not allowed:

.   and  or  not  eq  ne  lt  gt  le  ge
..  AND  OR  NOT  EQ  NE  LT  GT  LE  GE

The following characters are not allowed anywhere within a tag name:

  • Slash (/)
  • Backslash (\)

The slash and backslash character is illegal as it clashes with the path separator character on many operating systems. Likewise '.' and '..' are illegal as these could not be used as directory names due to many operating systems using them already for the current and parent directories aliases.

Escaping Problematic Characters

Some characters, such as the comparison operators and space characters, need to be escaped if they are to be used within a tag name. To escape a character precede it with a backslash. (You may also need to additionally using quotes to hide the escaping from your shell.)

Working with the comparison operator and space characters can be tricky, as the number of backslashes you need may not be immediately obvious.

Zsh Equals Character Examples

To tag a file with tag a and value b, the following are all equivalent:

$ tmsu tag somefile a=b
$ tmsu tag somefile 'a=b'
$ tmsu tag somefile "a=b"

To tag a file with tag a=b, the following are all equivalent:

$ tmsu tag somefile a\\=b
$ tmsu tag somefile 'a\=b'
$ tmsu tag somefile "a\=b"

To tag a file with tag a=b and value c, the following are all equivalent:

$ tmsu tag a\\=b=c
$ tmsu tag 'a\=b=c'
$ tmsu tag "a\=b=c"

To tag a file with tag a and value b=c, the following are all equivalent:

$ tmsu tag a=b=c
$ tmsu tag 'a=b=c'
$ tmsu tag "a=b=c"