Commits

Paul Ruane  committed 0ddb207

Added man page.
Fixed unit-tests.

  • Participants
  • Parent commits eac7dc4

Comments (0)

Files changed (17)

 # installation paths
 INSTALL_DIR=/usr/bin
-MOUNT_INSTALL_DIR=/sbin
+MOUNT_INSTALL_DIR=/usr/sbin
+MAN_INSTALL_DIR=/usr/share/man
 ZSH_COMP_INSTALL_DIR=/usr/share/zsh/site-functions
 
 # other vars
 	cp -R bin dist
 	cp README.md dist
 	cp COPYING dist
+	@mkdir -p dist/man
+	gzip -kf misc/man/tmsu.1 >dist/man/tmsu.1.gz
 	@mkdir -p dist/misc/zsh
 	cp misc/zsh/_tmsu dist/misc/zsh
 	tar czf $(DIST_FILE) dist
 	@echo "Installing 'mount' command support"
 	@echo -n "    "
 	cp sbin/mount.tmsu $(MOUNT_INSTALL_DIR)
+	@echo "Installing man page"
+	mkdir -p $(MAN_INSTALL_DIR)
+	gzip -kf misc/man/tmsu.1 >$(MAN_INSTALL_DIR)/tmsu.1.gz
 	@echo "Installing Zsh completion"
 	@echo -n "    "
 	mkdir -p $(ZSH_COMP_INSTALL_DIR)
 	@echo "Uninstalling mount support"
 	@echo -n "    "
 	rm $(MOUNT_INSTALL_DIR)/mount.tmsu
+	@echo "Uninstalling man page"
+	rm $(MAN_INSTALL_DIR)/tmsu.1.gz
 	@echo "Uninstalling Zsh completion"
 	@echo -n "    "
 	rm $(ZSH_COMP_INSTALL_DIR)/_tmsu
 ========
 
 TMSU is a program that allows you to organise your files by associating them
-with tags. It provides a tool for managing these tags and a virtual file system
+with tags. It provides a tool for managing these tags and a virtual filesystem
 to allow tag-based access to your files.
 
-TMSU's virtual file system does not store your files: it merely provides an
-alternative, tagged-based view of your files stored elsewhere in the file
-system. That way you have the freedom to choose the most suitable file system
-for storage whilst still benefiting from tag-based access.
+TMSU's virtual filesystem does not store your files: it merely provides an
+alternative, tag-based view of your files stored elsewhere in the filesystem.
+That way you have the freedom to choose the most suitable filesystem for
+storage whilst still benefiting from tag-based access.
 
 Usage
 =====
 v0.2.2
 ------
 
-  * Fixed virtual file system.
+  * Fixed virtual filesystem.
 
 v0.2.1
 ------
-zsh         Command completion for the shell Zsh.
 db-upgrade  Database upgrade scripts.
 ebnf        Extended Backus-Naur Form file for the TMSU query language.
+man         Man page
+zsh         Command completion for the shell Zsh.

File misc/man/tmsu.1

+.TH TMSU 1 General Commands Manual
+.SH NAME
+tmsu \- tag files and view them in a tag-based virtual filesystem
+.SH SYNOPSIS
+.B tmsu
+\fICOMMAND\fR [\fIOPTION\fR]... [\fIARGUMENT\fR]...
+.SH DESCRIPTION
+.PP
+TMSU allows you to organise your files by associating them with tags.
+A tag based view of the files can be mounted as a virtual filesystem
+so that tag-based access can be made from any other program.
+.PP
+TMSU's virtual filesystem does not store your files: it merely provides an
+alternative, tag-based view of your files stored elsewhere in the filesystem.
+That way you have the freedom to choose the most suitable filesystem for
+storage whilst still benefiting from tag-based access.
+.SH GLOBAL OPTIONS
+.TP
+\fB-v\fR, \fB\-\-verbose\fR
+show verbose messages
+.TP
+\fB-h\fR, \fB\-\-help\fR
+show help and exit
+.TP
+\fB-V\fR, \fB\-\-version\fR
+show version inforamtion and exit
+.TP
+\fB-d\fR \fIPATH\fR, \fB\-\-database\fR=\fIPATH\fR
+use the specified database
+.SH COMMANDS
+.TP
+.B
+copy
+Creates a copy of a tag
+.TP
+.B
+delete
+Delete one or more tags
+.TP
+.B
+dupes
+Identify duplicate files
+.TP
+.B
+files
+List files with particular tags
+.TP
+.B
+help
+List commands or show help for a particular command
+.TP
+.B
+imply
+Creates a tag implication
+.TP
+.B
+merge
+Merge tags
+.TP
+.B
+mount
+Mount the virtual filesystem
+.TP
+.B
+rename
+Rename a tag
+.TP
+.B
+repair
+Repair the database
+.TP
+.B
+stats
+Show database statistics
+.TP
+.B
+status
+List the file tagging status
+.TP
+.B
+tag
+Apply tags to files
+.TP
+.B
+tags
+List tags
+.TP
+.B
+unmount
+Unmount the virtual filesystem
+.TP
+.B
+untag
+Remove tags from files
+.TP
+.B
+version
+Display version and copyright information
+.SH FILES
+.TP
+.B
+~/.tmsu/defaultdb
+the default database path
+.PP
+The TMSU database is stored in Sqlite3 format and can be accessed
+directly, if necessary, with the Sqlite3 tooling.
+.PP
+The default database path can be overriden by specifying
+the \fB--database=\fR\fIPATH\fR global option or by setting
+the \fBTMSU_DB\fR environment variable.
+.SH ENVIRONMENT VARIABLES
+.TP
+\fBTMSU_DB\fR
+the database path
+.SH AUTHOR
+Written by Paul Ruane <paul@tmsu.org>.
+.SH REPORTING BUGS
+Please report any bugs to the project mailing list <ml@tmsu.org>
+or add to the issue tracker via http://tmsu.org/.
+.SH COPYRIGHT
+Copyright © 2011-2013 Paul Ruane.
+
+This program comes with ABSOLUTELY NO WARRANTY.
+This is free software, and you are welcome to redistribute it under certain conditions.
+See the accompanying COPYING file for further details.

