The problem with 'init-file' though is that `read_init()` is called in
the constructor of `global_scope_t` and the arguments are read later
through a call to `global_scope->read_command_arguments()` in
`main()`.
Your patch introduced logic for init-file in `handle_debug_options()`.
A cleaner way would be to set `init-file` using the option handling
code in that constructor but one would have to introduce a further
loop to extract the init-file argument before `read_init()` is called.
Take a look at `global_scope_t::read_environment_settings()` for how
to set an option using the option handling code.
Maybe the option definition for `init-file` in `global.h` should check
if the file can not be found and throw an error (using 'DO_')? But as
the constructor also calls 'on()' the original question remains the
same: How to differentiate between default and user-provided value.

On Tue, Jan 8, 2013 at 6:06 PM, Craig Earls <[email protected]> wrote:
> John,
>   Some time ago I submitted a pull request to fix a problem with ledger and
> the default init file.  You mentioned on the comments to the pull request
> that ledger has a way of signaling that an option came from the command line
> (I added a method to interrogate the data for the options command).  I can't
> figure it out when/where ledger is storing that information.
>
> There is a similar problem with pricedb (Bug705) that I want to work, and it
> is probably worth solving both the same way.
>
> --
> Craig, Corona De Tucson, AZ
> enderw88.wordpress.com

Reply via email to