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
Commits
8ee3e996
Commit
8ee3e996
authored
Nov 10, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Nov 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/commands2: Use Option constructors in commands
parent
38b31c65
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
34 deletions
+16
-34
cmd/ipfs2/init.go
cmd/ipfs2/init.go
+4
-8
core/commands2/add.go
core/commands2/add.go
+1
-1
core/commands2/mount_unix.go
core/commands2/mount_unix.go
+2
-7
core/commands2/pin.go
core/commands2/pin.go
+2
-4
core/commands2/refs.go
core/commands2/refs.go
+2
-4
core/commands2/root.go
core/commands2/root.go
+4
-8
core/commands2/version.go
core/commands2/version.go
+1
-2
No files found.
cmd/ipfs2/init.go
View file @
8ee3e996
...
...
@@ -20,14 +20,10 @@ var initCmd = &cmds.Command{
`
,
Options
:
[]
cmds
.
Option
{
cmds
.
Option
{[]
string
{
"bits"
,
"b"
},
cmds
.
Int
,
"Number of bits to use in the generated RSA private key (defaults to 4096)"
},
cmds
.
Option
{[]
string
{
"passphrase"
,
"p"
},
cmds
.
String
,
"Passphrase for encrypting the private key"
},
cmds
.
Option
{[]
string
{
"force"
,
"f"
},
cmds
.
Bool
,
"Overwrite existing config (if it exists)"
},
cmds
.
Option
{[]
string
{
"datastore"
,
"d"
},
cmds
.
String
,
"Location for the IPFS data store"
},
cmds
.
IntOption
(
"bits"
,
"b"
,
"Number of bits to use in the generated RSA private key (defaults to 4096)"
),
cmds
.
StringOption
(
"passphrase"
,
"p"
,
"Passphrase for encrypting the private key"
),
cmds
.
BoolOption
(
"force"
,
"f"
,
"Overwrite existing config (if it exists)"
),
cmds
.
StringOption
(
"datastore"
,
"d"
,
"Location for the IPFS data store"
),
},
Run
:
func
(
req
cmds
.
Request
)
(
interface
{},
error
)
{
...
...
core/commands2/add.go
View file @
8ee3e996
...
...
@@ -23,7 +23,7 @@ type AddOutput struct {
var
addCmd
=
&
cmds
.
Command
{
Options
:
[]
cmds
.
Option
{
cmds
.
Option
{[]
string
{
"recursive"
,
"r"
},
cmds
.
Bool
,
"Must be specified when adding directories"
}
,
cmds
.
Bool
Option
(
"recursive"
,
"r"
,
"Must be specified when adding directories"
)
,
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
Argument
{
"file"
,
cmds
.
ArgFile
,
true
,
true
,
"The path to a file to be added to IPFS"
},
...
...
core/commands2/mount_unix.go
View file @
8ee3e996
...
...
@@ -24,16 +24,11 @@ not be listable, as it is virtual. Accessing known paths directly.
`
,
Options
:
[]
cmds
.
Option
{
// TODO text: specify a mountpoint for ipfs
// TODO longform
cmds
.
Option
{[]
string
{
"f"
},
cmds
.
String
,
"The path where IPFS should be mounted
\n
(default is '/ipfs')"
},
cmds
.
StringOption
(
"f"
,
"The path where IPFS should be mounted
\n
(default is '/ipfs')"
),
// TODO text: specify a mountpoint for ipns
// TODO longform
cmds
.
Option
{[]
string
{
"n"
},
cmds
.
String
,
"The path where IPNS should be mounted
\n
(default is '/ipns')"
},
cmds
.
StringOption
(
"n"
,
"The path where IPNS should be mounted
\n
(default is '/ipns')"
),
},
Run
:
func
(
req
cmds
.
Request
)
(
interface
{},
error
)
{
ctx
:=
req
.
Context
()
...
...
core/commands2/pin.go
View file @
8ee3e996
...
...
@@ -29,8 +29,7 @@ on disk.
"Path to object(s) to be pinned"
},
},
Options
:
[]
cmds
.
Option
{
cmds
.
Option
{[]
string
{
"recursive"
,
"r"
},
cmds
.
Bool
,
"Recursively pin the object linked to by the specified object(s)"
},
cmds
.
BoolOption
(
"recursive"
,
"r"
,
"Recursively pin the object linked to by the specified object(s)"
),
},
Run
:
func
(
req
cmds
.
Request
)
(
interface
{},
error
)
{
n
:=
req
.
Context
()
.
Node
...
...
@@ -65,8 +64,7 @@ collected if needed.
"Path to object(s) to be unpinned"
},
},
Options
:
[]
cmds
.
Option
{
cmds
.
Option
{[]
string
{
"recursive"
,
"r"
},
cmds
.
Bool
,
"Recursively unpin the object linked to by the specified object(s)"
},
cmds
.
BoolOption
(
"recursive"
,
"r"
,
"Recursively unpin the object linked to by the specified object(s)"
),
},
Run
:
func
(
req
cmds
.
Request
)
(
interface
{},
error
)
{
n
:=
req
.
Context
()
.
Node
...
...
core/commands2/refs.go
View file @
8ee3e996
...
...
@@ -29,10 +29,8 @@ Note: list all refs recursively with -r.`,
"Path to the object(s) to list refs from"
},
},
Options
:
[]
cmds
.
Option
{
cmds
.
Option
{[]
string
{
"unique"
,
"u"
},
cmds
.
Bool
,
"Omit duplicate refs from output"
},
cmds
.
Option
{[]
string
{
"recursive"
,
"r"
},
cmds
.
Bool
,
"Recursively list links of child nodes"
},
cmds
.
BoolOption
(
"unique"
,
"u"
,
"Omit duplicate refs from output"
),
cmds
.
BoolOption
(
"recursive"
,
"r"
,
"Recursively list links of child nodes"
),
},
Run
:
func
(
req
cmds
.
Request
)
(
interface
{},
error
)
{
n
:=
req
.
Context
()
.
Node
...
...
core/commands2/root.go
View file @
8ee3e996
...
...
@@ -44,14 +44,10 @@ Use "ipfs <command> --help" for more information about a command.
`
,
Options
:
[]
cmds
.
Option
{
cmds
.
Option
{[]
string
{
"config"
,
"c"
},
cmds
.
String
,
"Path to the configuration file to use"
},
cmds
.
Option
{[]
string
{
"debug"
,
"D"
},
cmds
.
Bool
,
"Operate in debug mode"
},
cmds
.
Option
{[]
string
{
"help"
,
"h"
},
cmds
.
Bool
,
"Show the command help text"
},
cmds
.
Option
{[]
string
{
"local"
,
"L"
},
cmds
.
Bool
,
"Run the command locally, instead of using the daemon"
},
cmds
.
StringOption
(
"config"
,
"c"
,
"Path to the configuration file to use"
),
cmds
.
BoolOption
(
"debug"
,
"D"
,
"Operate in debug mode"
),
cmds
.
BoolOption
(
"help"
,
"h"
,
"Show the command help text"
),
cmds
.
BoolOption
(
"local"
,
"L"
,
"Run the command locally, instead of using the daemon"
),
},
}
...
...
core/commands2/version.go
View file @
8ee3e996
...
...
@@ -17,8 +17,7 @@ var versionCmd = &cmds.Command{
`
,
Options
:
[]
cmds
.
Option
{
cmds
.
Option
{[]
string
{
"number"
,
"n"
},
cmds
.
Bool
,
"Only output the version number"
},
cmds
.
BoolOption
(
"number"
,
"n"
,
"Only output the version number"
),
},
Run
:
func
(
req
cmds
.
Request
)
(
interface
{},
error
)
{
return
&
VersionOutput
{
...
...
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