4
0
Fork 0
mirror of https://github.com/Anvilcraft/modpacktools synced 2024-10-01 13:39:09 +02:00

contributors in modlists will now be colored

This commit is contained in:
LordMZTE 2020-08-03 00:03:24 +02:00
parent fb0ed7b19d
commit c99a1f8bdb
2 changed files with 17 additions and 10 deletions

View file

@ -7,7 +7,6 @@ import ley.anvil.addonscript.wrapper.ArtifactDestination
import ley.anvil.addonscript.wrapper.MetaData import ley.anvil.addonscript.wrapper.MetaData
import ley.anvil.modpacktools.MPJH import ley.anvil.modpacktools.MPJH
import ley.anvil.modpacktools.command.CommandReturn import ley.anvil.modpacktools.command.CommandReturn
import ley.anvil.modpacktools.command.CommandReturn.Companion.fail
import ley.anvil.modpacktools.command.CommandReturn.Companion.success import ley.anvil.modpacktools.command.CommandReturn.Companion.success
import ley.anvil.modpacktools.command.ICommand import ley.anvil.modpacktools.command.ICommand
import ley.anvil.modpacktools.command.LoadCommand import ley.anvil.modpacktools.command.LoadCommand
@ -47,7 +46,7 @@ object CreateModlist : ICommand {
.help("What format the mod list should be made in") .help("What format the mod list should be made in")
parser.addArgument("file") parser.addArgument("file")
.type(FileArgumentType()) .type(FileArgumentType().verifyNotExists())
.help("What file the mod list should be written to") .help("What file the mod list should be written to")
parser parser
@ -56,9 +55,6 @@ object CreateModlist : ICommand {
override fun execute(args: Namespace): CommandReturn { override fun execute(args: Namespace): CommandReturn {
val outFile = args.get<File>("file") val outFile = args.get<File>("file")
if(outFile.exists())
return fail("File already exists!")
val all = args.get<Boolean>("all") ?: false val all = args.get<Boolean>("all") ?: false
val sorting: Comparator<MetaData> = when(args.get<Sorting>("sorting")!!) { val sorting: Comparator<MetaData> = when(args.get<Sorting>("sorting")!!) {
Sorting.NAME -> comparing<MetaData, String> {it.name} Sorting.NAME -> comparing<MetaData, String> {it.name}
@ -128,6 +124,8 @@ object CreateModlist : ICommand {
td(ul( td(ul(
each(it.contributors) {contr -> each(it.contributors) {contr ->
li(contr.key) li(contr.key)
//for contributor colors
.withClass("contributor_${contr.value.getOrElse(0) {""}}")
} }
)), )),
td(each(it.description?.asList() ?: listOf()) {d: String -> td(each(it.description?.asList() ?: listOf()) {d: String ->

View file

@ -1,21 +1,30 @@
a:link { a:link {
color: #ff5555; color: #f55;
} }
a:visited { a:visited {
color: #cc55cc; color: #c5c;
} }
body { body {
background-color: #333333; background-color: #333;
color: #ffffff; color: #fff;
font-family: sans-serif; font-family: sans-serif;
} }
.img { .img {
width: 100px; width: 100px;
} }
td { td {
border: #999999 3px; border: #999 3px;
border-style: solid; border-style: solid;
} }
.description { .description {
width: 100%; width: 100%;
} }
.contributor_owner {
color: #f55;
}
.contributor_author {
color: orange;
}
.contributor_contributor {
color: green;
}