bqw5189 / closure-templates

Automatically exported from code.google.com/p/closure-templates
Apache License 2.0
0 stars 0 forks source link

args4j doesn't allow setting boolean options to false #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Greg Slovacek reported that there's no way to set the boolean option 
--shouldDeclareTopLevelNamespaces to false because args4j by default only 
allows boolean options to be set to true.  We need to write an args4j 
OptionHandler that handles booleans and can set the value to false.  (Or we can 
negate the meaning of the flag, but I'd prefer not to do that.)

Original message from Greg Slovacek on closure-templates-discuss:

Hey Kai et al!

(Good to see your name pop up; enjoyed working with you back in the
GAIA days ..)

Thanks for maintaining this and sharing it with the community. Very
cool to have this in my toolbox.

I am using the JS code generator and am having some issues with the
its handling of the top-level namespaces (without closure, goog
require, etc.). I am writing templates that I want to place in an
existing namespace, but I'm not sure the code that gets generated does
the right thing for me. In particular, the line to check existence for
the top-level namespace looks like this:

 if (typeof Foo == 'undefined') { var Foo = {}; }

I believe the "var" inside the "if" gets hoisted out so regardless of
whether Foo is actually defined, a new "Foo" is created that hides any
existing one. When my code codes looking in the namespace defined
earlier, it doesn't find the templates that were added to it.

This would be okay if I could just use the very thoughtfully included
--shouldDeclareTopLevelNamespaces flag to turn off this output.
Unfortunately, I cannot figure out how to actually turn the flag off.
The default value is true, and the args4j library being used doesn't
appear to allow you to set the flag = false in any way; if the flag is
present, it will just set it to true .. which it already is.

Am I doing something wrong or are these indeed bugs? I would love to
have this solved so I don't have to post-process my templates to
remove the namespacing lines. =)

Thanks, and take care ..

Original issue reported on code.google.com by k...@google.com on 18 Feb 2011 at 10:30

GoogleCodeExporter commented 9 years ago
Priority low because this only affects IE and there are easy workarounds.

Original comment by kai.hu...@gmail.com on 18 Feb 2011 at 10:32

GoogleCodeExporter commented 9 years ago

Original comment by kai.hu...@gmail.com on 20 Sep 2011 at 12:09