File src/tmsu/cli/common_test.go

 	"tmsu/entities"
 	"tmsu/log"
 	"tmsu/storage"
+	"tmsu/storage/database"
 )
 
 func configureOutput() (string, string, error) {
 	return outPath, errPath, nil
 }
 
-func configureDatabase() string {
+func testDatabase() string {
 	databasePath := filepath.Join(os.TempDir(), "tmsu_test.db")
-	os.Setenv("TMSU_DB", databasePath)
-
+	database.Path = databasePath
 	return databasePath
 }
 

File src/tmsu/cli/copy_test.go

 func TestCopySuccessful(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestCopyNonExistentSourceTag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	// test
 func TestCopyInvalidDestTag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	// test
 func TestCopyDestTagAlreadyExists(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()

File src/tmsu/cli/delete_test.go

 func TestDeleteSuccessful(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestDeleteNonExistentTag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	// test

File src/tmsu/cli/dupes_test.go

 func TestDupesSingle(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 
 func TestDupesMultiple(test *testing.T) {
 	// set-up
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 
 func TestDupesNone(test *testing.T) {
 	// set-up
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 
 func TestDupesSingleUntaggedFile(test *testing.T) {
 	// set-up
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 
 func TestDupesMultipleUntaggedFile(test *testing.T) {
 	// set-up
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 
 func TestDupesNoneUntaggedFile(test *testing.T) {
 	// set-up
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()

File src/tmsu/cli/files_test.go

 func TestFilesAll(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 func TestFilesSingleTag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 func TestFilesNotSingleTag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 func TestFilesImplicitAnd(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 func TestFilesAnd(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 func TestFilesImplicitAndNot(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 func TestFilesAndNot(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 func TestFilesOr(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()

File src/tmsu/cli/merge_test.go

 func TestMergeSingleTag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestMergeMultipleTags(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestMergeNonExistentSourceTag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestMergeNonExistentDestinationTag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestMergeSourceAndDestinationTheSame(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()

File src/tmsu/cli/rename_test.go

 func TestRenameSuccessful(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestRenameNonExistentSourceTag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	// test
 func TestRenameInvalidDestTag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	// test
 func TestRenameDestTagAlreadyExists(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()

File src/tmsu/cli/repair_test.go

 func TestRepairMovedFile(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestRepairModifiedFile(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestReportsMissingFiles(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 	log.Outfile.Seek(0, 0)
 
 	bytes, err := ioutil.ReadAll(log.Outfile)
-	compareOutput(test, "tmsu: New tag 'a'.\ntmsu: /tmp/tmsu/a: missing\n", string(bytes))
+	compareOutput(test, "tmsu: /tmp/tmsu/a: missing\n", string(bytes))
 }

File src/tmsu/cli/status_test.go

 func TestStatusReport(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 	log.Outfile.Seek(0, 0)
 
 	bytes, err := ioutil.ReadAll(log.Outfile)
-	compareOutput(test, "tmsu: New tag 'a'.\ntmsu: New tag 'b'.\ntmsu: New tag 'd'.\nT /tmp/tmsu/a\nM /tmp/tmsu/b\n! /tmp/tmsu/d\nU /tmp/tmsu/c\n", string(bytes))
+	compareOutput(test, "T /tmp/tmsu/a\nM /tmp/tmsu/b\n! /tmp/tmsu/d\nU /tmp/tmsu/c\n", string(bytes))
 }

File src/tmsu/cli/tag_test.go

 func TestSingleTag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestMultipleTags(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestTagMultipleFiles(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()

File src/tmsu/cli/tags_test.go

 func TestTagsForSingleFile(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 func TestTagsForMultipleFiles(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()
 func TestAllTags(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	outPath, errPath, err := configureOutput()

File src/tmsu/cli/unmount.go

 
 var UnmountCommand = Command{
 	Name:     "unmount",
-	Synopsis: "Unmount the virtual file-system",
+	Synopsis: "Unmount the virtual filesystem",
 	Description: `tmsu unmount MOUNTPOINT
 tmsu unmount --all
 

File src/tmsu/cli/untag_test.go

 func TestSingleUntag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestMultipleUntag(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestUntagMultipleFiles(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()
 func TestUntagAll(test *testing.T) {
 	// set-up
 
-	databasePath := configureDatabase()
+	databasePath := testDatabase()
 	defer os.Remove(databasePath)
 
 	store, err := storage.Open()