Skip to content

Commit e4b7d16

Browse files
committed
Command-line options and Markdown output
1 parent c10a0a0 commit e4b7d16

13 files changed

+355
-104
lines changed

.editorconfig

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ ij_visual_guides = 100
1515
ij_wrap_on_typing = false
1616

1717
[*.css]
18-
ij_visual_guides = none
1918
ij_css_align_closing_brace_with_properties = false
2019
ij_css_blank_lines_around_nested_selector = 1
2120
ij_css_blank_lines_between_blocks = 1
@@ -35,19 +34,15 @@ ij_css_use_double_quotes = true
3534
ij_css_value_alignment = do_not_align
3635

3736
[*.feature]
38-
ij_visual_guides = none
3937
ij_gherkin_keep_indents_on_empty_lines = false
4038

4139
[*.gsp]
42-
ij_visual_guides = none
4340
ij_gsp_keep_indents_on_empty_lines = false
4441

4542
[*.haml]
46-
ij_visual_guides = none
4743
ij_haml_keep_indents_on_empty_lines = false
4844

4945
[*.java]
50-
ij_visual_guides = none
5146
ij_java_align_consecutive_assignments = false
5247
ij_java_align_consecutive_variable_declarations = false
5348
ij_java_align_group_field_declarations = false
@@ -296,7 +291,6 @@ ij_java_wrap_first_method_in_call_chain = false
296291
ij_java_wrap_long_lines = false
297292

298293
[*.less]
299-
ij_visual_guides = none
300294
ij_less_align_closing_brace_with_properties = false
301295
ij_less_blank_lines_around_nested_selector = 1
302296
ij_less_blank_lines_between_blocks = 1
@@ -316,10 +310,7 @@ ij_less_use_double_quotes = true
316310
ij_less_value_alignment = 0
317311

318312
[*.nbtt]
319-
indent_style = space
320-
max_line_length = 150
321313
ij_continuation_indent_size = 4
322-
ij_visual_guides = none
323314
ij_nbtt_keep_indents_on_empty_lines = false
324315
ij_nbtt_space_after_colon = true
325316
ij_nbtt_space_after_comma = true
@@ -329,7 +320,6 @@ ij_nbtt_spaces_within_brackets = false
329320
ij_nbtt_spaces_within_parentheses = false
330321

331322
[*.sass]
332-
ij_visual_guides = none
333323
ij_sass_align_closing_brace_with_properties = false
334324
ij_sass_blank_lines_around_nested_selector = 1
335325
ij_sass_blank_lines_between_blocks = 1
@@ -349,7 +339,6 @@ ij_sass_use_double_quotes = true
349339
ij_sass_value_alignment = 0
350340

351341
[*.scss]
352-
ij_visual_guides = none
353342
ij_scss_align_closing_brace_with_properties = false
354343
ij_scss_blank_lines_around_nested_selector = 1
355344
ij_scss_blank_lines_between_blocks = 1
@@ -369,7 +358,6 @@ ij_scss_use_double_quotes = true
369358
ij_scss_value_alignment = 0
370359

371360
[*.styl]
372-
ij_visual_guides = none
373361
ij_stylus_align_closing_brace_with_properties = false
374362
ij_stylus_blank_lines_around_nested_selector = 1
375363
ij_stylus_blank_lines_between_blocks = 1
@@ -389,7 +377,6 @@ ij_stylus_use_double_quotes = true
389377
ij_stylus_value_alignment = 0
390378

391379
[.editorconfig]
392-
ij_visual_guides = none
393380
ij_editorconfig_align_group_field_declarations = false
394381
ij_editorconfig_space_after_colon = false
395382
ij_editorconfig_space_after_comma = true
@@ -398,7 +385,6 @@ ij_editorconfig_space_before_comma = false
398385
ij_editorconfig_spaces_around_assignment_operators = true
399386

400387
[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.pom,*.rng,*.tld,*.wadl,*.wsdd,*.wsdl,*.xjb,*.xml,*.xsd,*.xsl,*.xslt,*.xul}]
401-
ij_visual_guides = none
402388
ij_xml_align_attributes = true
403389
ij_xml_align_text = false
404390
ij_xml_attribute_wrap = normal
@@ -418,7 +404,6 @@ ij_xml_text_wrap = normal
418404
ij_xml_use_custom_settings = false
419405

