diff --git a/pkl-cli/src/main/kotlin/org/pkl/cli/commands/EvalCommand.kt b/pkl-cli/src/main/kotlin/org/pkl/cli/commands/EvalCommand.kt index 376fc98f..56624110 100644 --- a/pkl-cli/src/main/kotlin/org/pkl/cli/commands/EvalCommand.kt +++ b/pkl-cli/src/main/kotlin/org/pkl/cli/commands/EvalCommand.kt @@ -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 { diff --git a/pkl-cli/src/main/kotlin/org/pkl/cli/commands/ProjectCommand.kt b/pkl-cli/src/main/kotlin/org/pkl/cli/commands/ProjectCommand.kt index d87c6939..2fde8ee1 100644 --- a/pkl-cli/src/main/kotlin/org/pkl/cli/commands/ProjectCommand.kt +++ b/pkl-cli/src/main/kotlin/org/pkl/cli/commands/ProjectCommand.kt @@ -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}") diff --git a/pkl-cli/src/main/kotlin/org/pkl/cli/commands/TestCommand.kt b/pkl-cli/src/main/kotlin/org/pkl/cli/commands/TestCommand.kt index fd4f300e..4fb5bc16 100644 --- a/pkl-cli/src/main/kotlin/org/pkl/cli/commands/TestCommand.kt +++ b/pkl-cli/src/main/kotlin/org/pkl/cli/commands/TestCommand.kt @@ -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 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() diff --git a/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseOptions.kt b/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseOptions.kt index 20579c15..bb1c8175 100644 --- a/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseOptions.kt +++ b/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseOptions.kt @@ -15,6 +15,7 @@ */ package org.pkl.commons.cli.commands +import com.github.ajalt.clikt.completion.CompletionCandidates import com.github.ajalt.clikt.parameters.groups.OptionGroup import com.github.ajalt.clikt.parameters.options.* import com.github.ajalt.clikt.parameters.types.enum @@ -165,6 +166,7 @@ class BaseOptions : OptionGroup() { option( names = arrayOf("-f", "--format"), help = "Output format to generate. <${output.joinToString()}>", + completionCandidates = CompletionCandidates.Fixed(output.toSet()), ) .single() @@ -187,9 +189,13 @@ class BaseOptions : OptionGroup() { .splitAll(File.pathSeparator) val settings: URI? by - option(names = arrayOf("--settings"), help = "Pkl settings module to use.").single().convert { - parseModuleName(it) - } + option( + names = arrayOf("--settings"), + help = "Pkl settings module to use.", + completionCandidates = CompletionCandidates.Path, + ) + .single() + .convert { parseModuleName(it) } val timeout: Duration? by option( diff --git a/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/ModulesCommand.kt b/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/ModulesCommand.kt index 1d00baab..fff56a2a 100644 --- a/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/ModulesCommand.kt +++ b/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/ModulesCommand.kt @@ -15,6 +15,7 @@ */ package org.pkl.commons.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 @@ -24,7 +25,11 @@ import java.net.URI abstract class ModulesCommand(name: String, helpLink: String) : BaseCommand(name = name, helpLink = helpLink) { open val modules: List 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(required = true)