lib

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const CLICurrentVersionURL = "https://raw.githubusercontent.com/Files-com/files-cli/master/_VERSION"

Variables

View Source
var CheckVersionEvery = time.Hour * 48
View Source
var PagerCommands = []string{"less", "more"}
View Source
var PagerEnvVariables = []string{"PAGER"}
View Source
var SessionExpiry = time.Hour * 6

Functions

func ByteCountSI added in v1.1.1586

func ByteCountSI(b int64) string

func ByteCountSIFloat64 added in v1.1.1586

func ByteCountSIFloat64(b float64) string

func CSVMarshal added in v1.1.1586

func CSVMarshal(result interface{}, fields string, out io.Writer) error

func CSVMarshalIter added in v1.1.1586

func CSVMarshalIter(it Iter, fields string, skip FilterIter, out io.Writer) error

func ClientError added in v1.0.215

func ClientError(ctx context.Context, profile *Profiles, err error, out ...io.Writer)

func CreateSession added in v1.0.170

func CreateSession(paramsSessionCreate files_sdk.SessionCreateParams, profile *Profiles) error

func ErrorWithOriginalResponse added in v1.4.0

func ErrorWithOriginalResponse(err error, logger retryablehttp.Logger) (interface{}, error)

func FetchLatestVersionNumber added in v1.6.0

func FetchLatestVersionNumber(config files_sdk.Config, parentCtx context.Context) func() (version.Version, bool)

func Format added in v1.1.1586

func Format(ctx context.Context, result interface{}, format string, fields string, usePager bool, out ...io.Writer) error

func FormatIter added in v1.1.1586

func FormatIter(ctx context.Context, it Iter, format string, fields string, usePager bool, filter FilterIter, out ...io.Writer) error

func HandleResponse added in v1.4.0

func HandleResponse(ctx context.Context, profile *Profiles, i interface{}, errIn error, format string, fields string, usePager bool, stdout io.Writer, stderr io.Writer, logger retryablehttp.Logger)

func Includes added in v1.3.64

func Includes(item string, includes []string) bool

func InstalledViaBrew added in v1.6.0

func InstalledViaBrew() bool

func JsonMarshal

func JsonMarshal(i interface{}, fields string, usePager bool, out ...io.Writer) error

func JsonMarshalIter

func JsonMarshalIter(parentCtx context.Context, it Iter, fields string, filter FilterIter, usePager bool, out io.Writer) error

func OnlyFields

func OnlyFields(commaFields string, structure interface{}) (map[string]interface{}, []string, error)

func PromptUserWithPretext added in v1.3.31

func PromptUserWithPretext(display string, pretext string, profile *Profiles) (string, error)

func SessionUnauthorizedError added in v1.0.170

func SessionUnauthorizedError(paramsSessionCreate files_sdk.SessionCreateParams, err error, config *Profiles) (files_sdk.SessionCreateParams, error)

func SmsResponse added in v1.3.31

func SmsResponse(paramsSessionCreate files_sdk.SessionCreateParams, out io.Writer) (files_sdk.SessionCreateParams, error)

func TableMarshal added in v1.1.1586

func TableMarshal(style string, result interface{}, fields string, usePager bool, out io.Writer) error

func TableMarshalIter added in v1.1.1586

func TableMarshalIter(parentCtx context.Context, style string, it Iter, fields string, usePager bool, out io.Writer, filter FilterIter) error

func TimeVar added in v1.1.1677

func TimeVar(f *pflag.FlagSet, p *time.Time, name string)

func TotpResponse added in v1.3.31

func TotpResponse(paramsSessionCreate files_sdk.SessionCreateParams, out io.Writer) (files_sdk.SessionCreateParams, error)

func YubiResponse added in v1.3.31

func YubiResponse(paramsSessionCreate files_sdk.SessionCreateParams, responseError files_sdk.ResponseError, out io.Writer) (files_sdk.SessionCreateParams, error)

Types

type FilterIter added in v1.3.0

type FilterIter func(interface{}) bool

type Iter

type Iter interface {
	Next() bool
	Current() interface{}
	Err() error
}

type IterPaging added in v1.3.10

type IterPaging interface {
	Iter
	EOFPage() bool
	NextPage() bool
	GetPage() bool
}

type Overrides added in v1.3.31

type Overrides struct {
	Out     io.Writer
	In      io.Reader
	Timeout time.Duration
}

func (Overrides) Init added in v1.3.31

func (o Overrides) Init() Overrides

type Pager added in v1.5.0

type Pager struct {
	DefaultOut io.Writer
	io.Writer
	UsePager bool
	// contains filtered or unexported fields
}

func (*Pager) Canceled added in v1.5.0

func (p *Pager) Canceled(ctx context.Context) bool

func (Pager) Init added in v1.5.0

func (p Pager) Init(previewInput interface{}, defaultOut io.Writer) (*Pager, error)

func (*Pager) Start added in v1.5.0

func (p *Pager) Start(cancel context.CancelFunc)

func (*Pager) Wait added in v1.5.0

func (p *Pager) Wait()

type PretextInputModel added in v1.3.31

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

func (PretextInputModel) Init added in v1.3.31

func (p PretextInputModel) Init() tea.Cmd

func (PretextInputModel) Update added in v1.3.31

func (p PretextInputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (PretextInputModel) View added in v1.3.31

func (p PretextInputModel) View() string

type Profile added in v1.6.5

type Profile struct {
	SessionId             string    `json:"session_id"`
	SessionExpiry         time.Time `json:"session_expiry"`
	LastValidVersionCheck time.Time `json:"last_valid_version_check"`
	Subdomain             string    `json:"subdomain"`
	Username              string    `json:"username"`
	APIKey                string    `json:"api_key"`
	Endpoint              string    `json:"endpoint,omitempty"`

	files_sdk.Environment `json:"environment"`
	// contains filtered or unexported fields
}

type Profiles added in v1.6.5

type Profiles struct {
	Profiles              map[string]*Profile `json:"profiles"`
	*files_sdk.Config     `json:"-"`
	Overrides             `json:"-"`
	Profile               string `json:"-"`
	files_sdk.Environment `json:"-"`
	ConfigDir             string `json:"-"`
}

func (*Profiles) CheckVersion added in v1.6.5

func (p *Profiles) CheckVersion(versionString string, fetchLatestVersion func() (version.Version, bool), installedViaBrew bool, writer io.Writer)

func (*Profiles) Current added in v1.6.5

func (p *Profiles) Current() *Profile

func (*Profiles) Init added in v1.6.5

func (p *Profiles) Init() *Profiles

func (*Profiles) Load added in v1.6.5

func (p *Profiles) Load(config *files_sdk.Config, profile string) error

func (*Profiles) Reset added in v1.6.5

func (p *Profiles) Reset() error

func (*Profiles) ResetWith added in v1.6.5

func (p *Profiles) ResetWith(reset ResetConfig) error

func (*Profiles) Save added in v1.6.5

func (p *Profiles) Save() error

func (*Profiles) SessionExpired added in v1.6.5

func (p *Profiles) SessionExpired() bool

func (*Profiles) SetOnConfig added in v1.6.5

func (p *Profiles) SetOnConfig()

func (*Profiles) ValidSession added in v1.6.5

func (p *Profiles) ValidSession() bool

type ResetConfig added in v1.0.215

type ResetConfig struct {
	Subdomain    bool
	Username     bool
	APIKey       bool
	Endpoint     bool
	Session      bool
	VersionCheck bool
}

type SliceIter added in v1.3.70

type SliceIter struct {
	Items []interface{}
	// contains filtered or unexported fields
}

func (*SliceIter) Current added in v1.3.70

func (s *SliceIter) Current() interface{}

func (*SliceIter) Err added in v1.3.70

func (s *SliceIter) Err() error

func (*SliceIter) Next added in v1.3.70

func (s *SliceIter) Next() bool

type Spinner added in v1.5.0

type Spinner struct {
	*yacspin.Spinner
	io.Writer
}

func (*Spinner) Start added in v1.5.0

func (s *Spinner) Start() error

func (*Spinner) Stop added in v1.5.0

func (s *Spinner) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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