You've already forked linux-packaging-mono
Imported Upstream version 5.20.0.180
Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
parent
0e2d47d1c8
commit
0510252385
@@ -5,6 +5,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Mono.Options;
|
||||
|
||||
@@ -25,6 +26,9 @@ class CommandDemo {
|
||||
new Command ("echo", "Echo arguments to the screen") {
|
||||
Run = ca => Console.WriteLine ("{0}", string.Join (" ", ca)),
|
||||
},
|
||||
new Command ("equinox", "Does something with the equinox?") {
|
||||
Run = ca => Console.WriteLine ("{0}", string.Join (" ", ca)),
|
||||
},
|
||||
new RequiresArgsCommand (),
|
||||
"Commands with spaces are supported:",
|
||||
new Command ("has spaces", "spaces?!") {
|
||||
@@ -35,8 +39,20 @@ class CommandDemo {
|
||||
new Command ("file type", "Does something or other.") {
|
||||
Run = ca => Console.WriteLine ("File type set to: {0}", string.Join (" ", ca)),
|
||||
},
|
||||
new Command ("output", "Sets output location") {
|
||||
Run = ca => Console.WriteLine ("Output set to: {0}", string.Join (" ", ca)),
|
||||
},
|
||||
},
|
||||
};
|
||||
commands.Add (new Command ("completions", "Show CommandSet completions") {
|
||||
Run = ca => {
|
||||
var start = ca.Any() ? string.Join (" ", ca) : "";
|
||||
Console.WriteLine ($"Showing CommandSet completions for prefix '{start}':");
|
||||
foreach (var completion in commands.GetCompletions (start)) {
|
||||
Console.WriteLine ($"\tcompletion: {completion}");
|
||||
}
|
||||
},
|
||||
});
|
||||
commands.Add (commands);
|
||||
return commands.Run (args);
|
||||
}
|
||||
|
||||
@@ -27,3 +27,11 @@ mono Documentation/en/examples/commands.exe help invalid-command
|
||||
mono Documentation/en/examples/commands.exe has spaces
|
||||
|
||||
mono Documentation/en/examples/commands.exe set file type whatever
|
||||
|
||||
mono Documentation/en/examples/commands.exe completions
|
||||
|
||||
mono Documentation/en/examples/commands.exe completions e
|
||||
|
||||
mono Documentation/en/examples/commands.exe completions s
|
||||
|
||||
mono Documentation/en/examples/commands.exe completions s o
|
||||
|
||||
@@ -2,7 +2,6 @@ $ mono commands.exe
|
||||
Use `commands help` for usage.
|
||||
|
||||
$ mono commands.exe --help
|
||||
# HelpCommand.Invoke: arguments=
|
||||
usage: commands COMMAND [OPTIONS]
|
||||
|
||||
Mono.Options.CommandSet sample app.
|
||||
@@ -12,15 +11,17 @@ Global options:
|
||||
|
||||
Available commands:
|
||||
echo Echo arguments to the screen
|
||||
equinox Does something with the equinox?
|
||||
requires-args Class-based Command subclass
|
||||
Commands with spaces are supported:
|
||||
has spaces spaces?!
|
||||
Nested CommandSets are also supported. They're invoked similarly to commands
|
||||
with spaces.
|
||||
set file type Does something or other.
|
||||
set output Sets output location
|
||||
completions Show CommandSet completions
|
||||
|
||||
$ mono commands.exe help
|
||||
# HelpCommand.Invoke: arguments=
|
||||
usage: commands COMMAND [OPTIONS]
|
||||
|
||||
Mono.Options.CommandSet sample app.
|
||||
@@ -30,28 +31,32 @@ Global options:
|
||||
|
||||
Available commands:
|
||||
echo Echo arguments to the screen
|
||||
equinox Does something with the equinox?
|
||||
requires-args Class-based Command subclass
|
||||
Commands with spaces are supported:
|
||||
has spaces spaces?!
|
||||
Nested CommandSets are also supported. They're invoked similarly to commands
|
||||
with spaces.
|
||||
set file type Does something or other.
|
||||
set output Sets output location
|
||||
completions Show CommandSet completions
|
||||
|
||||
$ mono commands.exe help --help
|
||||
# HelpCommand.Invoke: arguments=--help
|
||||
Usage: commands COMMAND [OPTIONS]
|
||||
Use `commands help COMMAND` for help on a specific command.
|
||||
|
||||
Available commands:
|
||||
|
||||
completions Show CommandSet completions
|
||||
echo Echo arguments to the screen
|
||||
equinox Does something with the equinox?
|
||||
has spaces spaces?!
|
||||
requires-args Class-based Command subclass
|
||||
set file type Does something or other.
|
||||
set output Sets output location
|
||||
help Show this message and exit
|
||||
|
||||
$ mono commands.exe help echo
|
||||
# HelpCommand.Invoke: arguments=echo
|
||||
--help
|
||||
|
||||
$ mono commands.exe echo --help
|
||||
@@ -65,7 +70,6 @@ commands: Missing required argument `--name=NAME`.
|
||||
commands: Use `commands help requires-args` for details.
|
||||
|
||||
$ mono commands.exe help requires-args
|
||||
# HelpCommand.Invoke: arguments=requires-args
|
||||
usage: commands requires-args [OPTIONS]
|
||||
|
||||
Class-based Command subclass example.
|
||||
@@ -87,7 +91,6 @@ commands: Unknown command: invalid-command
|
||||
commands: Use `commands help` for usage.
|
||||
|
||||
$ mono commands.exe help invalid-command
|
||||
# HelpCommand.Invoke: arguments=invalid-command
|
||||
commands: Unknown command: invalid-command
|
||||
commands: Use `commands help` for usage.
|
||||
|
||||
@@ -96,3 +99,28 @@ spaces, yo!
|
||||
|
||||
$ mono commands.exe set file type whatever
|
||||
File type set to: whatever
|
||||
|
||||
$ mono commands.exe completions
|
||||
Showing CommandSet completions for prefix '':
|
||||
completion: echo
|
||||
completion: equinox
|
||||
completion: requires-args
|
||||
completion: has spaces
|
||||
completion: completions
|
||||
completion: help
|
||||
completion: set file type
|
||||
completion: set output
|
||||
|
||||
$ mono commands.exe completions e
|
||||
Showing CommandSet completions for prefix 'e':
|
||||
completion: echo
|
||||
completion: equinox
|
||||
|
||||
$ mono commands.exe completions s
|
||||
Showing CommandSet completions for prefix 's':
|
||||
completion: set file type
|
||||
completion: set output
|
||||
|
||||
$ mono commands.exe completions s o
|
||||
Showing CommandSet completions for prefix 's o':
|
||||
completion: set output
|
||||
|
||||
Reference in New Issue
Block a user