Documentation
¶
Overview ¶
Package cmd implements the CLI application to manage a portfolio.
Index ¶
- Constants
- Variables
- func DecimalVar(f *decimal.Decimal, def string) decimalVar
- func DecodeLedger(query string) (*portfolio.Ledger, error)
- func DecodeLedgers(query string) ([]*portfolio.Ledger, error)
- func EncodeTransaction(ledger *portfolio.Ledger, tx portfolio.Transaction) (portfolio.Transaction, error)
- func PortfolioPath() string
- func QuantityVar(f *portfolio.Quantity, def string) quantityVar
- func Register(c *subcommands.Commander)
- func RegisterFetcher(protocol string, f Fetcher)
- func RunExtension(subcommand string, args []string) (bool, int)
- type AssistCmd
- type Fetcher
Constants ¶
const ( EnvPortfolioPath = "PORTFOLIO_PATH" EnvDefaultCurrency = "PCS_DEFAULT_CURRENCY" EnvVerbose = "PCS_VERBOSE" )
Variables ¶
var (
Verbose = flag.Bool("v", false, "enable verbose logging")
)
Functions ¶
func DecimalVar ¶
func DecodeLedger ¶
DecodeLedger decodes the ledger from the application's default ledger file. If the file does not exist, it returns a new empty ledger.
func DecodeLedgers ¶
DecodeLedgers decodes all ledgers from the portfolio path.
func EncodeTransaction ¶
func EncodeTransaction(ledger *portfolio.Ledger, tx portfolio.Transaction) (portfolio.Transaction, error)
EncodeTransaction validates a transaction against the market data and existing ledger, then appends it to the ledger file.
func PortfolioPath ¶
func PortfolioPath() string
PortfolioPath resolves the path to the portfolio directory. It follows this order of precedence: 1. --portfolio flag 2. PORTFOLIO_PATH environment variable 3. Current working directory (".")
func QuantityVar ¶
func Register ¶
func Register(c *subcommands.Commander)
Register registers all the application's subcommands with the provided Commander. A main package will call Register() to set up the CLI.
func RegisterFetcher ¶
RegisterFetcher registers a fetcher for a specific protocol.
Types ¶
type AssistCmd ¶
type AssistCmd struct{}
AssistCmd is the subcommand for the AI assistant.
func (*AssistCmd) Execute ¶
func (c *AssistCmd) Execute(ctx context.Context, f *flag.FlagSet, args ...interface{}) subcommands.ExitStatus
Execute executes the command.