Documentation
¶
Overview ¶
Package cmd contains all CLI commands used by the application.
Index ¶
- Constants
- func Execute()
- func ImportListings(f io.Reader, d datastore.Writer) (string, error)
- func InitConfig(fs afero.Fs, cfg string)
- func MailHash(m Mail, l int) string
- func NewImportListingCmd() *cobra.Command
- func NewImportMailCmd() *cobra.Command
- func NewMailCmd() *cobra.Command
- func NewSearchCmd() *cobra.Command
- func RenderMail(mm []Mail, p bool) string
- func RunImportListingsCmd(cmd *cobra.Command, args []string)
- func RunImportMailCmd(cmd *cobra.Command, args []string)
- func RunMailCmd(cmd *cobra.Command, args []string)
- func RunSearchCmd(cmd *cobra.Command, args []string)
- func UniqueListings(rawListings []lstg.Listing) []lstg.Listing
- func ValidateDate(dd string) (string, error)
- type Mail
- type Mails
Constants ¶
const ( // MaxHashLength is the maximum hash length for md5 checksum. MaxHashLength = 32 // MinHashLength is the minimum hash length for md5 checksum. MinHashLength = 0 // RefLength is the default reference length. RefLength = 6 )
const ( DefaultMaxSearchResults = 10 DefaultMemberNumber = 13401 DefaultConfigFilename = ".ogma" DefaultLoggingLevel = "info" DefaultDatastoreFilename = "ogma.db" )
default const values for application.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func ImportListings ¶ added in v1.1.0
ImportListings adds one to many listings to the datastore from a file.
func InitConfig ¶ added in v1.1.0
InitConfig sets up Viper and Logging.
func MailHash ¶ added in v1.1.0
MailHash creates a 'unique' hash of the sender, receiver, and mail date.
func NewImportListingCmd ¶ added in v1.1.0
NewImportListingCmd sets up an import subcommand.
func NewImportMailCmd ¶ added in v1.1.0
NewImportMailCmd sets up an import subcommand.
func NewMailCmd ¶ added in v1.1.0
NewMailCmd creates a mail command.
func NewSearchCmd ¶ added in v1.1.0
NewSearchCmd creates a mail command.
func RenderMail ¶ added in v1.1.0
RenderMail returns a pretty formatted listing as table.
func RunImportListingsCmd ¶ added in v1.1.0
RunImportListingsCmd performs action associated with listings-import application command.
func RunImportMailCmd ¶ added in v1.1.0
RunImportMailCmd performs action associated with mail-import application command.
func RunMailCmd ¶ added in v1.1.0
RunMailCmd implements functionality of a mail command.
func RunSearchCmd ¶ added in v1.0.0
RunSearchCmd performs action associated with listings application command.
func UniqueListings ¶ added in v1.0.0
UniqueListings returns the passed in slice of listings with at most one of each listing. Listing order is preserved by first occurrence in initial slice.
func ValidateDate ¶ added in v1.1.0
ValidateDate checks date string format and parses with local time location.
Types ¶
type Mail ¶ added in v1.1.0
type Mail struct { ID int `storm:"id,increment"` Ref string `json:"reference"` Sender int `json:"sender"` Receiver int `json:"receiver"` Date string `json:"date"` Link string `json:"link"` }
Mail contains relevant information for correspondence.
func SearchMail ¶ added in v1.1.0
SearchMail returns all mail records with a matching member number.
func UniqueMails ¶ added in v1.1.0
UniqueMails returns the passed in slice of mail with at most one of each mail. Mail order is preserved by first occurrence in initial slice.