Skip to content

Commit

Permalink
idk my laptop borked
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-MX committed Jun 14, 2024
1 parent cb87aa7 commit bbeef0f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ class ArgumentProcessor(
val args: List<String>
) {
var pointer = 0
// Should be added to the command context
val values = hashMapOf<String, String>()

// Should be in the [DeclarativeCommandBuilder]
// Should be in the [DeclarativeCommandBuilder] class
val permittedFlags = arrayListOf<FlagArgument>()
val options = OptionSyntax()

Expand Down Expand Up @@ -67,8 +68,9 @@ class ArgumentProcessor(
fun main() {
val ping by flag()
val option by optionArgument<String>()
val t by optionArgument<Int>()

val args = "msg MattMX foo bar --ping --option 'hello world'".split(" ")
val args = "msg MattMX foo bar --t 5 --ping --option 'hello world'".split(" ")
val processor = ArgumentProcessor(args)

processor.permittedFlags.add(ping)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
package com.mattmx.ktgui.commands.declarative.arg.impl

import com.mattmx.ktgui.commands.declarative.DeclarativeCommandBuilder
import com.mattmx.ktgui.commands.declarative.arg.Argument
import com.mattmx.ktgui.commands.declarative.arg.consumer.SingleArgumentConsumer
import com.mattmx.ktgui.commands.declarative.invocation.BaseCommandContext

class FlagArgument(
name: String
) : Argument<String>(name, "boolean", SingleArgumentConsumer()) {
) : Argument<Boolean>(name, "boolean", SingleArgumentConsumer()) {

fun chatName() = name().replace("_", "-")

override fun getValueOfString(
cmd: DeclarativeCommandBuilder,
context: BaseCommandContext<*>,
split: List<String>
): Boolean? {
// todo context should contain included flags/options
return false
}

}

0 comments on commit bbeef0f

Please sign in to comment.