Exemplo n.º 1
0
func (VfsCommand) Exec(options cli.Options, args []string) error {
	if len(args) == 0 {
		fmt.Errorf("Mountpoint not specified.")
	}

	allowOther := options.HasOption("--allow-other")
	databasePath := args[0]
	mountPath := args[1]

	vfs, err := vfs.MountVfs(databasePath, mountPath, allowOther)
	if err != nil {
		return fmt.Errorf("could not mount virtual filesystem for database '%v' at '%v': %v", databasePath, mountPath, err)
	}
	defer vfs.Unmount()

	vfs.Loop()

	return nil
}
Exemplo n.º 2
0
func vfsExec(options Options, args []string) error {
	if len(args) == 0 {
		fmt.Errorf("Mountpoint not specified.")
	}

	mountOptions := []string{}
	if options.HasOption("--options") {
		mountOptions = strings.Split(options.Get("--options").Argument, ",")
	}

	databasePath := args[0]
	mountPath := args[1]

	vfs, err := vfs.MountVfs(databasePath, mountPath, mountOptions)
	if err != nil {
		return fmt.Errorf("could not mount virtual filesystem for database '%v' at '%v': %v", databasePath, mountPath, err)
	}
	defer vfs.Unmount()

	vfs.Serve()

	return nil
}