SoftVarE-Group / MibTeX

Minimalistic tool to manage your references with BibTeX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding better parameter handling

Kogoro opened this issue · comments

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.

.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.

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

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

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

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.

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?

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

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! :)