Exemple #1
0
 static void SetDefaults(ref Opts opts)
 {
     if (String.IsNullOrEmpty(opts.outfile))
     {
         opts.outfile = @".\delta.out.txt";
     }
     opts.newfile = @".\delta.new.txt";
     opts.modfile = @".\delta.mod.txt";
     opts.delfile = @".\delta.del.txt";
     opts.newdir  = @".\delta.NewDirs.txt";
     opts.deldir  = @".\delta.DelDirs.txt";
 }
Exemple #2
0
        static Opts GetOpts(string[] args)
        {
            bool show_help         = false;
            bool wrong_files_given = false;

            Opts opts = new Opts();
            var  p    = new Mono.Options.OptionSet()
            {
                { "o|out=", "filename for result of compare", v => opts.outfile = v },
                { "s|sorted", "write out sorted files", v => opts.writeOutSorted = v != null },
                { "d|debug", "debug", v => opts.debug = v != null },
                { "h|help", "show this message and exit", v => show_help = v != null },
            };

            try
            {
                List <string> twoFiles = p.Parse(args);
                if (twoFiles.Count == 2)
                {
                    opts.fileA = twoFiles[0];
                    opts.fileB = twoFiles[1];
                }
                else
                {
                    Console.Error.WriteLine("you should supply 2 filenames to compare");
                    wrong_files_given = true;
                }
            }
            catch (Mono.Options.OptionException oex)
            {
                Console.WriteLine(oex.Message);
                return(null);
            }
            if (show_help | wrong_files_given)
            {
                ShowHelp(p);
                return(null);
            }
            return(opts);
        }