diff --git a/.idea/misc.xml b/.idea/misc.xml index 68e2cf5..482c30b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/argTests.kt b/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/argTests.kt index 96dad21..d1ed432 100644 --- a/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/argTests.kt +++ b/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/argTests.kt @@ -7,9 +7,10 @@ class ArgumentProcessor( val args: List ) { var pointer = 0 + // Should be added to the command context val values = hashMapOf() - // Should be in the [DeclarativeCommandBuilder] + // Should be in the [DeclarativeCommandBuilder] class val permittedFlags = arrayListOf() val options = OptionSyntax() @@ -67,8 +68,9 @@ class ArgumentProcessor( fun main() { val ping by flag() val option by optionArgument() + val t by optionArgument() - 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) diff --git a/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/impl/FlagArgument.kt b/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/impl/FlagArgument.kt index 138d6f5..e1e75a6 100644 --- a/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/impl/FlagArgument.kt +++ b/api/src/main/kotlin/com/mattmx/ktgui/commands/declarative/arg/impl/FlagArgument.kt @@ -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(name, "boolean", SingleArgumentConsumer()) { +) : Argument(name, "boolean", SingleArgumentConsumer()) { fun chatName() = name().replace("_", "-") + override fun getValueOfString( + cmd: DeclarativeCommandBuilder, + context: BaseCommandContext<*>, + split: List + ): Boolean? { + // todo context should contain included flags/options + return false + } + } \ No newline at end of file