Esempio n. 1
0
func doMount(ctx *cli.Context, client *daemon.Client, mount bool) error {
	mountPath := ""
	if len(ctx.Args()) > 0 {
		mountPath = ctx.Args().First()
	} else {
		mountPath = filepath.Join(guessRepoFolder(), "mount")
		if err := os.Mkdir(mountPath, 0744); err != nil {
			return err
		}
	}

	var err error

	if mount {
		err = client.Mount(mountPath)
	} else {
		err = client.Unmount(mountPath)
	}

	if err != nil {
		return ExitCode{UnknownError, fmt.Sprintf("fuse: %v", err)}
	}

	return nil
}