aboutsummaryrefslogtreecommitdiffstats
path: root/aerc.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-08-22 10:38:24 -0500
committerRobin Jarry <robin@jarry.cc>2022-08-22 20:33:04 +0200
commit50992cb9e654d4385a909433bcff08fdbe3a67ec (patch)
treee17ccd4681bb158591ddf1fe8023a3b9c07eade3 /aerc.go
parent5ed849688af7206a4b1cc325d19c9d6a8c8c7e4f (diff)
downloadaerc-50992cb9e654d4385a909433bcff08fdbe3a67ec.tar.gz
main: add cli flag to load specified account(s)
Make it possible to specify which account(s) to load. Preserve listed order when creating account tabs. aerc -a <account-name[,account-name]> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'aerc.go')
-rw-r--r--aerc.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/aerc.go b/aerc.go
index 804befd2..865f0669 100644
--- a/aerc.go
+++ b/aerc.go
@@ -105,7 +105,7 @@ func buildInfo() string {
func usage(msg string) {
fmt.Fprintln(os.Stderr, msg)
- fmt.Fprintln(os.Stderr, "usage: aerc [-v] [mailto:...]")
+ fmt.Fprintln(os.Stderr, "usage: aerc [-v] [-a <account-name>] [mailto:...]")
os.Exit(1)
}
@@ -132,17 +132,21 @@ func setWindowTitle() {
func main() {
defer logging.PanicHandler()
- opts, optind, err := getopt.Getopts(os.Args, "v")
+ opts, optind, err := getopt.Getopts(os.Args, "va:")
if err != nil {
usage("error: " + err.Error())
return
}
logging.BuildInfo = buildInfo()
+ var accts []string
for _, opt := range opts {
if opt.Option == 'v' {
fmt.Println("aerc " + logging.BuildInfo)
return
}
+ if opt.Option == 'a' {
+ accts = strings.Split(opt.Value, ",")
+ }
}
retryExec := false
args := os.Args[optind:]
@@ -165,7 +169,7 @@ func main() {
}
logging.Infof("Starting up version %s", logging.BuildInfo)
- conf, err := config.LoadConfigFromFile(nil)
+ conf, err := config.LoadConfigFromFile(nil, accts)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to load config: %v\n", err)
os.Exit(1) //nolint:gocritic // PanicHandler does not need to run as it's not a panic