Fix shell completion for paths (#1161)

This commit is contained in:
Artem Yarmoliuk
2025-08-26 18:46:54 +01:00
committed by Dan Chao
parent 9f7997bbc4
commit f0896ba16f
5 changed files with 26 additions and 5 deletions

View File

@@ -15,6 +15,7 @@
*/
package org.pkl.cli.commands
import com.github.ajalt.clikt.completion.CompletionCandidates
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.flag
import com.github.ajalt.clikt.parameters.options.option
@@ -33,6 +34,7 @@ class EvalCommand : ModulesCommand(name = "eval", helpLink = helpLink) {
names = arrayOf("-o", "--output-path"),
metavar = "path",
help = "File path where the output file is placed.",
completionCandidates = CompletionCandidates.Path,
)
.single()
@@ -59,6 +61,7 @@ class EvalCommand : ModulesCommand(name = "eval", helpLink = helpLink) {
names = arrayOf("-m", "--multiple-file-output-path"),
metavar = "path",
help = "Directory where a module's multiple file output is placed.",
completionCandidates = CompletionCandidates.Path,
)
.single()
.validate {

View File

@@ -15,6 +15,7 @@
*/
package org.pkl.cli.commands
import com.github.ajalt.clikt.completion.CompletionCandidates
import com.github.ajalt.clikt.core.Context
import com.github.ajalt.clikt.core.NoOpCliktCommand
import com.github.ajalt.clikt.core.subcommands
@@ -116,6 +117,7 @@ class PackageCommand : BaseCommand(name = "package", helpLink = helpLink) {
names = arrayOf("--output-path"),
help = "The directory to write artifacts to",
metavar = "path",
completionCandidates = CompletionCandidates.Path,
)
.single()
.default(".out/%{name}@%{version}")

View File

@@ -15,6 +15,7 @@
*/
package org.pkl.cli.commands
import com.github.ajalt.clikt.completion.CompletionCandidates
import com.github.ajalt.clikt.parameters.arguments.argument
import com.github.ajalt.clikt.parameters.arguments.convert
import com.github.ajalt.clikt.parameters.arguments.multiple
@@ -30,7 +31,11 @@ class TestCommand : BaseCommand(name = "test", helpLink = helpLink) {
override val helpString = "Run tests within the given module(s)"
val modules: List<URI> by
argument(name = "modules", help = "Module paths or URIs to evaluate.")
argument(
name = "modules",
help = "Module paths or URIs to evaluate.",
completionCandidates = CompletionCandidates.Path,
)
.convert { BaseOptions.parseModuleName(it) }
.multiple()