cli

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

cli provides the commands for a simple CLI.

Index

Constants

View Source
const DefaultBaseURL = "http://localhost:8080"

DefaultBaseURL is the default base URL for all services.

Variables

View Source
var SessionKey sessionKeyType

SessionKey is the key for the session in the context.

Functions

func InjectSession added in v0.2.1

func InjectSession(ctx context.Context, cmd *cli.Command) (newCtx context.Context, err error)

InjectSession is a pre-hook that injects the session into the context.

Types

type Session

type Session struct {
	PortfolioClient  portfoliov1connect.PortfolioServiceClient  `json:"-"`
	SecuritiesClient portfoliov1connect.SecuritiesServiceClient `json:"-"`
	// contains filtered or unexported fields
}

Session holds all necessary information about the current CLI session.

func ContinueSession added in v0.2.0

func ContinueSession() (s *Session, err error)

ContinueSession continues a session from a file.

func FromContext added in v0.2.1

func FromContext(ctx context.Context) (s *Session)

FromContext extracts the session from the context.

func NewSession added in v0.1.0

func NewSession(opts *SessionOptions) (s *Session)

NewSession creates a new session.

func (*Session) Save added in v0.2.0

func (s *Session) Save() (err error)

Save saves the session to a file.

type SessionOptions added in v0.2.0

type SessionOptions struct {
	OAuth2Config *oauth2.Config
	HttpClient   *http.Client `json:"-"`
	Token        *oauth2.Token
	BaseURL      string
}

SessionOptions holds all options to configure a Session.

func (*SessionOptions) MergeWith added in v0.2.0

func (opts *SessionOptions) MergeWith(other *SessionOptions) *SessionOptions

MergeWith can be used to merge two SessionOptions structs.

Directories

Path Synopsis
package commands contains commands that can be executed by the CLI.
package commands contains commands that can be executed by the CLI.

Jump to

Keyboard shortcuts

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