420406
[{*.ats,*.ts}]
421-
ij_visual_guides = none
422407
ij_typescript_align_imports = false
423408
ij_typescript_align_multiline_array_initializer_expression = false
424409
ij_typescript_align_multiline_binary_operation = false
@@ -586,7 +571,6 @@ ij_typescript_while_on_new_line = false
586571
ij_typescript_wrap_comments = false
587572

588573
[{*.bash,*.sh,*.zsh}]
589-
ij_visual_guides = none
590574
ij_shell_binary_ops_start_line = false
591575
ij_shell_keep_column_alignment_padding = false
592576
ij_shell_minify_program = false
@@ -595,7 +579,6 @@ ij_shell_switch_cases_indented = false
595579

596580
[{*.cjs,*.js}]
597581
ij_continuation_indent_size = 4
598-
ij_visual_guides = none
599582
ij_javascript_align_imports = false
600583
ij_javascript_align_multiline_array_initializer_expression = false
601584
ij_javascript_align_multiline_binary_operation = false
@@ -761,7 +744,6 @@ ij_javascript_wrap_comments = false
761744

762745
[{*.cjsx,*.coffee}]
763746
ij_continuation_indent_size = 4
764-
ij_visual_guides = none
765747
ij_coffeescript_align_function_body = false
766748
ij_coffeescript_align_imports = false
767749
ij_coffeescript_align_multiline_array_initializer_expression = true
@@ -856,11 +838,9 @@ ij_coffeescript_use_semicolon_after_statement = false
856838
ij_coffeescript_var_declaration_wrap = normal
857839

858840
[{*.ft,*.vm,*.vsl}]
859-
ij_visual_guides = none
860841
ij_vtl_keep_indents_on_empty_lines = false
861842

862843
[{*.gant,*.gradle,*.groovy,*.gson,*.gy}]
863-
ij_visual_guides = none
864844
ij_groovy_align_group_field_declarations = false
865845
ij_groovy_align_multiline_array_initializer_expression = false
866846
ij_groovy_align_multiline_assignment = false
@@ -1040,7 +1020,6 @@ ij_groovy_while_on_new_line = false
10401020
ij_groovy_wrap_long_lines = false
10411021

10421022
[{*.gradle.kts,*.kt,*.kts,*.main.kts}]
1043-
ij_visual_guides = none
10441023
ij_kotlin_align_in_columns_case_branch = false
10451024
ij_kotlin_align_multiline_binary_operation = false
10461025
ij_kotlin_align_multiline_extends_list = false
@@ -1122,7 +1101,6 @@ ij_kotlin_wrap_expression_body_functions = 1
11221101
ij_kotlin_wrap_first_method_in_call_chain = false
11231102

11241103
[{*.har,*.jsb2,*.jsb3,*.json,*.mcmeta,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config,mcmod.info}]
1125-
ij_visual_guides = none
11261104
ij_json_keep_blank_lines_in_code = 0
11271105
ij_json_keep_indents_on_empty_lines = false
11281106
ij_json_keep_line_breaks = true
@@ -1135,7 +1113,6 @@ ij_json_spaces_within_brackets = false
11351113
ij_json_wrap_long_lines = false
11361114

11371115
[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}]
1138-
ij_visual_guides = none
11391116
ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3
11401117
ij_html_align_attributes = true
11411118
ij_html_align_text = false
@@ -1164,29 +1141,23 @@ ij_html_text_wrap = normal
11641141
ij_html_uniform_ident = false
11651142

11661143
[{*.jsf,*.jsp,*.jspf,*.tag,*.tagf,*.xjsp}]
1167-
ij_visual_guides = none
11681144
ij_jsp_jsp_prefer_comma_separated_import_list = false
11691145
ij_jsp_keep_indents_on_empty_lines = false
11701146

11711147
[{*.jspx,*.tagx}]
1172-
ij_visual_guides = none
11731148
ij_jspx_keep_indents_on_empty_lines = false
11741149

11751150
[{*.properties,spring.handlers,spring.schemas}]
1176-
ij_visual_guides = none
11771151
ij_properties_align_group_field_declarations = false
11781152
ij_properties_keep_blank_lines = false
11791153
ij_properties_key_value_delimiter = equals
11801154
ij_properties_spaces_around_key_value_delimiter = false
11811155

11821156
[{*.toml,Cargo.lock,Gopkg.lock,Pipfile}]
1183-
indent_style = space
1184-
ij_visual_guides = none
11851157
ij_toml_keep_indents_on_empty_lines = false
11861158

11871159
[{*.yaml,*.yml}]
11881160
indent_size = 2
1189-
ij_visual_guides = none
11901161
ij_yaml_keep_indents_on_empty_lines = false
11911162
ij_yaml_keep_line_breaks = true
11921163
ij_yaml_space_before_colon = true

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ Generates changelogs for CurseForge modpacks.
1515

1616
All public-facing code is documented with Javadoc and (mostly) tested with JUnit.
1717

18-
## How to use?
19-
1. Put the `manifest.json` from your old version in a folder and rename it to `old.json`.
20-
2. Put the `manifest.json` from your new version in the same folder and rename it to `new.json`.
21-
3. Execute the `ChangelogGenerator.jar` by double-clicking it in the same folder.
22-
4. Wait for the `changelog.txt`.
18+
## Usage
19+
20+
Run `java -jar ChangelogGenerator-[version].jar --help` for command-line usage instructions.

build.gradle

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
group = "com.therandomlabs.changeloggenerator"
2-
version = "2.0.0-pre5"
2+
version = "2.0.0-pre6"
33

44
ext {
55
commonGradleBranch = "master"
6-
mainClass = "${group}.Main"
6+
mainClass = "${group}.ChangelogGeneratorOptions"
77
jacocoExcludes = [
88
"com.therandomlabs.changeloggenerator.ChangelogEntry",
9-
"com.therandomlabs.changeloggenerator.Main"
9+
"com.therandomlabs.changeloggenerator.ChangelogGeneratorOptions"
1010
]
1111
}
1212

@@ -22,7 +22,14 @@ dependencies {
2222
api "com.github.TheRandomLabs:CurseAPI:master-SNAPSHOT"
2323
api "com.github.TheRandomLabs:CurseAPI-Minecraft:master-SNAPSHOT"
2424

25+
implementation "info.picocli:picocli:4.6.1"
26+
annotationProcessor "info.picocli:picocli-codegen:4.6.1"
27+
2528
implementation "com.atlassian.commonmark:commonmark:0.13.1"
2629

2730
testImplementation "com.github.TheRandomLabs:TRLUtils-IO:master-SNAPSHOT"
2831
}
32+
33+
compileJava {
34+
options.compilerArgs += "-Aproject=${project.group}/${project.name}"
35+
}

