mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-25 15:40:28 +08:00
Correct class naming following Kotlin formal style
This commit is contained in:
parent
9a1a6dddfd
commit
11688b1dec
@ -23,9 +23,9 @@ package net.mamoe.mirai.console.pure
|
|||||||
AnnotationTarget.CONSTRUCTOR
|
AnnotationTarget.CONSTRUCTOR
|
||||||
)
|
)
|
||||||
@MustBeDocumented
|
@MustBeDocumented
|
||||||
annotation class ConsolePureExperimentalAPI
|
annotation class ConsolePureExperimentalApi
|
||||||
|
|
||||||
@ConsolePureExperimentalAPI
|
@ConsolePureExperimentalApi
|
||||||
public object ConsolePureSettings {
|
public object ConsolePureSettings {
|
||||||
@JvmField
|
@JvmField
|
||||||
var setupAnsi: Boolean = System.getProperty("os.name")
|
var setupAnsi: Boolean = System.getProperty("os.name")
|
||||||
|
@ -27,7 +27,7 @@ import org.jline.reader.UserInterruptException
|
|||||||
|
|
||||||
val consoleLogger by lazy { DefaultLogger("console") }
|
val consoleLogger by lazy { DefaultLogger("console") }
|
||||||
|
|
||||||
@OptIn(ConsoleInternalApi::class, ConsolePureExperimentalAPI::class)
|
@OptIn(ConsoleInternalApi::class, ConsolePureExperimentalApi::class)
|
||||||
internal fun startupConsoleThread() {
|
internal fun startupConsoleThread() {
|
||||||
if (ConsolePureSettings.noConsole) return
|
if (ConsolePureSettings.noConsole) return
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER_WARNING",
|
"INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER_WARNING",
|
||||||
"EXPOSED_SUPER_CLASS"
|
"EXPOSED_SUPER_CLASS"
|
||||||
)
|
)
|
||||||
@file:OptIn(ConsoleInternalApi::class, ConsoleFrontEndImplementation::class, ConsolePureExperimentalAPI::class)
|
@file:OptIn(ConsoleInternalApi::class, ConsoleFrontEndImplementation::class, ConsolePureExperimentalApi::class)
|
||||||
|
|
||||||
package net.mamoe.mirai.console.pure
|
package net.mamoe.mirai.console.pure
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"INVISIBLE_GETTER",
|
"INVISIBLE_GETTER",
|
||||||
"INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER",
|
"INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER",
|
||||||
)
|
)
|
||||||
@file:OptIn(ConsoleInternalApi::class, ConsolePureExperimentalAPI::class)
|
@file:OptIn(ConsoleInternalApi::class, ConsolePureExperimentalApi::class)
|
||||||
|
|
||||||
package net.mamoe.mirai.console.pure
|
package net.mamoe.mirai.console.pure
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ object MiraiConsolePureLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConsolePureExperimentalAPI
|
@ConsolePureExperimentalApi
|
||||||
fun printHelpMessage() {
|
fun printHelpMessage() {
|
||||||
val help = listOf(
|
val help = listOf(
|
||||||
"" to "Mirai-Console[Pure FrontEnd] v" + kotlin.runCatching {
|
"" to "Mirai-Console[Pure FrontEnd] v" + kotlin.runCatching {
|
||||||
@ -96,7 +96,7 @@ object MiraiConsolePureLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConsolePureExperimentalAPI
|
@ConsolePureExperimentalApi
|
||||||
fun parse(args: Array<String>, exitProcess: Boolean = false) {
|
fun parse(args: Array<String>, exitProcess: Boolean = false) {
|
||||||
val iterator = args.iterator()
|
val iterator = args.iterator()
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
/*
|
/*
|
||||||
* @author Karlatemp <karlatemp@vip.qq.com> <https://github.com/Karlatemp>
|
* @author Karlatemp <karlatemp@vip.qq.com> <https://github.com/Karlatemp>
|
||||||
*/
|
*/
|
||||||
@file:OptIn(ConsolePureExperimentalAPI::class)
|
@file:OptIn(ConsolePureExperimentalApi::class)
|
||||||
|
|
||||||
package net.mamoe.mirai.console.pure.noconsole
|
package net.mamoe.mirai.console.pure.noconsole
|
||||||
|
|
||||||
import net.mamoe.mirai.console.pure.ConsolePureExperimentalAPI
|
import net.mamoe.mirai.console.pure.ConsolePureExperimentalApi
|
||||||
import net.mamoe.mirai.console.pure.ConsolePureSettings
|
import net.mamoe.mirai.console.pure.ConsolePureSettings
|
||||||
import org.jline.keymap.KeyMap
|
import org.jline.keymap.KeyMap
|
||||||
import org.jline.reader.*
|
import org.jline.reader.*
|
||||||
@ -38,8 +38,7 @@ internal object NoConsoleNonBlockingReader : NonBlockingReader() {
|
|||||||
return LN_INT
|
return LN_INT
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {}
|
||||||
}
|
|
||||||
|
|
||||||
override fun readBuffered(b: CharArray?): Int {
|
override fun readBuffered(b: CharArray?): Int {
|
||||||
return 0
|
return 0
|
||||||
@ -47,13 +46,9 @@ internal object NoConsoleNonBlockingReader : NonBlockingReader() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal object AllNextLineInputStream : InputStream() {
|
internal object AllNextLineInputStream : InputStream() {
|
||||||
override fun read(): Int {
|
override fun read(): Int = LN_INT
|
||||||
return LN_INT
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun available(): Int {
|
override fun available(): Int = 1
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun read(b: ByteArray, off: Int, len: Int): Int {
|
override fun read(b: ByteArray, off: Int, len: Int): Int {
|
||||||
for (i in off until (off + len)) {
|
for (i in off until (off + len)) {
|
||||||
@ -62,28 +57,19 @@ internal object AllNextLineInputStream : InputStream() {
|
|||||||
return len
|
return len
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal object AllIgnoredOutputStream : OutputStream() {
|
internal object AllIgnoredOutputStream : OutputStream() {
|
||||||
override fun close() {
|
override fun close() {}
|
||||||
}
|
override fun write(b: ByteArray, off: Int, len: Int) {}
|
||||||
|
override fun write(b: ByteArray) {}
|
||||||
override fun write(b: ByteArray, off: Int, len: Int) {
|
override fun write(b: Int) {}
|
||||||
}
|
override fun flush() {}
|
||||||
|
|
||||||
override fun write(b: ByteArray) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun write(b: Int) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun flush() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal val SystemOutputPrintStream by lazy {
|
internal val SystemOutputPrintStream by lazy {
|
||||||
|
@OptIn(ConsolePureExperimentalApi::class)
|
||||||
if (ConsolePureSettings.setupAnsi) {
|
if (ConsolePureSettings.setupAnsi) {
|
||||||
org.fusesource.jansi.AnsiConsole.systemInstall()
|
org.fusesource.jansi.AnsiConsole.systemInstall()
|
||||||
}
|
}
|
||||||
@ -95,12 +81,13 @@ internal object AllEmptyLineReader : LineReader {
|
|||||||
|
|
||||||
override fun printAbove(str: String?) {
|
override fun printAbove(str: String?) {
|
||||||
if (str == null) return
|
if (str == null) return
|
||||||
|
@OptIn(ConsolePureExperimentalApi::class)
|
||||||
if (ConsolePureSettings.noAnsi) {
|
if (ConsolePureSettings.noAnsi) {
|
||||||
SystemOutputPrintStream.println(ANSI_REGEX.replace(str, ""))
|
SystemOutputPrintStream.println(ANSI_REGEX.replace(str, ""))
|
||||||
} else SystemOutputPrintStream.println(str)
|
} else SystemOutputPrintStream.println(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ConsolePureExperimentalAPI::class)
|
@OptIn(ConsolePureExperimentalApi::class)
|
||||||
override fun readLine(): String =
|
override fun readLine(): String =
|
||||||
if (ConsolePureSettings.noConsoleSafeReading) ConsolePureSettings.noConsoleReadingReplacement
|
if (ConsolePureSettings.noConsoleSafeReading) ConsolePureSettings.noConsoleReadingReplacement
|
||||||
else error("Unsupported Reading line when console front-end closed.")
|
else error("Unsupported Reading line when console front-end closed.")
|
||||||
@ -111,13 +98,13 @@ internal object AllEmptyLineReader : LineReader {
|
|||||||
override fun readLine(prompt: String?): String = readLine()
|
override fun readLine(prompt: String?): String = readLine()
|
||||||
override fun readLine(prompt: String?, mask: Char?): String = readLine()
|
override fun readLine(prompt: String?, mask: Char?): String = readLine()
|
||||||
override fun readLine(prompt: String?, mask: Char?, buffer: String?): String = readLine()
|
override fun readLine(prompt: String?, mask: Char?, buffer: String?): String = readLine()
|
||||||
override fun readLine(prompt: String?, rightPrompt: String?, mask: Char?, buffer: String?): String = ""
|
override fun readLine(prompt: String?, rightPrompt: String?, mask: Char?, buffer: String?): String = readLine()
|
||||||
override fun readLine(
|
override fun readLine(
|
||||||
prompt: String?,
|
prompt: String?,
|
||||||
rightPrompt: String?,
|
rightPrompt: String?,
|
||||||
maskingCallback: MaskingCallback?,
|
maskingCallback: MaskingCallback?,
|
||||||
buffer: String?
|
buffer: String?
|
||||||
): String = ""
|
): String = readLine()
|
||||||
|
|
||||||
override fun printAbove(str: AttributedString?) {
|
override fun printAbove(str: AttributedString?) {
|
||||||
str?.let { printAbove(it.toAnsi()) }
|
str?.let { printAbove(it.toAnsi()) }
|
||||||
|
Loading…
Reference in New Issue
Block a user