mirror of
https://github.com/apple/pkl.git
synced 2026-03-21 16:49:13 +01:00
Fix shell completion for paths (#1161)
This commit is contained in:
committed by
Dan Chao
parent
9f7997bbc4
commit
f0896ba16f
@@ -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(
|
||||
|
||||
@@ -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<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(required = true)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user