cmdenv

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2022 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func CidBaseDefined added in v0.4.19

func CidBaseDefined(req *cmds.Request) bool

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

func CidEncoderFromPath added in v0.4.19

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 EscNonPrint added in v0.8.0

func EscNonPrint(s string) string

EscNonPrint converts non-printable characters and backslash into Go escape sequences. This is done to display all characters in a string, including those that would otherwise not be displayed or have an undesirable effect on the display.

func GetApi

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

GetApi extracts CoreAPI instance from the environment.

func GetCidEncoder added in v0.4.19

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 GetConfigRoot added in v0.4.19

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

GetConfigRoot extracts the config root from the environment

func GetFileArg added in v0.4.19

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

GetFileArg returns the next file from the directory or an error

func GetLowLevelCidEncoder added in v0.4.19

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

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

GetNode extracts the node from the environment.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL