Skip to content

Commit

Permalink
Add annoying message
Browse files Browse the repository at this point in the history
  • Loading branch information
handymenny committed Nov 7, 2024
1 parent 03c01db commit abd8835
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 8 deletions.
10 changes: 10 additions & 0 deletions src/main/java/it/smartphonecombo/uecapabilityparser/cli/Clikt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,16 @@ object Cli : CliktCommand(name = "cli") {

private val debug by option("-d", "--debug", help = HelpMessage.DEBUG).flag()

private val suppressAnnoyingMessage by
option("--suppress-annoying-messages", help = HelpMessage.ANNOYING_MESSAGE_OPTION).flag()

private lateinit var jsonFormat: Json

override fun help(context: Context) = "Starts ue capability parser in cli mode"

override fun run() {
if (!suppressAnnoyingMessage) echo(HelpMessage.ANNOYING_MESSAGE)

// Set debug
if (debug) Config["debug"] = debug.toString()

Expand Down Expand Up @@ -264,9 +269,14 @@ object Server : CliktCommand(name = "server") {

private val debug by option("-d", "--debug", help = HelpMessage.DEBUG).flag()

private val suppressAnnoyingMessage by
option("--suppress-annoying-messages", help = HelpMessage.ANNOYING_MESSAGE_OPTION).flag()

override fun help(context: Context) = "Starts ue capability parser in server mode"

override fun run() {
if (!suppressAnnoyingMessage) echo(HelpMessage.ANNOYING_MESSAGE)

// Set debug
if (debug) Config["debug"] = debug.toString()
Config["maxRequestSize"] = maxRequestSize.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,16 @@ object HelpMessage {
const val CUSTOM_JS = "Inject custom js in Web UI"
const val LIBRARY_CACHE =
"Number of items to cache, each items occupies ~4-80KB of RAM. 0 = disabled, -1 = unlimited."
const val ANNOYING_MESSAGE_OPTION = "Don't ask to support the project"
val ANNOYING_MESSAGE =
"""
----------------------------------------------------
| Found UE Capability Parser useful? |
| Support its development! |
| More info on GitHub: |
| https://github.com/handymenny/uecapabilityparser |
----------------------------------------------------
"""
.trimIndent()
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ internal class CliCsvNewOutputTest {
"-",
"--new-csv-format",
"true",
"--suppress-annoying-messages",
oracleFilename = "carrierPolicy.csv",
)
}
Expand All @@ -34,6 +35,7 @@ internal class CliCsvNewOutputTest {
"-",
"--new-csv-format",
"true",
"--suppress-annoying-messages",
oracleFilename = "0xB0CD.csv",
)
}
Expand All @@ -49,6 +51,7 @@ internal class CliCsvNewOutputTest {
"-",
"--new-csv-format",
"true",
"--suppress-annoying-messages",
oracleFilename = "mtkLte.csv",
)
}
Expand All @@ -64,6 +67,7 @@ internal class CliCsvNewOutputTest {
"-",
"--new-csv-format",
"true",
"--suppress-annoying-messages",
oracleFilename = "nvItem.csv",
)
}
Expand All @@ -79,6 +83,7 @@ internal class CliCsvNewOutputTest {
"-",
"--new-csv-format",
"true",
"--suppress-annoying-messages",
oracleFilename = "qctModemCap.csv",
)
}
Expand All @@ -94,6 +99,7 @@ internal class CliCsvNewOutputTest {
"-",
"--new-csv-format",
"true",
"--suppress-annoying-messages",
oracleFilename = "wiresharkEutra.csv",
)
}
Expand All @@ -109,6 +115,7 @@ internal class CliCsvNewOutputTest {
"-",
"--new-csv-format",
"true",
"--suppress-annoying-messages",
oracleFilename = "nsgEutra.csv",
)
}
Expand All @@ -124,6 +131,7 @@ internal class CliCsvNewOutputTest {
"-",
"--new-csv-format",
"true",
"--suppress-annoying-messages",
oracleFilename = "temsEutra.csv",
)
}
Expand All @@ -139,6 +147,7 @@ internal class CliCsvNewOutputTest {
"-",
"--new-csv-format",
"true",
"--suppress-annoying-messages",
oracleFilename = "amarisoftEutra.csv",
)
}
Expand All @@ -156,6 +165,7 @@ internal class CliCsvNewOutputTest {
"-",
"--new-csv-format",
"true",
"--suppress-annoying-messages",
oracleFilename = "ueCapHexEutra.csv",
)
}
Expand All @@ -175,6 +185,7 @@ internal class CliCsvNewOutputTest {
"-",
"--new-csv-format",
"true",
"--suppress-annoying-messages",
oracleFilename = "0xB826-0xB0CD.csv",
)
}
Expand All @@ -188,6 +199,7 @@ internal class CliCsvNewOutputTest {
"SHLTE",
"-c",
"-",
"--suppress-annoying-messages",
oracleFilename = "shannonLteUeCap.csv",
)
}
Expand Down
Loading

0 comments on commit abd8835

Please sign in to comment.