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-unixfs
Commits
351ed958
Commit
351ed958
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
538dac15
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
commands/argument.go
commands/argument.go
+5
-4
commands/command.go
commands/command.go
+2
-0
commands/option.go
commands/option.go
+5
-3
No files found.
commands/argument.go
View file @
351ed958
...
@@ -12,4 +12,5 @@ type Argument struct {
...
@@ -12,4 +12,5 @@ type Argument struct {
Type
ArgumentType
Type
ArgumentType
Required
bool
Required
bool
Variadic
bool
Variadic
bool
Description
string
}
}
commands/command.go
View file @
351ed958
...
@@ -28,7 +28,9 @@ type Marshaller func(Response) ([]byte, error)
...
@@ -28,7 +28,9 @@ type Marshaller func(Response) ([]byte, error)
// Command is a runnable command, with input arguments and options (flags).
// Command is a runnable command, with input arguments and options (flags).
// It can also have Subcommands, to group units of work into sets.
// It can also have Subcommands, to group units of work into sets.
type
Command
struct
{
type
Command
struct
{
Description
string
Help
string
Help
string
Options
[]
Option
Options
[]
Option
Arguments
[]
Argument
Arguments
[]
Argument
Run
Function
Run
Function
...
...
commands/option.go
View file @
351ed958
...
@@ -16,6 +16,7 @@ const (
...
@@ -16,6 +16,7 @@ const (
type
Option
struct
{
type
Option
struct
{
Names
[]
string
// a list of unique names to
Names
[]
string
// a list of unique names to
Type
reflect
.
Kind
// value must be this type
Type
reflect
.
Kind
// value must be this type
Description
string
// a short string to describe this option
// TODO: add more features(?):
// TODO: add more features(?):
//Default interface{} // the default value (ignored if `Required` is true)
//Default interface{} // the default value (ignored if `Required` is true)
...
@@ -30,7 +31,8 @@ const (
...
@@ -30,7 +31,8 @@ const (
// options that are used by this package
// options that are used by this package
var
globalOptions
=
[]
Option
{
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
// 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