Beispiel #1
0
        public void WithOptions(OptionParser opts)
        {
            opts.Header  = "Search for PATTERN in each FILE or standard input.\n";
            opts.Header += "Example: grep -i \"hello world\" menu.h main.c";

            opts.Required.Arg <string>("PATTERN", "{0} is a .NET/Mono Regular Expression string.").Do(pattern => settings.Pattern = pattern);
            opts.Args <string>("FILE", "").Do(settings.Files.AddRange);

            opts.In("Regexp selection and interpretation", g =>
            {
                g.On("ignore-case", 'i', "ignore case distinctions").Do(() => settings.RegexOptions |= RegexOptions.IgnoreCase);
            });
            opts.In("Miscellaneous", g =>
            {
                g.On("no-messages", 's', "suppress error messages").Do(() => settings.SuppressErrorMessages = true);
                g.On("invert-match", 'v', "select non-matching lines").Do(() => settings.InvertMatch        = true);
            });
            opts.In("Output control", g => {
                g.On("line-number", 'n', "print line number with output lines").Do(() => settings.Output.LineNumbers = true);
                g.On("with-filename", 'H', "print the filename for each match").Do(() => settings.Output.FileNames   = true);
                g.On("no-filename", 'h', "print line number with output lines").Do(() => settings.Output.FileNames   = false);
                g.On("files-without-match", 'L', "only print FILE names containing no match").Do(() => settings.Output.OnlyFileNames = OnlyFileNames.NonMatching);
                g.On("files-with-matches", 'l', "only print FILE names containing matches").Do(() => settings.Output.OnlyFileNames   = OnlyFileNames.Matching);
            });

            opts.Footer  = "With no FILE, or when FILE is -, read standard input.  If less than\n";
            opts.Footer += "two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n";
            opts.Footer += "and 2 if trouble.";
        }
Beispiel #2
0
        public void WithOptions(OptionParser opts)
        {
            opts.Required.Arg <string>("URL", "").Do(settings.Urls.Add);

            opts.In("Logging and input file", g =>
            {
                g.On("output-file", 'o', "log messages to {0}").WithArg <string>("FILE").Do(filename => settings.Logging.WriteTo       = filename);
                g.On("append-output", 'a', "append messages to {0}").WithArg <string>("FILE").Do(filename => settings.Logging.AppendTo = filename);
                g.On("quiet", 'q', "quiet (no output)").Do(() => { settings.Quiet = true; });
                g.On("debug", 'd', "print lots of debugging information").Do(() => settings.Logging.Debug = true);
            });

            opts.In("Download", g => {
                g.On("tries", 't', "set number of retries to {0} (0 - unlimited)").WithArg <int>("NUMBER").Do(retries => {});
                g.On("output-document", 'O', "write documents to {0}").WithArg <string>("FILE").Do(filename => settings.Download.OutputDocument = filename);
                g.On("no-clobber", 'n', "skip downloads that would download to existing files").Do(() => {});
                g.On("continue", 'c', "resume getting a partially-downloaded file").Do(() => {});
                g.On("progress", "select progress gauge {0}")
                .WithArg <ProgressType>("TYPE")
                .WithParseErrorMessage("--{0}: Invalid progress type '{1}'.\nValid choices are: None, Bar, Dot")
                .Do(type => settings.Download.ProgressType = type);
                g.On("timestamping", 'N', "don't re-retrieve files unless newer than local").Do(() => {});
                g.On("server-response", 'S', "print server response").Do(() => {});
                g.On("spider", "don't download anything").Do(() => {});
                g.On("timeout", 'T', "set all timeout values to {0}").WithArg <int>("SECONDS").Do(timeout => {});
                g.On("user", "set both ftp and http user to {0}").WithArg <string>("USER").Do(user => {});
                g.On("password", "set both ftp and http password to {0}").WithArg <string>("PASSWORD").Do(password => {});
                g.On("ask-password", "prompt for passwords").Do(() => {});
            });

            opts.In("HTTP options", g =>
            {
                g.On("http-user", "set http user to {0}").WithArg <string>("USER").Do(user => {});
                g.On("http-password", "set http password to {0}").WithArg <string>("PASSWORD").Do(password => {});
                g.On("ask-password", "prompt for passwords").Do(() => {});
                g.On("referer", "include `Referer: {0}' header in HTTP request").WithArg <string>("URL").Do(refererUrl => {});
                g.On("header", "insert {0} among the headers sent").WithArg <string>("STRING").Do(header => {});
                g.On("user-agent", 'U', "identify as {0} instead of Wget/VERSION").WithArg <string>("AGENT").Do(userAgent => {});
                g.On("post-data", "use the POST method; send {0} as the data").WithArg <string>("STRING").Do(postData => {});
                g.On("post-file", "use the POST method; send contents of {0}").WithArg <string>("FILE").Do(postDataFile => {});
            });
        }
Beispiel #3
0
        public void WithOptions(OptionParser opts)
        {
            opts.Header = "Search for PATTERN and replace with REPLACE in each FILE or standard input.\n";
            opts.Header += "Example: sed 'hello world' 'goodbye world' menu.h main.c";

            opts.Required.Arg<string>("PATTERN", "{0} is a .NET/Mono Regular Expression string.").Do(pattern => settings.Pattern = pattern);
            opts.Required.Arg<string>("REPLACE", "").Do(replace => settings.Replace = replace);
            opts.Args<string>("FILE", "").Do(settings.Files.AddRange);

            opts.In("Regexp selection and interpretation", g =>
            {
                g.On("ignore-case", 'i', "ignore case distinctions").Do(() => settings.RegexOptions |= RegexOptions.IgnoreCase);
            });
            opts.In("Miscellaneous", g =>
            {
                g.On("no-messages", 's', "suppress error messages").Do(() => settings.SuppressErrorMessages = true);
            });

            opts.Footer = "With no FILE, or when FILE is -, read standard input.\n";
            opts.Footer += "Exit status is 0 on success and 2 if trouble.";
        }
Beispiel #4
0
        public void WithOptions(OptionParser opts)
        {
            opts.Header  = "Search for PATTERN and replace with REPLACE in each FILE or standard input.\n";
            opts.Header += "Example: sed 'hello world' 'goodbye world' menu.h main.c";

            opts.Required.Arg <string>("PATTERN", "{0} is a .NET/Mono Regular Expression string.").Do(pattern => settings.Pattern = pattern);
            opts.Required.Arg <string>("REPLACE", "").Do(replace => settings.Replace = replace);
            opts.Args <string>("FILE", "").Do(settings.Files.AddRange);

            opts.In("Regexp selection and interpretation", g =>
            {
                g.On("ignore-case", 'i', "ignore case distinctions").Do(() => settings.RegexOptions |= RegexOptions.IgnoreCase);
            });
            opts.In("Miscellaneous", g =>
            {
                g.On("no-messages", 's', "suppress error messages").Do(() => settings.SuppressErrorMessages = true);
            });

            opts.Footer  = "With no FILE, or when FILE is -, read standard input.\n";
            opts.Footer += "Exit status is 0 on success and 2 if trouble.";
        }
