mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 13:11:32 +00:00
idea: implement function call completion (limited)
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
package gay.pizza.pork.tool
|
||||
|
||||
import com.github.ajalt.clikt.core.CliktCommand
|
||||
import com.github.ajalt.clikt.parameters.arguments.argument
|
||||
import com.github.ajalt.clikt.parameters.arguments.default
|
||||
import gay.pizza.dough.fs.PlatformFsProvider
|
||||
import gay.pizza.dough.fs.createDirectories
|
||||
import gay.pizza.dough.fs.exists
|
||||
import gay.pizza.dough.fs.writeString
|
||||
import gay.pizza.pork.parser.readToString
|
||||
import gay.pizza.pork.stdlib.PorkStdlib
|
||||
|
||||
class CopyStdlibCommand : CliktCommand(help = "Copy Stdlib", name = "copy-stdlib") {
|
||||
val output by argument("output").default("stdlib")
|
||||
|
||||
override fun run() {
|
||||
val outputFsPath = PlatformFsProvider.resolve(output)
|
||||
for (filePath in PorkStdlib.files) {
|
||||
val outputFilePath = outputFsPath.resolve(filePath)
|
||||
if (outputFilePath.parent?.exists() == false) {
|
||||
outputFilePath.parent?.createDirectories()
|
||||
}
|
||||
outputFilePath.writeString(PorkStdlib.loadAsCharSource(filePath).readToString())
|
||||
}
|
||||
}
|
||||
}
|
@ -16,7 +16,8 @@ class RootCommand : CliktCommand(
|
||||
ParseCommand(),
|
||||
AstCommand(),
|
||||
AttributeCommand(),
|
||||
ScopeAnalysisCommand()
|
||||
ScopeAnalysisCommand(),
|
||||
CopyStdlibCommand()
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user