[skip ci] add DesktopCliParsingSequence.md
This commit is contained in:
parent
0f7e3790ca
commit
d6d42c0733
4 changed files with 57 additions and 15 deletions
39
doc/DesktopCliParsingSequence.md
Normal file
39
doc/DesktopCliParsingSequence.md
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
```plantuml
|
||||||
|
@startuml
|
||||||
|
|
||||||
|
autonumber
|
||||||
|
|
||||||
|
skinparam sequenceBox {
|
||||||
|
borderColor White
|
||||||
|
}
|
||||||
|
|
||||||
|
participant User
|
||||||
|
|
||||||
|
User -> Application ++ : main(args...)
|
||||||
|
Application -> CliArgumentsParser : create
|
||||||
|
CliArgumentsParser -> ArgParser : subcommands
|
||||||
|
Application -> CliArgumentsParser : parseCommand
|
||||||
|
CliArgumentsParser -> ArgParser : super.parse
|
||||||
|
|
||||||
|
CliArgumentsParser -> CliTargetCommand : create()
|
||||||
|
CliTargetCommand -> CliTargetCommand : parseRemoteTarget
|
||||||
|
alt passwordInteractive == true
|
||||||
|
CliTargetCommand -> PromptSecretSource : prompt-for-password
|
||||||
|
end
|
||||||
|
CliArgumentsParser -> DesktopCliCommand : create(desktopType, cliTargetCmd, ...)
|
||||||
|
CliArgumentsParser --> Application: desktopCliCommand
|
||||||
|
Application -> DesktopCliCommand : isValid ?
|
||||||
|
Application -> CliUtils : createProvInstance
|
||||||
|
ProvInstance <- CliUtils : create
|
||||||
|
alt target.isValidLocal
|
||||||
|
CliUtils -> CliUtils : createLocalProv
|
||||||
|
else target.isValidRemote
|
||||||
|
CliUtils -> CliUtils : createRemote
|
||||||
|
end
|
||||||
|
Application -> DesktopService1 : provisionDesktopCommand ( provInstance, desktopCliCommand )
|
||||||
|
DesktopService1 -> DesktopService2 : provisionDesktop( config )
|
||||||
|
DesktopService1 -> ConfigRepository : getConfig
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
|
||||||
|
```
|
|
@ -3,7 +3,6 @@ package org.domaindrivenarchitecture.provs.configuration.application
|
||||||
import kotlinx.cli.ArgParser
|
import kotlinx.cli.ArgParser
|
||||||
import kotlinx.cli.ArgType
|
import kotlinx.cli.ArgType
|
||||||
import kotlinx.cli.default
|
import kotlinx.cli.default
|
||||||
import org.domaindrivenarchitecture.provs.configuration.domain.TargetCliCommand
|
|
||||||
|
|
||||||
open class CliTargetParser(name: String) : ArgParser(name) {
|
open class CliTargetParser(name: String) : ArgParser(name) {
|
||||||
val target by argument(
|
val target by argument(
|
||||||
|
@ -16,14 +15,4 @@ open class CliTargetParser(name: String) : ArgParser(name) {
|
||||||
"p",
|
"p",
|
||||||
"prompt for password for remote target",
|
"prompt for password for remote target",
|
||||||
).default(false)
|
).default(false)
|
||||||
}
|
|
||||||
|
|
||||||
fun parseTarget(
|
|
||||||
programName: String = "provs",
|
|
||||||
args: Array<String>
|
|
||||||
): TargetCliCommand {
|
|
||||||
val parser = CliTargetParser(programName)
|
|
||||||
parser.parse(args)
|
|
||||||
|
|
||||||
return TargetCliCommand(parser.target, parser.passwordInteractive)
|
|
||||||
}
|
}
|
|
@ -25,12 +25,14 @@ open class CliArgumentsParser(name: String) : CliTargetParser(name) {
|
||||||
|
|
||||||
val module = modules.first { it.parsed }
|
val module = modules.first { it.parsed }
|
||||||
|
|
||||||
|
val targetCliCommand = TargetCliCommand(
|
||||||
|
target,
|
||||||
|
passwordInteractive
|
||||||
|
)
|
||||||
|
|
||||||
return DesktopCliCommand(
|
return DesktopCliCommand(
|
||||||
DesktopType.valueOf(module.name.uppercase()),
|
DesktopType.valueOf(module.name.uppercase()),
|
||||||
TargetCliCommand(
|
targetCliCommand,
|
||||||
target,
|
|
||||||
passwordInteractive
|
|
||||||
),
|
|
||||||
module.configFileName,
|
module.configFileName,
|
||||||
module.onlyModules
|
module.onlyModules
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,9 +1,21 @@
|
||||||
package org.domaindrivenarchitecture.provs.configuration.application
|
package org.domaindrivenarchitecture.provs.configuration.application
|
||||||
|
|
||||||
|
import org.domaindrivenarchitecture.provs.configuration.domain.TargetCliCommand
|
||||||
import org.junit.jupiter.api.Assertions.*
|
import org.junit.jupiter.api.Assertions.*
|
||||||
import org.junit.jupiter.api.Disabled
|
import org.junit.jupiter.api.Disabled
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
|
||||||
|
private fun parseTarget(
|
||||||
|
args: Array<String>
|
||||||
|
): TargetCliCommand {
|
||||||
|
val parser = CliTargetParser("provs")
|
||||||
|
|
||||||
|
parser.parse(args)
|
||||||
|
|
||||||
|
return TargetCliCommand(parser.target, parser.passwordInteractive)
|
||||||
|
}
|
||||||
|
|
||||||
internal class CliTargetParserTest {
|
internal class CliTargetParserTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue