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
afc7b6f4
Commit
afc7b6f4
authored
Nov 18, 2014
by
Matt Bell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/commands: Added a 'pin ls' command
parent
90e5c7ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
core/commands/pin.go
core/commands/pin.go
+22
-0
No files found.
core/commands/pin.go
View file @
afc7b6f4
...
...
@@ -6,6 +6,7 @@ import (
cmds
"github.com/jbenet/go-ipfs/commands"
"github.com/jbenet/go-ipfs/core"
"github.com/jbenet/go-ipfs/merkledag"
u
"github.com/jbenet/go-ipfs/util"
)
var
pinCmd
=
&
cmds
.
Command
{
...
...
@@ -16,6 +17,7 @@ var pinCmd = &cmds.Command{
Subcommands
:
map
[
string
]
*
cmds
.
Command
{
"add"
:
addPinCmd
,
"rm"
:
rmPinCmd
,
"ls"
:
listPinCmd
,
},
}
...
...
@@ -99,6 +101,26 @@ collected if needed.
},
}
var
listPinCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"List objects pinned to local storage"
,
ShortDescription
:
`
Returns a list of hashes of objects being pinned. Objects that are indirectly
or recursively pinned are not included in the list.
`
,
},
Run
:
func
(
req
cmds
.
Request
)
(
interface
{},
error
)
{
n
,
err
:=
req
.
Context
()
.
GetNode
()
if
err
!=
nil
{
return
nil
,
err
}
return
n
.
Pinning
.
Set
()
.
GetKeys
(),
nil
},
Type
:
[]
u
.
Key
{},
}
func
pin
(
n
*
core
.
IpfsNode
,
paths
[]
string
,
recursive
bool
)
([]
*
merkledag
.
Node
,
error
)
{
dagnodes
:=
make
([]
*
merkledag
.
Node
,
0
)
...
...
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