Skip to content

Don't be too strict with positional and positionalList names #68

@holgerbrandl

Description

@holgerbrandl

I'd expect the following bits to be legit but for some reason they are not:

class MyArgs(parser: ArgParser) {

    val imageDirectory by parser.positional("directory", "The directory which should be scanned for orphan images")

    val markdownFiles by parser.positionalList("<md files>", "Markdown files to be used as reference to detect orphans")
}
Exception in thread "main" java.lang.IllegalArgumentException: directory is not a valid argument name
	at com.xenomachina.argparser.PositionalDelegate.<init>(PositionalDelegate.kt:33)
	at com.xenomachina.argparser.ArgParser.positionalList(ArgParser.kt:315)
	at com.xenomachina.argparser.ArgParser.positional(ArgParser.kt:263)
	at com.xenomachina.argparser.ArgParser.positional(ArgParser.kt:246)
	at MyArgs.<init>(orphimg.kt:15)
	at OrphimgKt$main$args$1$1.invoke(orphimg.kt:20)
	at OrphimgKt$main$args$1$1.invoke(orphimg.kt)
	at com.xenomachina.argparser.ArgParser.parseInto(ArgParser.kt:469)

For some reason the PositionalDelegate is overly strict (just captialized letters) when it comes to naming my parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions