|
4 | 4 | "bufio"
|
5 | 5 | "fmt"
|
6 | 6 | "io"
|
| 7 | + "os" |
7 | 8 | "os/exec"
|
8 | 9 | "strings"
|
9 | 10 |
|
@@ -356,9 +357,9 @@ func PrintHelp() {
|
356 | 357 | fmt.Fprintln(textView, "")
|
357 | 358 | fmt.Fprintln(textView, "[-::-]Message panel focused:[-::-]")
|
358 | 359 | fmt.Fprintln(textView, "[::b] Up/Down[::-] = select message")
|
359 |
| - fmt.Fprintln(textView, "[::b]", config.Config.Keymap.MessageDownload, "[::-] = download attachment -> ", config.Config.General.DownloadPath) |
360 |
| - fmt.Fprintln(textView, "[::b]", config.Config.Keymap.MessageOpen, "[::-] = download & open attachment -> ", config.Config.General.PreviewPath) |
361 |
| - fmt.Fprintln(textView, "[::b]", config.Config.Keymap.MessageShow, "[::-] = download & show image using jp2a -> ", config.Config.General.PreviewPath) |
| 360 | + fmt.Fprintln(textView, "[::b]", config.Config.Keymap.MessageDownload, "[::-] = download attachment to", config.Config.General.DownloadPath) |
| 361 | + fmt.Fprintln(textView, "[::b]", config.Config.Keymap.MessageOpen, "[::-] = download & open attachment in", config.Config.General.PreviewPath) |
| 362 | + fmt.Fprintln(textView, "[::b]", config.Config.Keymap.MessageShow, "[::-] = download & show image using"+config.Config.General.ShowCommand, config.Config.General.PreviewPath+string(os.PathSeparator)+"filename.file") |
362 | 363 | fmt.Fprintln(textView, "[::b]", config.Config.Keymap.MessageUrl, "[::-] = find URL in message and open it")
|
363 | 364 | fmt.Fprintln(textView, "[::b]", config.Config.Keymap.MessageRevoke, "[::-] = revoke message")
|
364 | 365 | fmt.Fprintln(textView, "[::b]", config.Config.Keymap.MessageInfo, "[::-] = info about message")
|
@@ -473,7 +474,15 @@ func PrintErrorMsg(text string, err error) {
|
473 | 474 | // prints an image attachment to the TextView (by message id)
|
474 | 475 | func PrintImage(path string) {
|
475 | 476 | var err error
|
476 |
| - cmd := exec.Command("jp2a", "--color", path) |
| 477 | + cmdParts := strings.Split(config.Config.General.ShowCommand, " ") |
| 478 | + cmdParts = append(cmdParts, path) |
| 479 | + var cmd *exec.Cmd |
| 480 | + size := len(cmdParts) |
| 481 | + if size > 1 { |
| 482 | + cmd = exec.Command(cmdParts[0], cmdParts[1:]...) |
| 483 | + } else if size > 0 { |
| 484 | + cmd = exec.Command(cmdParts[0]) |
| 485 | + } |
477 | 486 | var stdout io.ReadCloser
|
478 | 487 | if stdout, err = cmd.StdoutPipe(); err == nil {
|
479 | 488 | if err = cmd.Start(); err == nil {
|
|
0 commit comments