SoftVarE-Group / MibTeX

Minimalistic tool to manage your references with BibTeX
GNU Lesser General Public License v3.0
2 stars 1 forks source link

Adding better parameter handling #22

Closed Kogoro closed 7 years ago

Kogoro commented 8 years ago

We should improve the parameter handling through a config file or flags in the command line call. This makes it even easier with optional parameters.

Kogoro commented 8 years ago

.ini files are now supported with the following syntax:

[options]
bibtex-dir=
main-dir=
out-dir-rel=
pdf-dir=
pdf-dir-rel=
tags=tt-tags
clean=true
citationService=true
citation-dir=
out-format=HTML_NEW

The .ini file should lay at the top program folder.

tthuem commented 7 years ago

If there is just one .ini file with a fixed location, how can I start several configurations without changing the .ini file(s)?

Kogoro commented 7 years ago

At the moment it is not possible, but I can add different path support in the next days.

tthuem commented 7 years ago

No hurry. I noticed that I can use it with the command-line options for now.

Kogoro commented 7 years ago

Now it is possible to give the path to the .ini file as command line parameter. So you can create different links to the executable and run different configurations. If no parameter is set, it will try to load the options.ini file in the executable's main directory.

tthuem commented 7 years ago

I got parsing errors with the following ini file:

bibtex-dir=C:\\Users\\tthuem\\git\\paper-BibTeX\\bibtex\\
main-dir=C:\\Users\\tthuem\\git\\dropbox\\Dropbox\\Literatur\\
out-dir-rel=HTML\\
pdf-dir=..\\Library\\
pdf-dir-rel=Library\\
tags=tt-tags
clean=true
citationService=true
citation-dir=C:\\Users\\tthuem\\git\\paper-BibTeX\\bibtex\\
out-format=HTML_NEW
org.ini4j.InvalidFileFormatException: parse error (at line: 1): bibtex-dir=C:\\Users\\tthuem\\git\\paper-BibTeX\\bibtex\\
        at org.ini4j.spi.AbstractParser.parseError(AbstractParser.java:53)
        at org.ini4j.spi.IniParser.parse(IniParser.java:97)
        at org.ini4j.spi.IniParser.parse(IniParser.java:67)
        at org.ini4j.Ini.load(Ini.java:119)
        at org.ini4j.Ini.load(Ini.java:114)
        at org.ini4j.Ini.load(Ini.java:99)
        at org.ini4j.Ini.<init>(Ini.java:69)
        at de.mibtex.BibtexViewer.main(BibtexViewer.java:72)
Exception in thread "main" java.lang.NullPointerException
        at de.mibtex.BibtexViewer.main(BibtexViewer.java:76)

Can you give an example how the file is supposed to look like or correct the above example?

Kogoro commented 7 years ago

Should now work. Seems Windows needs a special format other than Linux. Should be fixed now on the dev branch.

My configuration ini looks like this on my Windows machine:

[options]
bibtex-dir=P:\\Github\\MibTeX\\MibTeX\\bibtex\\
main-dir=P:\\Github\\MibTeX\\MibTeX\\bibtex\\
out-dir-rel=..\\HTML\\
pdf-dir=..\\Library\\
pdf-dir-rel=PDF
tags=tt-tags
clean=true
citationService=true
citation-dir=
out-format=HTML_NEW
tthuem commented 7 years ago

Took me a while to find out that [options] is required and that you changed the order of two parameters. ;)

Seems to work fine now. Good job! :)