get user consent from command line

This commit is contained in:
pm47 2024-03-25 12:07:26 +01:00
parent f2b378484a
commit df91b9604f
No known key found for this signature in database
GPG Key ID: E434ED292E85643A

View File

@ -84,6 +84,7 @@ class Phoenixd : CliktCommand() {
} }
value value
} }
private val agreeToTermsOfService by option("--agree-to-terms-of-service", hidden = true, help = "Agree to terms of service").flag()
private val chain by option("--chain", help = "Bitcoin chain to use").choice( private val chain by option("--chain", help = "Bitcoin chain to use").choice(
"mainnet" to Chain.Mainnet, "testnet" to Chain.Testnet "mainnet" to Chain.Mainnet, "testnet" to Chain.Testnet
).default(Chain.Mainnet, defaultForHelp = "mainnet") ).default(Chain.Mainnet, defaultForHelp = "mainnet")
@ -170,7 +171,7 @@ class Phoenixd : CliktCommand() {
@OptIn(DelicateCoroutinesApi::class) @OptIn(DelicateCoroutinesApi::class)
override fun run() { override fun run() {
FileSystem.SYSTEM.createDirectories(datadir) FileSystem.SYSTEM.createDirectories(datadir)
if (seed.isNew) { if (seed.isNew && !agreeToTermsOfService) {
runBlocking { runBlocking {
terminal.println(green("Backup")) terminal.println(green("Backup"))
terminal.println("This software is self-custodial, you have full control and responsibility over your funds.") terminal.println("This software is self-custodial, you have full control and responsibility over your funds.")