archimatetool / archi-scripting-plugin

jArchi - Scripting for Archi: ArchiMate Modelling Tool
https://www.archimatetool.com
118 stars 33 forks source link

Use a double hyphen for the argument example in the wiki #129

Closed 5-tom closed 4 months ago

5-tom commented 4 months ago

This issue concerns the $.process.argv (was getArgs()) section of the wiki. A '-' is being used when '--' should be. '-' are for flags '--' are for options

When I use a simple options parser like minimist I get:

{_: [], m: true, y: true, A: true, r: true, g: true}

because it thinks -myArg is -m -y -A -r -g

I believe you want this result: {_: [], myArg: "HelloWord"}

So you should use --myArg "HelloWorld" in the wiki.

Phillipus commented 4 months ago

$.process.argv is a wrapper around Eclipse code. See

https://github.com/archimatetool/archi-scripting-plugin/blob/97de812c1784289e121d5c86ac536718fe8b18ba/com.archimatetool.script/js/init.js#L14

Eclipse itself uses a mixture of '-' and '--' when setting options. In fact, org.eclipse.core.runtime.Platform.getApplicationArgs() returns arguments whether they have one, two or even three hyphens. So it doesn't matter. I'll update the wiki to show both.

Phillipus commented 4 months ago

I've updated the wiki with a note to say you can use one or two hyphens.

Please close this issue if that answers it!

5-tom commented 4 months ago

Amazing, thank you!