cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(args []string) (err error)

Execute runs the CLI with the given arguments.

func ExitCode

func ExitCode(err error) int

ExitCode returns the exit code for an error.

func IsStdin

func IsStdin(arg string) bool

IsStdin checks if the argument is stdin marker.

func ProfileFrom

func ProfileFrom(ctx context.Context) string

ProfileFrom retrieves the profile from the context (re-exported for convenience).

func ReadStdinIDs

func ReadStdinIDs(arg string) ([]string, error)

ReadStdinIDs reads IDs from stdin when "-" is provided. Returns nil if arg is not "-".

func ResolveAccountID

func ResolveAccountID(ctx context.Context, flagValue string) (string, error)

ResolveAccountID resolves an account ID from flag, config, or auto-detection. Priority: flag > config > single account auto-detect.

func VersionString

func VersionString() string

VersionString returns the version string for display.

Types

type AccountsCmd

type AccountsCmd struct {
	List AccountsListCmd `cmd:"" help:"List all accounts"`
	Get  AccountsGetCmd  `cmd:"" help:"Get account details"`
	Sync AccountsSyncCmd `cmd:"" help:"Trigger account synchronization"`
}

AccountsCmd is the parent command for accounts.

type AccountsGetCmd

type AccountsGetCmd struct {
	ID string `arg:"" help:"Account ID (use - for stdin)"`
}

AccountsGetCmd gets account details.

func (*AccountsGetCmd) Run

func (c *AccountsGetCmd) Run(ctx context.Context) error

type AccountsListCmd

type AccountsListCmd struct {
	Product string `help:"Filter by product type"`
}

AccountsListCmd lists accounts.

func (*AccountsListCmd) Run

func (c *AccountsListCmd) Run(ctx context.Context) error

type AccountsSyncCmd

type AccountsSyncCmd struct {
	ID   string `arg:"" help:"Account ID"`
	Wait bool   `help:"Wait for sync to complete"`
}

AccountsSyncCmd triggers synchronization.

func (*AccountsSyncCmd) Run

func (c *AccountsSyncCmd) Run(ctx context.Context) error

type AuthCmd

type AuthCmd struct {
	Login  AuthLoginCmd  `cmd:"" help:"Store credentials in keyring"`
	Logout AuthLogoutCmd `cmd:"" help:"Remove credentials from keyring"`
	Status AuthStatusCmd `cmd:"" help:"Show authentication status"`
}

AuthCmd is the parent command for authentication.

type AuthLoginCmd

type AuthLoginCmd struct{}

AuthLoginCmd stores credentials.

func (*AuthLoginCmd) Run

func (c *AuthLoginCmd) Run(ctx context.Context) error

type AuthLogoutCmd

type AuthLogoutCmd struct{}

AuthLogoutCmd removes credentials.

func (*AuthLogoutCmd) Run

func (c *AuthLogoutCmd) Run(ctx context.Context) error

type AuthStatusCmd

type AuthStatusCmd struct{}

AuthStatusCmd shows authentication status.

func (*AuthStatusCmd) Run

func (c *AuthStatusCmd) Run(ctx context.Context) error

type CLI

type CLI struct {
	RootFlags `embed:""`

	Version    kong.VersionFlag `help:"Print version and exit"`
	VersionCmd VersionCmd       `cmd:"" name:"version" help:"Print version"`

	Auth         AuthCmd         `cmd:"" help:"Authentication commands"`
	Accounts     AccountsCmd     `cmd:"" help:"Bank accounts"`
	Transactions TransactionsCmd `cmd:"" help:"Account transactions"`
	Sync         SyncCmd         `cmd:"" help:"Synchronization"`
	Organization OrganizationCmd `cmd:"" help:"Organization info"`

	PendingTransactions   PendingTransactionsCmd   `cmd:"" name:"pending-transactions" help:"Pending transactions"`
	FinancialInstitutions FinancialInstitutionsCmd `cmd:"" name:"financial-institutions" help:"Financial institutions"`

	Completion CompletionCmd `cmd:"" help:"Generate shell completions"`
	Config     ConfigCmd     `cmd:"" help:"Configuration"`
}

CLI is the root command structure.

type CompletionCmd

type CompletionCmd struct {
	Shell string `arg:"" help:"Shell type (bash, zsh, fish, powershell)" enum:"bash,zsh,fish,powershell"`
}

CompletionCmd generates shell completions.

func (*CompletionCmd) Run

func (c *CompletionCmd) Run() error

type ConfigCmd

type ConfigCmd struct {
	Get ConfigGetCmd `cmd:"" help:"Get configuration value"`
	Set ConfigSetCmd `cmd:"" help:"Set configuration value"`
}

ConfigCmd is the parent command for configuration.

type ConfigGetCmd

type ConfigGetCmd struct {
	Key string `arg:"" help:"Config key (account-id)"`
}

ConfigGetCmd gets a configuration value.

func (*ConfigGetCmd) Run

func (c *ConfigGetCmd) Run(ctx context.Context) error

type ConfigSetCmd

type ConfigSetCmd struct {
	Key   string `arg:"" help:"Config key (account-id)"`
	Value string `arg:"" help:"Value to set"`
}

ConfigSetCmd sets a configuration value.

func (*ConfigSetCmd) Run

func (c *ConfigSetCmd) Run(ctx context.Context) error

type ExitError

type ExitError struct {
	Code int
	Err  error
}

ExitError wraps an error with an exit code.

func (*ExitError) Error

func (e *ExitError) Error() string

func (*ExitError) Unwrap

func (e *ExitError) Unwrap() error

type FinancialInstitutionsCmd

type FinancialInstitutionsCmd struct {
	List FinancialInstitutionsListCmd `cmd:"" help:"List financial institutions"`
	Get  FinancialInstitutionsGetCmd  `cmd:"" help:"Get financial institution details"`
}