src/main/java/com/therandomlabs/changeloggenerator/BasicChangelogGenerator.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ public class BasicChangelogGenerator extends ChangelogGenerator {
5252
*/
5353
public static final BasicChangelogGenerator instance = new BasicChangelogGenerator();
5454

55-
private static final Splitter LINE_SEPARATOR_SPLITTER = Splitter.on(System.lineSeparator()).
55+
/**
56+
* A {@link Splitter} that works on line separators.
57+
* Empty strings are omitted, and results are trimmed.
58+
*/
59+
protected static final Splitter LINE_SEPARATOR_SPLITTER = Splitter.on(System.lineSeparator()).
5660
omitEmptyStrings().
5761
trimResults();
5862

@@ -67,7 +71,9 @@ protected BasicChangelogGenerator() {
6771
* {@inheritDoc}
6872
*/
6973
@Override
70-
public String generate(CurseModpack oldModpack, CurseModpack newModpack) throws CurseException {
74+
public String generate(
75+
CurseModpack oldModpack, CurseModpack newModpack, ChangelogGeneratorOptions options
76+
) throws CurseException {
7177
final CurseFilesComparison<BasicCurseFile> comparison =
7278
CurseFilesComparison.of(oldModpack.files(), newModpack.files());
7379
final StringBuilder builder = new StringBuilder();
@@ -167,7 +173,7 @@ protected void appendFiles(
167173
);
168174

169175
for (String projectName : projectNames) {
170-
builder.append(System.lineSeparator()).append("- ").append(projectName);
176+
builder.append(System.lineSeparator()).append("* ").append(projectName);
171177
}
172178
}
173179

@@ -183,7 +189,7 @@ protected void appendFiles(
183189
protected void appendChangelogEntries(
184190
StringBuilder builder, String title, Set<CurseFileChange<BasicCurseFile>> fileChanges
185191
) throws CurseException {
186-
builder.append(title).append(':');
192+
appendTitle(builder, title);
187193

188194
final Map<String, ChangelogEntries> allEntries = new TreeMap<>(CurseAPI.parallelMap(
189195
fileChanges,

src/main/java/com/therandomlabs/changeloggenerator/ChangelogEntry.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
package com.therandomlabs.changeloggenerator;
2525

2626
import com.google.common.base.MoreObjects;
27+
import okhttp3.HttpUrl;
2728
import org.jsoup.nodes.Element;
2829

2930
/**
@@ -32,19 +33,22 @@
3233
public final class ChangelogEntry implements Comparable<ChangelogEntry> {
3334
private final Comparable<?> comparable;
3435
private final String title;
36+
private final HttpUrl url;
3537
private Element entry;
3638

3739
/**
38-
* Constructs a {@link ChangelogEntry} instance with the specified title and entry.
40+
* Constructs a {@link ChangelogEntry} instance with the specified title, entry and URL.
3941
*
4042
* @param comparable a {@link Comparable} for use in sorting. Changelog entries for newer
4143
* files should be sorted first.
4244
* @param title a title.
45+
* @param url a URL.
4346
* @param entry a changelog entry.
4447
*/
45-
public ChangelogEntry(Comparable<?> comparable, String title, Element entry) {
48+
public ChangelogEntry(Comparable<?> comparable, String title, HttpUrl url, Element entry) {
4649
this.comparable = comparable;
4750
this.title = title;
51+
this.url = url;
4852
this.entry = entry;
4953
}
5054

@@ -94,6 +98,14 @@ public String title() {
9498
return title;
9599
}
96100

101+
/**
102+
* Returns this {@link ChangelogEntry}'s URL.
103+
* @return this {@link ChangelogEntry}'s URL.
104+
*/
105+
public HttpUrl url() {
106+
return url;
107+
}
108+
97109
/**
98110
* Returns this {@link ChangelogEntry}'s changelog entry.
99111
*

src/main/java/com/therandomlabs/changeloggenerator/ChangelogGenerator.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,25 @@ public ChangelogEntries getChangelogEntries(
120120
* @return the generated changelog.
121121
* @throws CurseException if an error occurs.
122122
*/
123-
public abstract String generate(CurseModpack oldModpack, CurseModpack newModpack)
124-
throws CurseException;
123+
public String generate(CurseModpack oldModpack, CurseModpack newModpack) throws CurseException {
124+
return generate(oldModpack, newModpack, new ChangelogGeneratorOptions());
125+
}
126+
127+
/**
128+
* Generates a changelog that details changes between an older and newer version of a
129+
* CurseForge modpack.
130+
*
131+
* @param oldModpack a {@link CurseModpack} instance that represents an older version of a
132+
* CurseForge modpack.
133+
* @param newModpack a {@link CurseModpack} instance that represents a newer version of a
134+
* CurseForge modpack.
135+
* @param options ChangelogGenerator options.
136+
* @return the generated changelog.
137+
* @throws CurseException if an error occurs.
138+
*/
139+
public abstract String generate(
140+
CurseModpack oldModpack, CurseModpack newModpack, ChangelogGeneratorOptions options
141+
) throws CurseException;
125142

126143
/**
127144
* Registers the specified {@link ChangelogProvider} to this {@link ChangelogGenerator}

0 commit comments

Comments
 (0)