Example #1
0
        private void CreateOptions()
        {
            CheckPayeesHandler  = Options.Add(new Option(OptionCheckPayees));
            DayBreakHandler     = Options.Add(new Option(OptionDayBreak));
            DownloadHandler     = Options.Add(new Option(OptionDownload));
            DecimalCommaHandler = Options.Add(new Option(OptionDecimalComma, (o, w) => Commodity.Defaults.DecimalCommaByDefault = true));
            TimeColonHandler    = Options.Add(new Option(OptionTimeColon, (o, w) => Commodity.Defaults.TimeColonByDefault = true));
            PriceExpHandler     = Options.Add(new Option(OptionPriceExp)
            {
                Value = "24"
            });
            FileHandler = Options.Add(new FileOption()
            {
                Parent = this
            });
            InputDateFormatHandler = Options.Add(new Option(OptionInputDateFormat, (o, w, s) =>
            {
                // This changes static variables inside times.h, which affects the
                // basic date parser.
                TimesCommon.Current.SetInputDateFormat(s);
            }));
            ExplicitHandler         = Options.Add(new Option(OptionExplicit));
            MasterAccountHandler    = Options.Add(new Option(OptionMasterAccount));
            PedanticHandler         = Options.Add(new Option(OptionPedantic));
            PermissiveHandler       = Options.Add(new Option(OptionPermissive));
            PriceDbHandler          = Options.Add(new Option(OptionPriceDb));
            StrictHandler           = Options.Add(new Option(OptionStrict));
            ValueExprHandler        = Options.Add(new Option(OptionValueExpr));
            RecursiveAliasesHandler = Options.Add(new Option(OptionRecursiveAliases));
            NoAliasesHandler        = Options.Add(new Option(OptionNoAliases));

            Options.AddLookupArgs(OptionDownload, "Q");
            Options.AddLookupArgs(OptionPriceExp, "Z");
            Options.AddLookupOpt(OptionCheckPayees);
            Options.AddLookupOpt(OptionDownload);
            Options.AddLookupOpt(OptionDecimalComma);
            Options.AddLookupOpt(OptionDayBreak);
            Options.AddLookupOpt(OptionExplicit);
            Options.AddLookupOptArgs(OptionFile, "f");
            Options.AddLookupOpt(OptionInputDateFormat);
            Options.AddLookupOptAlt(OptionPriceExp, "leeway_");
            Options.AddLookupOpt(OptionMasterAccount);
            Options.AddLookupOpt(OptionNoAliases);
            Options.AddLookupOpt(OptionPriceDb);
            Options.AddLookupOpt(OptionPriceExp);
            Options.AddLookupOpt(OptionPedantic);
            Options.AddLookupOpt(OptionPermissive);
            Options.AddLookupOpt(OptionRecursiveAliases);
            Options.AddLookupOpt(OptionStrict);
            Options.AddLookupOpt(OptionTimeColon);
            Options.AddLookupOpt(OptionValueExpr);
        }
Example #2
0
        private void CreateOptions()
        {
            ArgsOnlyHandler = Options.Add(new Option(OptionArgsOnly));
            DebugHandler    = Options.Add(new Option(OptionDebug));
            HelpHandler     = Options.Add(new Option(OptionHelp, (o, w) => VisitManPage()));

            InitFileHandler = Options.Add(new Option(OptionInitFile));
            if (!String.IsNullOrEmpty(GlobalScope.InitFile))
            {
                // _init_file is filled during handle_debug_options
                InitFileHandler.On(null, GlobalScope.InitFile);
            }

            OptionsHandler      = Options.Add(new Option(OptionOptions));
            ScriptHandler       = Options.Add(new Option(OptionScript));
            TraceHandler        = Options.Add(new Option(OptionTrace));
            VerboseHandler      = Options.Add(new Option(OptionVerbose));
            VerifyHandler       = Options.Add(new Option(OptionVerify));
            VerifyMemoryHandler = Options.Add(new Option(OptionVerifyMemory));
            VersionHandler      = Options.Add(new Option(OptionVersion, (o, w) =>
            {
                VirtualConsole.Output.WriteLine(ShowVersionInfo());
                throw new CountError(0, String.Empty); // exit immediately
            }));

            Options.AddLookupOpt(OptionArgsOnly);
            Options.AddLookupOpt(OptionDebug);
            Options.AddLookupOptArgs(OptionHelp, "h");
            Options.AddLookupOptArgs(OptionInitFile, "i");
            Options.AddLookupOpt(OptionOptions);
            Options.AddLookupOpt(OptionScript);
            Options.AddLookupOpt(OptionTrace);
            Options.AddLookupOptArgs(OptionVerbose, "v");
            Options.AddLookupOpt(OptionVerify);
            Options.AddLookupOpt(OptionVerifyMemory);
            Options.AddLookupOpt(OptionVersion);
        }