-
Notifications
You must be signed in to change notification settings - Fork 122
Switching Databases
There are several ways to specify the database for TMSU to use:
- Default database file (
$HOME/.tmsu/default.db
) - Local database file (
/some/path/.tmsu/db
) - Environment variable (
TMSU_DB
) - Command-line option (
--database
)
The default database is perfectly usable for many users. Users with multiple distinct sets of files may prefer to create local databases for each set.
By default TMSU uses a database at $HOME/.tmsu/default.db
. If this database does not exist then it will be created automatically. The default database is only used if none of the other methods are used.
TMSU will look for a database named .tmsu/db
under the current working directory or any parent directory of the current working directory. For example, if the current working directory is /home/on/the/range
then TMSU will look for a database file at the following paths, using the first it finds:
/home/on/the/range/.tmsu/db
/home/on/the/.tmsu/db
/home/on/.tmsu/db
/home/.tmsu/db
/.tmsu/db
This allows you to have a TMSU database for a particular set of files. To set up such a database, use the 'init' subcommand, which will create a new database under the current working directory:
$ cd /some/path
$ tmsu init
Creating new database at '/some/path/.tmsu/db'.
TMSU will look for an environment variable called TMSU_DB
. This will override use of the default and local databases.
$ export TMSU_DB=~/mydb
$ tmsu tags --all
fish
chips
If the file does not exist then it will be created automatically.
The database to use can be specified as a command-line option:
$ tmsu --database=~/mydb tags --all
fish
chips
Use of the command-line option has the highest precedence and overrides all of the other options. If this database file does not exist when TMSU is run then it will be created automatically.
To save specifying it each time, you can alias tmsu
:
$ alias tmsu='tmsu --database=~/mydb'
$ tmsu tags --all
fish
chips