cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 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 parses arguments and runs the appropriate command.

func VersionString

func VersionString() string

VersionString returns the version string.

Types

type AuthCmd

type AuthCmd struct {
	Login          AuthLoginCmd          `cmd:"" help:"Authenticate via OAuth 2.0 flow"`
	SetCredentials AuthSetCredentialsCmd `cmd:"" help:"Set OAuth client ID and secret"`
	SetRealm       AuthSetRealmCmd       `cmd:"" help:"Set QuickBooks company/realm ID"`
	Status         AuthStatusCmd         `cmd:"" help:"Show authentication status"`
	Remove         AuthRemoveCmd         `cmd:"" help:"Remove all stored credentials"`
}

type AuthLoginCmd

type AuthLoginCmd struct{}

AuthLoginCmd handles the OAuth 2.0 authorization code flow.

func (*AuthLoginCmd) Run

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

type AuthRemoveCmd

type AuthRemoveCmd struct{}

AuthRemoveCmd removes all stored credentials.

func (*AuthRemoveCmd) Run

func (cmd *AuthRemoveCmd) Run(ctx context.Context) error

type AuthSetCredentialsCmd

type AuthSetCredentialsCmd struct{}

AuthSetCredentialsCmd sets OAuth client ID and secret.

func (*AuthSetCredentialsCmd) Run

type AuthSetRealmCmd

type AuthSetRealmCmd struct {
	ID string `arg:"" required:"" help:"QuickBooks company/realm ID"`
}

AuthSetRealmCmd stores the realm/company ID.

func (*AuthSetRealmCmd) Run

func (cmd *AuthSetRealmCmd) Run(ctx context.Context) error

type AuthStatusCmd

type AuthStatusCmd struct{}

AuthStatusCmd shows authentication status.

func (*AuthStatusCmd) Run

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

type BillsCmd

type BillsCmd struct {
	List BillsListCmd `cmd:"" help:"List bills"`
	Get  BillsGetCmd  `cmd:"" help:"Get bill by ID"`
}

type BillsGetCmd

type BillsGetCmd struct {
	ID string `arg:"" required:"" help:"Bill ID"`
}

func (*BillsGetCmd) Run

func (cmd *BillsGetCmd) Run(ctx context.Context) error

type BillsListCmd

type BillsListCmd struct {
	Query string `help:"SQL-like query (e.g. SELECT * FROM Bill WHERE TotalAmt > '100')"`
}

func (*BillsListCmd) Run

func (cmd *BillsListCmd) Run(ctx context.Context) error

type CLI

type CLI struct {
	RootFlags `embed:""`

	Version    kong.VersionFlag `help:"Print version and exit"`
	Auth       AuthCmd          `cmd:"" help:"Auth and credentials"`
	Invoices   InvoicesCmd      `cmd:"" help:"Invoice operations"`
	Bills      BillsCmd         `cmd:"" help:"Bill operations"`
	Payments   PaymentsCmd      `cmd:"" help:"Payment operations"`
	Customers  CustomersCmd     `cmd:"" help:"Customer operations"`
	Vendors    VendorsCmd       `cmd:"" help:"Vendor operations"`
	Items      ItemsCmd         `cmd:"" help:"Item/service operations"`
	Reports    ReportsCmd       `cmd:"" help:"Financial reports"`
	VersionCmd VersionCmd       `cmd:"" name:"version" help:"Print version"`
}

CLI defines the full command tree.

type CustomersCmd

type CustomersCmd struct {
	List   CustomersListCmd   `cmd:"" help:"List customers"`
	Get    CustomersGetCmd    `cmd:"" help:"Get customer by ID"`
	Create CustomersCreateCmd `cmd:"" help:"Create a customer"`
}

type CustomersCreateCmd

type CustomersCreateCmd struct {
	Name  string `required:"" help:"Display name"`
	Email string `help:"Email address"`
	Phone string `help:"Phone number"`
}

func (*CustomersCreateCmd) Run

func (cmd *CustomersCreateCmd) Run(ctx context.Context) error

type CustomersGetCmd

type CustomersGetCmd struct {
	ID string `arg:"" required:"" help:"Customer ID"`
}

func (*CustomersGetCmd) Run

func (cmd *CustomersGetCmd) Run(ctx context.Context) error

type CustomersListCmd

type CustomersListCmd struct{}

func (*CustomersListCmd) Run

func (cmd *CustomersListCmd) 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 InvoicesCmd

type InvoicesCmd struct {
	List   InvoicesListCmd   `cmd:"" help:"List invoices"`
	Get    InvoicesGetCmd    `cmd:"" help:"Get invoice by ID"`
	Create InvoicesCreateCmd `cmd:"" help:"Create a new invoice"`
	Send   InvoicesSendCmd   `cmd:"" help:"Send invoice by email"`
	Void   InvoicesVoidCmd   `cmd:"" help:"Void an invoice"`
}

type InvoicesCreateCmd

type InvoicesCreateCmd struct {
	Customer string  `required:"" help:"Customer ID"`
	Item     string  `required:"" help:"Item/service ID"`
	Qty      float64 `required:"" help:"Quantity"`
	Rate     float64 `required:"" help:"Unit rate/price"`
	DueDate  string  `help:"Due date (YYYY-MM-DD)"`
}

func (*InvoicesCreateCmd) Run

func (cmd *InvoicesCreateCmd) Run(ctx context.Context) error

type InvoicesGetCmd

type InvoicesGetCmd struct {
	ID string `arg:"" required:"" help:"Invoice ID"`
}

func (*InvoicesGetCmd) Run

func (cmd *InvoicesGetCmd) Run(ctx context.Context) error

type InvoicesListCmd

type InvoicesListCmd struct {
	Query    string `help:"SQL-like query (e.g. SELECT * FROM Invoice WHERE TotalAmt > '100')"`
	Page     int    `help:"Page number" default:"1"`
	PageSize int    `help:"Results per page" default:"50"`
}

func (*InvoicesListCmd) Run

func (cmd *InvoicesListCmd) Run(ctx context.Context) error

type InvoicesSendCmd

type InvoicesSendCmd struct {
	ID string `arg:"" required:"" help:"Invoice ID"`
	To string `help:"Email address to send to (overrides customer email)"`
}

func (*InvoicesSendCmd) Run

func (cmd *InvoicesSendCmd) Run(ctx context.Context) error

type InvoicesVoidCmd

type InvoicesVoidCmd struct {
	ID        string `arg:"" required:"" help:"Invoice ID"`
	SyncToken string `required:"" help:"Sync token (from invoice get)"`
}

func (*InvoicesVoidCmd) Run

func (cmd *InvoicesVoidCmd) Run(ctx context.Context) error

type ItemsCmd

type ItemsCmd struct {
	List ItemsListCmd `cmd:"" help:"List items/services"`
}

type ItemsListCmd

type ItemsListCmd struct{}

func (*ItemsListCmd) Run

func (cmd *ItemsListCmd) Run(ctx context.Context) error

type PaymentsCmd

type PaymentsCmd struct {
	List   PaymentsListCmd   `cmd:"" help:"List payments"`
	Create PaymentsCreateCmd `cmd:"" help:"Create a payment"`
}

type PaymentsCreateCmd

type PaymentsCreateCmd struct {
	Customer string  `required:"" help:"Customer ID"`
	Amount   float64 `required:"" help:"Payment amount"`
	Invoice  string  `required:"" help:"Invoice ID to apply payment to"`
}

func (*PaymentsCreateCmd) Run

func (cmd *PaymentsCreateCmd) Run(ctx context.Context) error

type PaymentsListCmd

type PaymentsListCmd struct {
	Query string `help:"SQL-like query (e.g. SELECT * FROM Payment)"`
}

func (*PaymentsListCmd) Run

func (cmd *PaymentsListCmd) Run(ctx context.Context) error

type ReportsBalanceSheetCmd

type ReportsBalanceSheetCmd struct {
	Date string `help:"Report date (YYYY-MM-DD)"`
}

func (*ReportsBalanceSheetCmd) Run

type ReportsCmd

type ReportsCmd struct {
	ProfitAndLoss ReportsProfitAndLossCmd `cmd:"" name:"profit-and-loss" help:"Profit and Loss report"`
	BalanceSheet  ReportsBalanceSheetCmd  `cmd:"" name:"balance-sheet" help:"Balance Sheet report"`
}

type ReportsProfitAndLossCmd

type ReportsProfitAndLossCmd struct {
	From   string `help:"Start date (YYYY-MM-DD)"`
	To     string `help:"End date (YYYY-MM-DD)"`
	Method string `help:"Accounting method: Accrual or Cash" enum:"Accrual,Cash," default:""`
}

func (*ReportsProfitAndLossCmd) Run

type RootFlags

type RootFlags struct {
	Color   string `help:"Color output: auto|always|never" default:"${color}"`
	JSON    bool   `help:"Output JSON to stdout (best for scripting)" default:"${json}"`
	Plain   bool   `help:"Output stable, parseable text to stdout (TSV; no colors)" default:"${plain}"`
	Force   bool   `help:"Skip confirmations for destructive commands"`
	NoInput bool   `help:"Never prompt; fail instead (useful for CI)"`
	Verbose bool   `help:"Enable verbose logging"`
}

RootFlags are global flags available on all commands.

type VendorsCmd

type VendorsCmd struct {
	List VendorsListCmd `cmd:"" help:"List vendors"`
}

type VendorsListCmd

type VendorsListCmd struct{}

func (*VendorsListCmd) Run

func (cmd *VendorsListCmd) Run(ctx context.Context) error

type VersionCmd

type VersionCmd struct{}

VersionCmd prints the version information.

func (*VersionCmd) Run

func (cmd *VersionCmd) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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