Documentation ¶
Overview ¶
package commands contains commands that can be executed by the CLI.
Index ¶
- Variables
- func CreateBankAccount(ctx context.Context, cmd *cli.Command) error
- func CreatePortfolio(ctx context.Context, cmd *cli.Command) error
- func CreateTransaction(ctx context.Context, cmd *cli.Command) error
- func ImportTransactions(ctx context.Context, cmd *cli.Command) error
- func ListPortfolio(ctx context.Context, cmd *cli.Command) error
- func ListSecurities(ctx context.Context, cmd *cli.Command) error
- func Login(ctx context.Context, cmd *cli.Command) error
- func PredictPortfolios(ctx context.Context, cmd *cli.Command)
- func PredictSecurities(ctx context.Context, cmd *cli.Command)
- func ShowPortfolio(ctx context.Context, cmd *cli.Command) error
- func UpdateAllQuotes(ctx context.Context, cmd *cli.Command) error
- func UpdateQuote(ctx context.Context, cmd *cli.Command) error
Constants ¶
This section is empty.
Variables ¶
var BankAccountCmd = &cli.Command{ Name: "bank-account", Usage: "Manage bank accounts", Before: mcli.InjectSession, Commands: []*cli.Command{ { Name: "create", Usage: "Creates a new bank account", Action: CreateBankAccount, Flags: []cli.Flag{ &cli.StringFlag{Name: "name", Usage: "The identifier of the portfolio, e.g. mybank-myportfolio", Required: true}, &cli.StringFlag{Name: "display-name", Usage: "The display name of the portfolio"}, }, }, }, }
BankAccountCmd is the command for bank account related commands.
var CLICmd = &cli.Command{ Name: "mgo", Usage: "The money-gopher CLI", EnableShellCompletion: true, Flags: []cli.Flag{ &cli.BoolFlag{Name: "debug", Usage: "Enable debug mode."}, }, Commands: []*cli.Command{ PortfolioCmd, SecuritiesCmd, BankAccountCmd, LoginCmd, }, }
CLICmd is the main CLICmd command.
var LoginCmd = &cli.Command{ Name: "login", Usage: "Login to the Money Gopher server", Action: Login, Flags: []cli.Flag{ &cli.StringFlag{Name: "client-id", Usage: "The client ID to use for the OAuth 2.0 flow", Value: "cli"}, &cli.StringFlag{Name: "auth-url", Usage: "The authorization URL for the OAuth 2.0 flow", Value: "http://localhost:8000/authorize"}, &cli.StringFlag{Name: "token-url", Usage: "The token URL for the OAuth 2.0 flow", Value: "http://localhost:8000/token"}, &cli.StringFlag{Name: "callback", Usage: "The callback URL for the OAuth 2.0 flow", Value: "http://localhost:10000/callback"}, }, }
LoginCmd is the command to login to the Money Gopher server.
var PortfolioCmd = &cli.Command{ Name: "portfolio", Usage: "Manage portfolios and transactions", Before: mcli.InjectSession, Commands: []*cli.Command{ { Name: "create", Usage: "Creates a new portfolio", Action: CreatePortfolio, Flags: []cli.Flag{ &cli.StringFlag{Name: "name", Usage: "The identifier of the portfolio, e.g. mybank-myportfolio", Required: true}, &cli.StringFlag{Name: "display-name", Usage: "The display name of the portfolio"}, }, }, { Name: "list", Usage: "Lists all portfolios", Action: ListPortfolio, Flags: []cli.Flag{}, }, { Name: "show", Usage: "Shows details about one portfolio", Action: ShowPortfolio, Flags: []cli.Flag{ &cli.StringFlag{Name: "portfolio-name", Usage: "The identifier of the portfolio, e.g. mybank-myportfolio", Required: true}, }, }, { Name: "transactions", Usage: "Subcommands supporting transactions within one portfolio", Commands: []*cli.Command{ { Name: "create", Usage: "Creates a transaction. Defaults to a \"buy\" transaction", Action: CreateTransaction, Flags: []cli.Flag{ &cli.StringFlag{Name: "portfolio-name", Usage: "The name of the portfolio where the transaction will be created in", Required: true}, &cli.StringFlag{Name: "security-name", Usage: "The name of the security this transaction belongs to (its ISIN)", Required: true}, &cli.StringFlag{Name: "type", Usage: "The type of the transaction", Required: true, DefaultText: "buy"}, &cli.FloatFlag{Name: "amount", Usage: "The amount of securities involved in the transaction", Required: true}, &cli.FloatFlag{Name: "price", Usage: "The price without fees or taxes", Required: true}, &cli.FloatFlag{Name: "fees", Usage: "Any fees that applied to the transaction"}, &cli.FloatFlag{Name: "taxes", Usage: "Any taxes that applied to the transaction"}, &cli.StringFlag{Name: "time", Usage: "The time of the transaction. Defaults to 'now'", DefaultText: "now"}, }, }, { Name: "import", Usage: "Imports transactions from CSV", Action: ImportTransactions, Flags: []cli.Flag{ &cli.StringFlag{Name: "portfolio-name", Usage: "The name of the portfolio where the transaction will be created in", Required: true}, &cli.StringFlag{Name: "csv-file", Usage: "The path to the CSV file to import", Required: true}, }, }, }, }, }, }
PortfolioCmd is the command for portfolio related commands.
var SecuritiesCmd = &cli.Command{ Name: "securities", Usage: "Securities commands", Before: mcli.InjectSession, Commands: []*cli.Command{ { Name: "list", Usage: "Lists all securities", Action: ListSecurities, }, { Name: "update-quote", Usage: "Triggers an update of one or more securities' quotes", Action: UpdateQuote, Flags: []cli.Flag{ &cli.StringSliceFlag{Name: "security-names", Usage: "The security IDs to update", Required: true}, }, EnableShellCompletion: true, ShellComplete: PredictSecurities, }, { Name: "update-all-quotes", Usage: "Triggers an update of all quotes", Action: UpdateAllQuotes, }, }, }
SecuritiesCmd is the command for security related commands.
var ( // VerifierGenerator is a function that generates a new verifier. VerifierGenerator = oauth2.GenerateSecret )
Functions ¶
func CreateBankAccount ¶ added in v0.2.1
CreateBankAccount creates a new bank account.
func CreatePortfolio ¶ added in v0.2.1
CreatePortfolio creates a new portfolio.
func CreateTransaction ¶ added in v0.2.1
CreateTransaction creates a transaction.
func ImportTransactions ¶ added in v0.2.1
ImportTransactions imports transactions from a CSV file
func ListPortfolio ¶ added in v0.2.1
ListPortfolio lists all portfolios.
func ListSecurities ¶ added in v0.2.1
ListSecurities lists all securities.
func PredictPortfolios ¶
PredictPortfolios predicts the portfolios for shell completion.
func PredictSecurities ¶ added in v0.0.4
PredictSecurities predicts the securities for shell completion.
func ShowPortfolio ¶ added in v0.2.1
ShowPortfolio shows details about a portfolio.
func UpdateAllQuotes ¶ added in v0.2.1
UpdateAllQuotes triggers an update of all quotes.
func UpdateQuote ¶ added in v0.2.1
UpdateQuote triggers an update of one or more securities' quotes.
Types ¶
This section is empty.