diff --git a/cmd-cp.go b/cmd-cp.go index 187dc4e7..a4684596 100644 --- a/cmd-cp.go +++ b/cmd-cp.go @@ -260,8 +260,14 @@ func runCopyCmd(ctx *cli.Context) { } if cps.Done { if err := saveSession(s); err != nil { - console.Fatalln(iodine.ToError(err)) + console.Fatals(ErrorMessage{ + Message: "Failed with", + Error: iodine.ToError(err), + }) } + console.Infos(InfoMessage{ + Message: "\nSession terminated. To resume session type ‘mc session resume " + s.SessionID + "’", + }) // this os.Exit is needed really to exit in-case of "os.Interrupt" os.Exit(0) } diff --git a/cmd-sync.go b/cmd-sync.go index d51aabdf..1627eff7 100644 --- a/cmd-sync.go +++ b/cmd-sync.go @@ -256,9 +256,14 @@ func runSyncCmd(ctx *cli.Context) { } if ss.Done { if err := saveSession(s); err != nil { - console.Fatalln(iodine.ToError(err)) + console.Fatals(ErrorMessage{ + Message: "Failed wtih", + Error: iodine.ToError(err), + }) } - console.Infoln("\nSession terminated. To resume session type ‘mc session resume " + s.SessionID + "’") + console.Infos(InfoMessage{ + Message: "\nSession terminated. To resume session type ‘mc session resume " + s.SessionID + "’", + }) // this os.Exit is needed really to exit in-case of "os.Interrupt" os.Exit(0) } diff --git a/print-structs.go b/print-structs.go index a1463f82..c1a4e846 100644 --- a/print-structs.go +++ b/print-structs.go @@ -24,8 +24,8 @@ import ( // ErrorMessage container for message reason encapsulation type ErrorMessage struct { - Message string - Error error + Message string `json:"message"` + Error error `json:"error"` } func (e ErrorMessage) String() string { @@ -45,10 +45,10 @@ func (e ErrorMessage) String() string { // Content container for content message structure type Content struct { - Filetype string `json:"ContentType"` - Time string `json:"LastModified"` - Size string `json:"Size"` - Name string `json:"Name"` + Filetype string `json:"content-type"` + Time string `json:"last-modified"` + Size string `json:"size"` + Name string `json:"name"` } func (c Content) String() string { @@ -62,3 +62,8 @@ func (c Content) String() string { }() return message } + +// InfoMessage container for informational messages +type InfoMessage struct { + Message string `json:"message"` +}