override suspend fun migrate()

in src/main/kotlin/circlet/cli/folder/FolderCommand.kt [24:46]


    override suspend fun migrate() {
        getOrCreateFolder(baseFolder)

        withContext(Dispatchers.IO) {
            Files.walk(baseFolder).use { stream ->
                for (filePath in stream) {
                    when {
                        Files.isRegularFile(filePath) -> {
                            if (filePath.extension == "md") {
                                // import MD document
                                createMdDocument(filePath)
                            } else {
                                // import regular file
                                createFileDocument(filePath)
                            }
                        }

                        Files.isDirectory(filePath) -> getOrCreateFolder(filePath)
                    }
                }
            }
        }
    }