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
e0ba14c0
Commit
e0ba14c0
authored
Nov 13, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmds2: use cmdDetails on level cmds
parent
0eeed7cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
11 deletions
+18
-11
cmd/ipfs2/ipfs.go
cmd/ipfs2/ipfs.go
+2
-0
cmd/ipfs2/main.go
cmd/ipfs2/main.go
+12
-7
core/commands2/update.go
core/commands2/update.go
+4
-4
No files found.
cmd/ipfs2/ipfs.go
View file @
e0ba14c0
...
@@ -78,5 +78,7 @@ var cmdDetailsMap = map[*cmds.Command]cmdDetails{
...
@@ -78,5 +78,7 @@ var cmdDetailsMap = map[*cmds.Command]cmdDetails{
commands
.
DiagCmd
:
cmdDetails
{
cannotRunOnClient
:
true
},
commands
.
DiagCmd
:
cmdDetails
{
cannotRunOnClient
:
true
},
commands
.
VersionCmd
:
cmdDetails
{
doesNotUseRepo
:
true
},
commands
.
VersionCmd
:
cmdDetails
{
doesNotUseRepo
:
true
},
commands
.
UpdateCmd
:
cmdDetails
{
cannotRunOnDaemon
:
true
},
commands
.
UpdateCmd
:
cmdDetails
{
cannotRunOnDaemon
:
true
},
commands
.
UpdateCheckCmd
:
cmdDetails
{},
commands
.
UpdateLogCmd
:
cmdDetails
{},
commands
.
LogCmd
:
cmdDetails
{
cannotRunOnClient
:
true
},
commands
.
LogCmd
:
cmdDetails
{
cannotRunOnClient
:
true
},
}
}
cmd/ipfs2/main.go
View file @
e0ba14c0
...
@@ -267,14 +267,19 @@ func commandShouldRunOnDaemon(req cmds.Request, root *cmds.Command) (bool, error
...
@@ -267,14 +267,19 @@ func commandShouldRunOnDaemon(req cmds.Request, root *cmds.Command) (bool, error
return
false
,
nil
return
false
,
nil
}
}
cmd
,
found
:=
root
.
Subcommands
[
path
[
0
]]
var
details
cmdDetails
if
!
found
{
// find the last command in path that has a cmdDetailsMap entry
return
false
,
fmt
.
Errorf
(
"subcommand %s should be in root"
,
path
[
0
])
cmd
:=
root
}
for
_
,
cmp
:=
range
path
{
var
found
bool
cmd
,
found
=
cmd
.
Subcommands
[
cmp
]
if
!
found
{
return
false
,
fmt
.
Errorf
(
"subcommand %s should be in root"
,
cmp
)
}
d
etails
,
found
:=
cmdDetailsMap
[
cmd
]
if
cmdD
etails
,
found
:=
cmdDetailsMap
[
cmd
]
;
found
{
if
!
found
{
details
=
cmdDetails
details
=
cmdDetails
{}
// defaults
}
}
}
log
.
Debugf
(
"cmd perms for +%v: %s"
,
path
,
details
.
String
())
log
.
Debugf
(
"cmd perms for +%v: %s"
,
path
,
details
.
String
())
...
...
core/commands2/update.go
View file @
e0ba14c0
...
@@ -29,8 +29,8 @@ var UpdateCmd = &cmds.Command{
...
@@ -29,8 +29,8 @@ var UpdateCmd = &cmds.Command{
},
},
Type
:
&
UpdateOutput
{},
Type
:
&
UpdateOutput
{},
Subcommands
:
map
[
string
]
*
cmds
.
Command
{
Subcommands
:
map
[
string
]
*
cmds
.
Command
{
"check"
:
u
pdateCheckCmd
,
"check"
:
U
pdateCheckCmd
,
"log"
:
u
pdateLogCmd
,
"log"
:
U
pdateLogCmd
,
},
},
Marshalers
:
cmds
.
MarshalerMap
{
Marshalers
:
cmds
.
MarshalerMap
{
cmds
.
Text
:
func
(
res
cmds
.
Response
)
([]
byte
,
error
)
{
cmds
.
Text
:
func
(
res
cmds
.
Response
)
([]
byte
,
error
)
{
...
@@ -47,7 +47,7 @@ var UpdateCmd = &cmds.Command{
...
@@ -47,7 +47,7 @@ var UpdateCmd = &cmds.Command{
},
},
}
}
var
u
pdateCheckCmd
=
&
cmds
.
Command
{
var
U
pdateCheckCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"Checks if updates are available"
,
Tagline
:
"Checks if updates are available"
,
ShortDescription
:
`
ShortDescription
:
`
...
@@ -80,7 +80,7 @@ Nothing will be downloaded or installed.
...
@@ -80,7 +80,7 @@ Nothing will be downloaded or installed.
},
},
}
}
var
u
pdateLogCmd
=
&
cmds
.
Command
{
var
U
pdateLogCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"List the changelog for the latest versions of IPFS"
,
Tagline
:
"List the changelog for the latest versions of IPFS"
,
ShortDescription
:
"This command is not yet implemented."
,
ShortDescription
:
"This command is not yet implemented."
,
...
...
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