golo-lang icon indicating copy to clipboard operation
golo-lang copied to clipboard

Configuration file for the command line

Open yloiseau opened this issue 10 years ago • 2 comments

Wouldn't it be nice to have a simple configuration file to configure default behavior of the command line? For instance, it could be a JSON file (to avoid introducing new dependencies), located in a standard (system dependent) place, e.g. ~/.golorc, where default values for the command line options of the golo command could be overridden.

Rough sample file:

{
    "compile":  {
        "output": "build"},
    "doc": {
        "format": "markdown",
        "output": "build/doc"},
    "golo": {
        "classpath": ["~/opt/mylib.jar", "/usr/share/java/useful.jar"]},
    "new": {
        "type": "gradle"}
}

A project specific file could also be defined, which would override the defaults and the values defined in ~/.golorc (e.g. to define default --files and --module values).

For instance, in MyProject/.golorc:

{
    "golo": {
        "classpath": ["libs/additional.jar"],
        "files": ["src/foo.golo", "src/bar.golo", "src/main.golo"],
        "module": "MyProject"}
}

(relative files resolved with the base directory of the golorc they pertains, or relative to the directory the command is run, to be defined)

thus running a simple golo golo in MyProject would be equivalent to run

golo golo --classpath ~/opt/mylib.jar:/usr/share/java/useful.jar:./libs/additional.jar --files src/foo.golo src/bar.golo src/main.golo --module MyProject

and golo doc would result in

golo doc --format markdown --output ./build/doc

A additional command line may be added to specify an alternate configuration file.

The purpose is not to replace a full featured build management (mvn, gradle), but to make long command lines shorter.

yloiseau avatar Dec 10 '15 15:12 yloiseau

Sounds like a worthy idea to explore.

jponge avatar Dec 10 '15 16:12 jponge

Maybe a property file would be more convenient than JSON (it's Java ecosystem after all).

yloiseau avatar Dec 06 '18 12:12 yloiseau