summary refs log tree commit diff stats
ModeNameSize
-rw-r--r--.gitignore23log stats plain blame
-rw-r--r--COPYING35147log stats plain blame
-rw-r--r--HACKING2487log stats plain blame
-rw-r--r--INSTALL1354log stats plain blame
-rw-r--r--Makefile2625log stats plain blame
-rw-r--r--README4520log stats plain blame
-rw-r--r--TODO4437log stats plain blame
-rwxr-xr-xall_tests.py584log stats plain blame
d---------doc228log stats plain
-rwxr-xr-xranger.py1775log stats plain blame
d---------ranger439log stats plain
d---------test562log stats plain
8c930110716b0c9db2227e13704f826d'>60b351b ^
f406bf5 ^



b60999c ^
f406bf5 ^





b60999c ^

f406bf5 ^
77a0f68 ^


1418e1b ^
60b351b ^
1418e1b ^

661e3ec ^

305446a ^
6394e38 ^
aeb7005
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61


            



                   
              
 

                                    
                                          
                                            

                                                


             



                                  




                                               
                                                   

                                          

                                           

                          
 



                                  
                                                                     





                                                          

          
                                              


                          
                        
 

                               

                                                         
                 
         
 
package main

import (
	"io"
	"io/ioutil"
	"log"
	"os"
	"time"

	"github.com/mattn/go-isatty"

	"git.sr.ht/~sircmpwn/aerc2/config"
	"git.sr.ht/~sircmpwn/aerc2/commands"
	libui "git.sr.ht/~sircmpwn/aerc2/lib/ui"
	"git.sr.ht/~sircmpwn/aerc2/widgets"
)

func main() {
	var (
		logOut io.Writer
		logger *log.Logger
	)
	if !isatty.IsTerminal(os.Stdout.Fd()) {
		logOut = os.Stdout
	} else {
		logOut = ioutil.Discard
	}
	logger = log.New(logOut, "", log.LstdFlags)
	logger.Println("Starting up aerc")

	conf, err := config.LoadConfig(nil)
	if err != nil {
		panic(err)
	}

	var (
		aerc *widgets.Aerc
		ui   *libui.UI
	)
	aerc = widgets.NewAerc(conf, logger, func(cmd string) error {
		err = commands.ExecuteCommand(aerc, cmd)
		if _, ok := err.(commands.ErrorExit); ok {
			ui.Exit = true
			return nil
		}
		return err
	})

	ui, err = libui.Initialize(conf, aerc)
	if err != nil {
		panic(err)
	}
	defer ui.Close()

	for !ui.Exit {
		if !ui.Tick() {
			// ~60 FPS
			time.Sleep(16 * time.Millisecond)
		}
	}
}