-
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:
- Local database file (
/some/path/.tmsu/db
) - Environment variable (
TMSU_DB
) - Command-line option (
--database
) - Default database file (
$HOME/.tmsu/default.db
)
The recommended way is to initialise a local database.
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
Earlier versions of TMSU would create a database automatically if none could be found. TMSU no longer creates such a database, but for backwards compatibility it will still pick up a database at $HOME/.tmsu/default.db
if no other can be found.