cmdutil

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: Apache-2.0, MIT Imports: 24 Imported by: 0

Documentation

Overview

Package cmdutil provides utility functions specifically for the Guppy CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentPath

func ContentPath(pathStr string) (cid.Cid, string, error)

ContentPath parses a content path string and returns the CID and subpath. A content path can take several forms:

  • /ipfs/<cid>[/<subpath>]
  • ipfs://<cid>[/<subpath>]
  • <cid>[/<subpath>]

The subpath is returned with no leading `/`. If no subpath is specified in the input, an empty string is returned for it.

func MustGetClient

func MustGetClient(storePath string, options ...client.Option) *client.Client

MustGetClient creates a new client suitable for the CLI, using stored data, if any. If proofs are provided, they will be added to the client, but the client will not save changes to disk to avoid storing them.

func MustGetConnection

func MustGetConnection() uclient.Connection

func MustGetIndexClient

func MustGetIndexClient() (*indexclient.Client, ucan.Principal)

func MustGetProof

func MustGetProof(path string) delegation.Delegation

func MustGetReceiptsURL

func MustGetReceiptsURL() *url.URL

func ParseSize

func ParseSize(s string) (uint64, error)

ParseSize parses a data size string with optional suffix (B, K, M, G). Accepts formats like: "1024", "512B", "100K", "50M", "2G". Digits with no suffix are interpreted as bytes. Returns the size in bytes.

Types

type HandledCliError

type HandledCliError struct {
	// contains filtered or unexported fields
}

HandledCliError is an error which has already been presented to the user. If a HandledCliError is returned from a command, the process should exit with a non-zero exit code, but no further error message should be printed.

func NewHandledCliError

func NewHandledCliError(err error) HandledCliError

func (HandledCliError) Unwrap

func (e HandledCliError) Unwrap() error

Jump to

Keyboard shortcuts

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