Example #1
0
        public string ReportOptions(Report report)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("===============================================================================");
            sb.AppendLine("[Global scope options]");

            sb.AppendLine(ArgsOnlyHandler.Report());
            sb.AppendLine(DebugHandler.Report());
            sb.AppendLine(InitFileHandler.Report());
            sb.AppendLine(ScriptHandler.Report());
            sb.AppendLine(TraceHandler.Report());
            sb.AppendLine(VerboseHandler.Report());
            sb.AppendLine(VerifyHandler.Report());
            sb.AppendLine(VerifyMemoryHandler.Report());

            sb.AppendLine("[Session scope options]");
            sb.AppendLine(report.Session.ReportOptions());

            sb.AppendLine("[Report scope options]");
            sb.AppendLine(report.ReportOptions());
            sb.AppendLine("===============================================================================");

            return(sb.ToString());
        }
Example #2
0
        public void ReadInit()
        {
            // if specified on the command line init_file_ is filled in
            // global_scope_t::handle_debug_options.  If it was specified on the command line
            // fail if the file doesn't exist. If no init file was specified
            // on the command-line then try the default values, but don't fail if there
            // isn't one.
            string initFile;

            if (InitFileHandler.Handled)
            {
                initFile = InitFileHandler.Str();
                if (!FileSystem.FileExists(initFile))
                {
                    throw new ParseError(String.Format(ParseError.ParseError_CouldNotFindSpecifiedInitFile, initFile));
                }
            }
            else
            {
                initFile = FileSystem.HomePath(".ledgerrc");
                if (!FileSystem.FileExists(initFile))
                {
                    initFile = ".ledgerrc";
                }
            }
            if (FileSystem.FileExists(initFile))
            {
                ParseInit(initFile);
            }
        }
Example #3
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);
        }