1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-10-16 19:24:02 +08:00

Move files.go out of its own directory.

It is a single file so putting it in its own package is a bit of an
overkill.

License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
This commit is contained in:
Kevin Atkinson
2018-02-01 15:51:02 -05:00
committed by Michael Muré
parent cac995e704
commit eeb15db140
3 changed files with 4 additions and 48 deletions

View File

@ -31,7 +31,7 @@ import (
ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format"
)
var log = logging.Logger("cmds/files")
var flog = logging.Logger("cmds/files")
var FilesCmd = &cmds.Command{
Helptext: cmdkit.HelpText{
@ -768,7 +768,7 @@ stat' on the file or any of its ancestors.
_, err = wfd.Seek(int64(offset), io.SeekStart)
if err != nil {
log.Error("seekfail: ", err)
flog.Error("seekfail: ", err)
res.SetError(err, cmdkit.ErrNormal)
return
}
@ -1112,7 +1112,7 @@ func getFileHandle(r *mfs.Root, path string, create bool, prefix *cid.Prefix) (*
dirname, fname := gopath.Split(path)
pdiri, err := mfs.Lookup(r, dirname)
if err != nil {
log.Error("lookupfail ", dirname)
flog.Error("lookupfail ", dirname)
return nil, err
}
pdir, ok := pdiri.(*mfs.Directory)
@ -1161,17 +1161,3 @@ func checkPath(p string) (string, error) {
}
return cleaned, nil
}
// copy+pasted from ../commands.go
func unwrapOutput(i interface{}) (interface{}, error) {
var (
ch <-chan interface{}
ok bool
)
if ch, ok = i.(<-chan interface{}); !ok {
return nil, e.TypeErr(ch, i)
}
return <-ch, nil
}

View File

@ -1,29 +0,0 @@
package commands
import (
"fmt"
"github.com/ipfs/go-ipfs/commands"
"github.com/ipfs/go-ipfs/core"
"github.com/ipfs/go-ipfs/repo/config"
)
// GetNode extracts the node from the environment.
func GetNode(env interface{}) (*core.IpfsNode, error) {
ctx, ok := env.(*commands.Context)
if !ok {
return nil, fmt.Errorf("expected env to be of type %T, got %T", ctx, env)
}
return ctx.GetNode()
}
// GetConfig extracts the config from the environment.
func GetConfig(env interface{}) (*config.Config, error) {
ctx, ok := env.(*commands.Context)
if !ok {
return nil, fmt.Errorf("expected env to be of type %T, got %T", ctx, env)
}
return ctx.GetConfig()
}

View File

@ -7,7 +7,6 @@ import (
oldcmds "github.com/ipfs/go-ipfs/commands"
dag "github.com/ipfs/go-ipfs/core/commands/dag"
e "github.com/ipfs/go-ipfs/core/commands/e"
files "github.com/ipfs/go-ipfs/core/commands/files"
ocmd "github.com/ipfs/go-ipfs/core/commands/object"
unixfs "github.com/ipfs/go-ipfs/core/commands/unixfs"
@ -109,7 +108,7 @@ var rootSubcommands = map[string]*cmds.Command{
"block": BlockCmd,
"cat": CatCmd,
"commands": CommandsDaemonCmd,
"files": files.FilesCmd,
"files": FilesCmd,
"filestore": FileStoreCmd,
"get": GetCmd,
"pubsub": PubsubCmd,