aboutsummaryrefslogtreecommitdiffstats
path: root/aerc.go
diff options
context:
space:
mode:
authorMoritz Poldrack <git@moritz.sh>2023-03-04 10:56:45 +0100
committerRobin Jarry <robin@jarry.cc>2023-03-07 00:12:47 +0100
commit4838efdb1d5a746432a30ef0b86b090aab52fa7a (patch)
tree10c1c6954e47395ae9b310ce268a77cf9924a4d8 /aerc.go
parent3dbf33bb4c8988851eeed0292fcdc170eb0ee6c7 (diff)
downloadaerc-4838efdb1d5a746432a30ef0b86b090aab52fa7a.tar.gz
ipc: change protocol to JSON
In overhauling the IPC, it has become necessary to switch to a more extendable message format, to ensure more complex commands can be sent. Messages have the following basic structure and must not contain linebreaks, as these are used to delimit separate messages from one another. {"arguments": ["mailto:moritz@poldrack.dev"]} The responses have the following structure: {"error": "epic fail"} If the IPC request was successful, "error" will be empty. {"error": ""} Signed-off-by: Moritz Poldrack <git@moritz.sh> Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'aerc.go')
-rw-r--r--aerc.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/aerc.go b/aerc.go
index 9ed4a2ca..f4247ed5 100644
--- a/aerc.go
+++ b/aerc.go
@@ -159,12 +159,8 @@ func main() {
}
retryExec := false
args := os.Args[optind:]
- if len(args) > 1 {
- usage("error: invalid arguments")
- return
- } else if len(args) == 1 {
- arg := args[0]
- err := ipc.ConnectAndExec(arg)
+ if len(args) > 0 {
+ err := ipc.ConnectAndExec(args)
if err == nil {
return // other aerc instance takes over
}
@@ -232,8 +228,7 @@ func main() {
if retryExec {
// retry execution
- arg := args[0]
- err := ipc.ConnectAndExec(arg)
+ err := ipc.ConnectAndExec(args)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to communicate to aerc: %v\n", err)
err = aerc.CloseBackends()