FinancialInstitutionsCmd is the parent command for financial institutions.

type FinancialInstitutionsGetCmd

type FinancialInstitutionsGetCmd struct {
	ID string `arg:"" help:"Financial institution ID"`
}

FinancialInstitutionsGetCmd gets financial institution details.

func (*FinancialInstitutionsGetCmd) Run

type FinancialInstitutionsListCmd

type FinancialInstitutionsListCmd struct{}

FinancialInstitutionsListCmd lists financial institutions.

func (*FinancialInstitutionsListCmd) Run

type OrganizationCmd

type OrganizationCmd struct {
	Show OrganizationShowCmd `cmd:"" help:"Show organization info"`
}

OrganizationCmd is the parent command for organization.

type OrganizationShowCmd

type OrganizationShowCmd struct{}

OrganizationShowCmd shows org info.

func (*OrganizationShowCmd) Run

type PendingTransactionsCmd

type PendingTransactionsCmd struct {
	List PendingTransactionsListCmd `cmd:"" help:"List pending transactions"`
}

PendingTransactionsCmd is the parent command for pending transactions.

type PendingTransactionsListCmd

type PendingTransactionsListCmd struct {
	AccountID string `help:"Account ID (default: from config or auto-detect)" name:"account-id"`
}

PendingTransactionsListCmd lists pending transactions.

func (*PendingTransactionsListCmd) Run

type RootFlags

type RootFlags struct {
	Profile        string        `help:"Profile name" default:"${profile}" env:"PONTO_PROFILE"`
	Sandbox        bool          `help:"Use sandbox profile" default:"false"`
	EnableCommands string        `help:"Comma-separated list of enabled commands" default:"${enabled_commands}" env:"PONTO_ENABLE_COMMANDS"`
	JSON           bool          `help:"Output JSON"`
	CSV            bool          `help:"Output CSV"`
	Plain          bool          `help:"Output TSV (stable for scripting)"`
	Verbose        int           `short:"v" type:"counter" help:"Verbosity (-v, -vv)"`
	Timeout        time.Duration `help:"Request timeout" default:"30s"`
	NoRetry        bool          `help:"Disable retry on errors"`
}

RootFlags contains global CLI flags.

type SyncCmd

type SyncCmd struct {
	Create SyncCreateCmd `cmd:"" help:"Create a new synchronization"`
	Get    SyncGetCmd    `cmd:"" help:"Get synchronization status"`
	List   SyncListCmd   `cmd:"" help:"List synchronizations"`
}

SyncCmd is the parent command for synchronization.

type SyncCreateCmd

type SyncCreateCmd struct {
	AccountID string `help:"Account ID (default: from config or auto-detect)" name:"account-id"`
	Subtype   string `required:"" help:"Sync subtype (accountDetails, accountTransactions)" enum:"accountDetails,accountTransactions"`
	Wait      bool   `help:"Wait for sync to complete"`
}

SyncCreateCmd creates a sync.

func (*SyncCreateCmd) Run

func (c *SyncCreateCmd) Run(ctx context.Context) error

type SyncGetCmd

type SyncGetCmd struct {
	ID string `arg:"" help:"Synchronization ID"`
}

SyncGetCmd gets sync status.

func (*SyncGetCmd) Run

func (c *SyncGetCmd) Run(ctx context.Context) error

type SyncListCmd

type SyncListCmd struct {
	AccountID string `help:"Account ID (default: from config or auto-detect)" name:"account-id"`
	Limit     int    `help:"Maximum number of syncs" default:"10"`
}

SyncListCmd lists syncs.

func (*SyncListCmd) Run

func (c *SyncListCmd) Run(ctx context.Context) error

type TransactionsCmd

type TransactionsCmd struct {
	List   TransactionsListCmd   `cmd:"" help:"List transactions"`
	Get    TransactionsGetCmd    `cmd:"" help:"Get transaction details"`
	Export TransactionsExportCmd `cmd:"" help:"Export transactions"`
}

TransactionsCmd is the parent command for transactions.

type TransactionsExportCmd

type TransactionsExportCmd struct {
	AccountID string `help:"Account ID (default: from config or auto-detect)" name:"account-id"`
	Since     string `help:"Start date (ISO 8601 or relative like -30d)"`
	Until     string `help:"End date (ISO 8601 or relative like -1d)"`
	Format    string `help:"Output format (csv, json)" default:"csv" enum:"csv,json"`
	Type      string `help:"Filter by type: income, expense, or all" enum:"income,expense,all" default:"all"`
}

TransactionsExportCmd exports transactions.

func (*TransactionsExportCmd) Run

type TransactionsGetCmd

type TransactionsGetCmd struct {
	AccountID string `help:"Account ID (default: from config or auto-detect)" name:"account-id"`
	ID        string `arg:"" help:"Transaction ID (use - for stdin)"`
}

TransactionsGetCmd gets transaction details.

func (*TransactionsGetCmd) Run

type TransactionsListCmd

type TransactionsListCmd struct {
	AccountID string `help:"Account ID (default: from config or auto-detect)" name:"account-id"`
	Since     string `help:"Start date (ISO 8601 or relative like -30d)"`
	Until     string `help:"End date (ISO 8601 or relative like -1d)"`
	Limit     int    `help:"Maximum number of transactions" default:"100"`
	Type      string `help:"Filter by type: income, expense, or all" enum:"income,expense,all" default:"all"`
}

TransactionsListCmd lists transactions.

func (*TransactionsListCmd) Run

type VersionCmd

type VersionCmd struct{}

VersionCmd prints version information.

func (*VersionCmd) Run

func (c *VersionCmd) Run() error

Jump to

Keyboard shortcuts

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