add cli commands for sending/viewing termails

This commit is contained in:
Keiran 2025-08-06 06:31:27 +01:00
parent 91c39549bd
commit 7b63560f74

View File

@ -54,11 +54,52 @@ var logoutCmd = &cobra.Command{
Run: runLogout,
}
var inboxCmd = &cobra.Command{
Use: "inbox",
Short: "View your termail inbox",
Long: "View, search, and manage your termail inbox.",
Run: runInbox,
}
var inboxReadCmd = &cobra.Command{
Use: "read [termail_id]",
Short: "Mark termail as read",
Long: "Mark a specific termail as read by ID.",
Args: cobra.ExactArgs(1),
Run: runInboxRead,
}
var inboxDeleteCmd = &cobra.Command{
Use: "delete [termail_id]",
Short: "Delete termail",
Long: "Delete a specific termail by ID.",
Args: cobra.ExactArgs(1),
Run: runInboxDelete,
}
var sendCmd = &cobra.Command{
Use: "send [username]",
Short: "Send termail to a user",
Long: "Send termail to a specific user by username.",
Args: cobra.ExactArgs(1),
Run: runSend,
}
func init() {
inboxCmd.Flags().StringP("search", "s", "", "Search termails by content, subject, or sender")
inboxCmd.Flags().IntP("limit", "l", 10, "Number of termails to show")
inboxCmd.Flags().IntP("offset", "o", 0, "Number of termails to skip")
inboxCmd.Flags().Bool("unread", false, "Show only unread termails")
inboxCmd.AddCommand(inboxReadCmd)
inboxCmd.AddCommand(inboxDeleteCmd)
authCmd.AddCommand(registerCmd)
authCmd.AddCommand(loginCmd)
authCmd.AddCommand(logoutCmd)
rootCmd.AddCommand(authCmd)
rootCmd.AddCommand(inboxCmd)
rootCmd.AddCommand(sendCmd)
}
func Execute() error {