mirror of
https://codeberg.org/scip/ephemerup.git
synced 2025-12-19 05:21:04 +01:00
Added mail notification support
This commit is contained in:
@@ -46,6 +46,7 @@ type Config struct {
|
||||
|
||||
// required for forms
|
||||
Description string
|
||||
Notify string
|
||||
}
|
||||
|
||||
func Getversion() string {
|
||||
|
||||
@@ -64,7 +64,7 @@ func FormCreateCommand(conf *cfg.Config) *cobra.Command {
|
||||
// options
|
||||
formCreateCmd.PersistentFlags().StringVarP(&conf.Expire, "expire", "e", "", "Expire setting: asap or duration (accepted shortcuts: dmh)")
|
||||
formCreateCmd.PersistentFlags().StringVarP(&conf.Description, "description", "D", "", "Description of the form")
|
||||
formCreateCmd.PersistentFlags().StringVarP(&conf.Description, "notify", "n", "", "Email address to get notified when consumer has uploaded files")
|
||||
formCreateCmd.PersistentFlags().StringVarP(&conf.Notify, "notify", "n", "", "Email address to get notified when consumer has uploaded files")
|
||||
|
||||
formCreateCmd.Aliases = append(formCreateCmd.Aliases, "add")
|
||||
formCreateCmd.Aliases = append(formCreateCmd.Aliases, "+")
|
||||
|
||||
@@ -50,7 +50,7 @@ type ListParams struct {
|
||||
Apicontext string `json:"apicontext"`
|
||||
}
|
||||
|
||||
const Maxwidth = 10
|
||||
const Maxwidth = 12
|
||||
|
||||
/*
|
||||
Create a new request object for outgoing queries
|
||||
@@ -142,15 +142,15 @@ func HandleResponse(c *cfg.Config, resp *req.Response) error {
|
||||
fmt.Println(trace)
|
||||
}
|
||||
|
||||
if !resp.IsSuccessState() {
|
||||
return fmt.Errorf("bad response: %s", resp.Status)
|
||||
}
|
||||
|
||||
if err := json.Unmarshal([]byte(resp.String()), &r); err != nil {
|
||||
// text output!
|
||||
r.Message = resp.String()
|
||||
}
|
||||
|
||||
if !resp.IsSuccessState() {
|
||||
return fmt.Errorf("bad response: %s (%s)", resp.Status, r.Message)
|
||||
}
|
||||
|
||||
if !r.Success {
|
||||
if len(r.Message) == 0 {
|
||||
if resp.Err != nil {
|
||||
@@ -331,6 +331,7 @@ func CreateForm(w io.Writer, c *cfg.Config) error {
|
||||
SetFormData(map[string]string{
|
||||
"expire": c.Expire,
|
||||
"description": c.Description,
|
||||
"notify": c.Notify,
|
||||
}).
|
||||
Post(rq.Url)
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ func WriteExtended(w io.Writer, response *common.Response) {
|
||||
fmt.Fprintf(w, format, "Context", entry.Context)
|
||||
fmt.Fprintf(w, format, "Created", entry.Created)
|
||||
fmt.Fprintf(w, format, "Description", entry.Description)
|
||||
fmt.Fprintf(w, format, "Notify", entry.Notify)
|
||||
fmt.Fprintf(w, format, "Url", entry.Url)
|
||||
fmt.Fprintln(w)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user