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
fd8b1930
Commit
fd8b1930
authored
Nov 12, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Nov 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/ipfs2: Copy subcommands from core/commands2 root into cmd/ipfs2 root
parent
53e875e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
cmd/ipfs2/ipfs.go
cmd/ipfs2/ipfs.go
+19
-5
cmd/ipfs2/main.go
cmd/ipfs2/main.go
+1
-1
No files found.
cmd/ipfs2/ipfs.go
View file @
fd8b1930
...
...
@@ -8,9 +8,23 @@ import (
var
Root
=
&
cmds
.
Command
{
Options
:
commands
.
Root
.
Options
,
Help
:
commands
.
Root
.
Help
,
Subcommands
:
map
[
string
]
*
cmds
.
Command
{
"daemon"
:
daemonCmd
,
// TODO name
"init"
:
initCmd
,
// TODO name
"tour"
:
cmdTour
,
},
}
var
rootSubcommands
=
map
[
string
]
*
cmds
.
Command
{
"daemon"
:
daemonCmd
,
// TODO name
"init"
:
initCmd
,
// TODO name
"tour"
:
cmdTour
,
}
func
init
()
{
// setting here instead of in literal to prevent initialization loop
// (some commands make references to Root)
Root
.
Subcommands
=
rootSubcommands
// copy all subcommands from commands.Root into this root (if they aren't already present)
for
k
,
v
:=
range
commands
.
Root
.
Subcommands
{
if
_
,
found
:=
Root
.
Subcommands
[
k
];
!
found
{
Root
.
Subcommands
[
k
]
=
v
}
}
}
cmd/ipfs2/main.go
View file @
fd8b1930
...
...
@@ -94,7 +94,7 @@ func run() error {
}
func
createRequest
(
args
[]
string
)
(
cmds
.
Request
,
*
cmds
.
Command
,
error
)
{
req
,
root
,
cmd
,
path
,
err
:=
cmdsCli
.
Parse
(
args
,
Root
,
commands
.
Root
)
req
,
root
,
cmd
,
path
,
err
:=
cmdsCli
.
Parse
(
args
,
Root
)
// handle parse error (which means the commandline input was wrong,
// e.g. incorrect number of args, or nonexistent subcommand)
...
...
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