go-ipfs: github.com/ipfs/go-ipfs/core/commands/cmdenv Index | Files

package cmdenv

import "github.com/ipfs/go-ipfs/core/commands/cmdenv"


Package Files

cidbase.go env.go file.go


var OptionCidBase = cmds.StringOption("cid-base", "Multibase encoding used for version 1 CIDs in output.")
var OptionUpgradeCidV0InOutput = cmds.BoolOption("upgrade-cidv0-in-output", "Upgrade version 0 to version 1 CIDs in output.")

func CidBaseDefined Uses

func CidBaseDefined(req *cmds.Request) bool

CidBaseDefined returns true if the `cid-base` option is specified on the command line

func CidEncoderFromPath Uses

func CidEncoderFromPath(p string) (cidenc.Encoder, error)

CidEncoderFromPath creates a new encoder that is influenced from the encoded Cid in a Path. For CidV0 the multibase from the base encoder is used and automatic upgrades are disabled. For CidV1 the multibase from the CID is used and upgrades are enabled.

This logic is intentionally fuzzy and will match anything of the form `CidLike`, `CidLike/...`, or `/namespace/CidLike/...`.

For example:

* Qm... * Qm.../... * /ipfs/Qm... * /ipns/bafybeiahnxfi7fpmr5wtxs2imx4abnyn7fdxeiox7xxjem6zuiioqkh6zi/... * /bzz/bafybeiahnxfi7fpmr5wtxs2imx4abnyn7fdxeiox7xxjem6zuiioqkh6zi/...

func GetApi Uses

func GetApi(env cmds.Environment, req *cmds.Request) (coreiface.CoreAPI, error)

GetApi extracts CoreAPI instance from the environment.

func GetCidEncoder Uses

func GetCidEncoder(req *cmds.Request) (cidenc.Encoder, error)

GetCidEncoder processes the `cid-base` and `output-cidv1` options and returns a encoder to use based on those parameters.

func GetConfig Uses

func GetConfig(env cmds.Environment) (*config.Config, error)

GetConfig extracts the config from the environment.

func GetConfigRoot Uses

func GetConfigRoot(env cmds.Environment) (string, error)

GetConfigRoot extracts the config root from the environment

func GetFileArg Uses

func GetFileArg(it files.DirIterator) (files.File, error)

GetFileArg returns the next file from the directory or an error

func GetLowLevelCidEncoder Uses

func GetLowLevelCidEncoder(req *cmds.Request) (cidenc.Encoder, error)

GetLowLevelCidEncoder is like GetCidEncoder but meant to be used by lower level commands. It differs from GetCidEncoder in that CIDv0 are not, by default, auto-upgraded to CIDv1.

func GetNode Uses

func GetNode(env interface{}) (*core.IpfsNode, error)

GetNode extracts the node from the environment.

Package cmdenv imports 13 packages (graph) and is imported by 35 packages. Updated 2019-05-13. Refresh now. Tools for package owners.