# File lib/rfuse.rb, line 204
    def self.main(argv=ARGV,extra_options=[],extra_options_usage=nil,device=nil,exec=File.basename($0))

        options = parse_options(argv,*extra_options)

        unless options[:mountpoint]
            $stderr.puts "rfuse: failed, no mountpoint provided"
            puts usage(device,exec)
            return nil
        end

        if options[:help]
            puts usage(device,exec)
            # TODO: In Fuse 3.0 this looks like it will move to $stdout
            help_io = STDERR
            help_io.puts "Fuse options: (#{FUSE_MAJOR_VERSION}.#{FUSE_MINOR_VERSION})"
            help_io.puts "    -h                     help - print this help output"
            help_io.puts "    -d |-o debug           enable internal FUSE debug output"
            help_io.puts ""
            help_io.flush()

            # Cause Fuse kernel Options to print, but don't actually start a filesystem
            Fuse.new(*argv)

            if extra_options_usage
                help_io.puts "Filesystem options:"
                help_io.puts extra_options_usage
            end

            return nil
        end

        begin
            fs = yield options,argv

            raise Error, "no filesystem provided" unless fs

            fuse = create(fs,argv,options,extra_options)

            raise Error, "filesystem #{fs} not mounted" unless fuse && fuse.mounted?

            fuse.run
        rescue Error => fuse_ex
            # These errors are produced generally because the user passed bad arguments etc..
            puts usage(device,exec) unless options[:help]
            $stderr.puts "rfuse failed: #{fuse_ex.message}"
            return nil
        rescue => ex
            # These are other errors related the yield block
            $stderr.puts ex.message
            $stderr.puts ex.backtrace.join("\n")
        end

    end