Beispiel #5
0
        public void WithOptions(OptionParser opts)
        {
            opts.Required.Arg<string>("URL", "").Do(settings.Urls.Add);

            opts.In("Logging and input file", g =>
            {
                g.On("output-file", 'o', "log messages to {0}").WithArg<string>("FILE").Do(filename => settings.Logging.WriteTo = filename);
                g.On("append-output", 'a', "append messages to {0}").WithArg<string>("FILE").Do(filename => settings.Logging.AppendTo = filename);
                g.On("quiet", 'q', "quiet (no output)").Do(() => { settings.Quiet = true;});
                g.On("debug", 'd', "print lots of debugging information").Do(() => settings.Logging.Debug = true);
            });

            opts.In("Download", g => {
                g.On("tries", 't', "set number of retries to {0} (0 - unlimited)").WithArg<int>("NUMBER").Do(retries => {});
                g.On("output-document", 'O', "write documents to {0}").WithArg<string>("FILE").Do(filename => settings.Download.OutputDocument = filename);
                g.On("no-clobber", 'n', "skip downloads that would download to existing files").Do(() => {});
                g.On("continue", 'c', "resume getting a partially-downloaded file").Do(() => {});
                g.On("progress", "select progress gauge {0}")
                    .WithArg<ProgressType>("TYPE")
                    .WithParseErrorMessage("--{0}: Invalid progress type '{1}'.\nValid choices are: None, Bar, Dot")
                    .Do(type => settings.Download.ProgressType = type);
                g.On("timestamping", 'N', "don't re-retrieve files unless newer than local").Do(() => {});
                g.On("server-response", 'S', "print server response").Do(() => {});
                g.On("spider", "don't download anything").Do(() => {});
                g.On("timeout", 'T', "set all timeout values to {0}").WithArg<int>("SECONDS").Do(timeout => {});
                g.On("user", "set both ftp and http user to {0}").WithArg<string>("USER").Do(user => {});
                g.On("password", "set both ftp and http password to {0}").WithArg<string>("PASSWORD").Do(password => {});
                g.On("ask-password", "prompt for passwords").Do(() => {});
            });

            opts.In("HTTP options", g =>
            {
                g.On("http-user", "set http user to {0}").WithArg<string>("USER").Do(user => {});
                g.On("http-password", "set http password to {0}").WithArg<string>("PASSWORD").Do(password => {});
                g.On("ask-password", "prompt for passwords").Do(() => {});
                g.On("referer", "include `Referer: {0}' header in HTTP request").WithArg<string>("URL").Do(refererUrl => {});
                g.On("header", "insert {0} among the headers sent").WithArg<string>("STRING").Do(header => {});
                g.On("user-agent", 'U', "identify as {0} instead of Wget/VERSION").WithArg<string>("AGENT").Do(userAgent => {});
                g.On("post-data", "use the POST method; send {0} as the data").WithArg<string>("STRING").Do(postData => {});
                g.On("post-file", "use the POST method; send contents of {0}").WithArg<string>("FILE").Do(postDataFile => {});
            });
        }
Beispiel #6
0
        public void WithOptions(OptionParser opts)
        {
            opts.Header = "Search for PATTERN in each FILE or standard input.\n";
            opts.Header += "Example: grep -i \"hello world\" menu.h main.c";

            opts.Required.Arg<string>("PATTERN", "{0} is a .NET/Mono Regular Expression string.").Do(pattern => settings.Pattern = pattern);
            opts.Args<string>("FILE", "").Do(settings.Files.AddRange);

            opts.In("Regexp selection and interpretation", g =>
            {
                g.On("ignore-case", 'i', "ignore case distinctions").Do(() => settings.RegexOptions |= RegexOptions.IgnoreCase);
            });
            opts.In("Miscellaneous", g =>
            {
                g.On("no-messages", 's', "suppress error messages").Do(() => settings.SuppressErrorMessages = true);
                g.On("invert-match", 'v', "select non-matching lines").Do(() => settings.InvertMatch = true);
            });
            opts.In("Output control", g => {
                g.On("line-number", 'n', "print line number with output lines").Do(() => settings.Output.LineNumbers = true);
                g.On("with-filename", 'H', "print the filename for each match").Do(() => settings.Output.FileNames = true);
                g.On("no-filename", 'h', "print line number with output lines").Do(() => settings.Output.FileNames = false);
                g.On("files-without-match", 'L', "only print FILE names containing no match").Do(() => settings.Output.OnlyFileNames = OnlyFileNames.NonMatching);
                g.On("files-with-matches", 'l', "only print FILE names containing matches").Do(() => settings.Output.OnlyFileNames = OnlyFileNames.Matching);
            });

            opts.Footer = "With no FILE, or when FILE is -, read standard input.  If less than\n";
            opts.Footer += "two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n";
            opts.Footer += "and 2 if trouble.";
        }