Ok, so I have a bin script and like so many other’s use some common
options such as --verbose and --debug. Generally I have been keeping
these flags in an options hash, specific to my app. But I wondering if
perhaps these may just as well use the global vars. Is that a good
practice, or are these globals specifically for something more
specialized for use by developers and should not be used by
applications?
If these globals are generally useful to applications, I note that a
$NOOP global for FileUtils methods seems useful.
well, setting $VERBOSE will also tamper with the display of warnings
issued by ruby, so it depends if that is included in what you want to
achieve
with --verbose.
In general, you could probably tie --debug to $DEBUG since to me that’s
a developer’s switch.
–verbose on the other hand sounds to me like it’s intended for end
users,
so ruby warnings to them will probably only be confusing (e.g. the
insecure directory warning)
insecure directory warning)
Thanks. You’re right. And that puts things into perspective for me.
Seems to me $VERBOSE would have been more aptly labeled $WARN --then
$VERBOSE would have been available for CLIs.
T.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.