Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-cmds
Commits
59bd805d
Commit
59bd805d
authored
Nov 07, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Nov 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands: Added 'Description' fields to Command, Argument, Option
parent
9f671852
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
argument.go
argument.go
+5
-4
command.go
command.go
+2
-0
option.go
option.go
+5
-3
No files found.
argument.go
View file @
59bd805d
...
...
@@ -8,8 +8,9 @@ const (
)
type
Argument
struct
{
Name
string
Type
ArgumentType
Required
bool
Variadic
bool
Name
string
Type
ArgumentType
Required
bool
Variadic
bool
Description
string
}
command.go
View file @
59bd805d
...
...
@@ -28,7 +28,9 @@ type Marshaller func(Response) ([]byte, error)
// Command is a runnable command, with input arguments and options (flags).
// It can also have Subcommands, to group units of work into sets.
type
Command
struct
{
Description
string
Help
string
Options
[]
Option
Arguments
[]
Argument
Run
Function
...
...
option.go
View file @
59bd805d
...
...
@@ -14,8 +14,9 @@ const (
// Option is used to specify a field that will be provided by a consumer
type
Option
struct
{
Names
[]
string
// a list of unique names to
Type
reflect
.
Kind
// value must be this type
Names
[]
string
// a list of unique names to
Type
reflect
.
Kind
// value must be this type
Description
string
// a short string to describe this option
// TODO: add more features(?):
//Default interface{} // the default value (ignored if `Required` is true)
...
...
@@ -30,7 +31,8 @@ const (
// options that are used by this package
var
globalOptions
=
[]
Option
{
Option
{[]
string
{
EncShort
,
EncLong
},
String
},
Option
{[]
string
{
EncShort
,
EncLong
},
String
,
"The encoding type the output should be encoded with (json, xml, or text)"
},
}
// the above array of Options, wrapped in a Command
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment