Skip to content

Commit

Permalink
Allow add command to be invoked without subcommand; Fixes #22
Browse files Browse the repository at this point in the history
  • Loading branch information
juraj-hrivnak committed Sep 10, 2024
1 parent 7fee38e commit e5fa006
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/commonMain/kotlin/teksturepako/pakku/cli/cmd/Add.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import teksturepako.pakku.cli.cmd.subcmd.Prj
import teksturepako.pakku.cli.resolveDependencies
import teksturepako.pakku.cli.ui.*

class Add : CliktCommand("Add projects", allowMultipleSubcommands = true)
class Add : CliktCommand()
{
override fun help(context: Context) = "Add projects"

private val projectArgs: List<String> by argument("projects", help = "Projects to add").multiple()
private val noDepsFlag: Boolean by option("-D", "--no-deps", help = "Ignore resolving dependencies").flag()

Expand All @@ -30,6 +32,9 @@ class Add : CliktCommand("Add projects", allowMultipleSubcommands = true)
this.subcommands(Prj())
}

override val invokeWithoutSubcommand = true
override val allowMultipleSubcommands = true

override fun run(): Unit = runBlocking {
// Pass flags to the context
flags["noDepsFlag"] = noDepsFlag
Expand Down

0 comments on commit e5fa006

Please sign in to comment.