-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
33 lines (25 loc) · 812 Bytes
/
main.go
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
package main
import (
"flag"
"main/backend"
"main/server"
"os"
"github.com/pterm/pterm"
)
func main() {
// Parse the command line arguments
if len(os.Args) < 2 {
pterm.Error.Println("Please provide the CSV file with the question and answers as an argument")
os.Exit(1)
}
csvFileArg := os.Args[1]
//Extract the questions and answers
backend.ExtractQuestionsAndAnswers(csvFileArg)
// Parse the port number
portPtr := flag.Int("port", 8080, "port to listen on")
//Print the banner
pterm.DefaultCenter.Println(pterm.DefaultHeader.WithFullWidth().WithBackgroundStyle(pterm.NewStyle(pterm.BgLightRed)).WithMargin(10).Sprint("Athena: The Intelligent Q&A Search Engine"))
pterm.Info.Println("(c)2022 by Akhil Datla")
//Start the server on the specified port
server.StartServer(*portPtr)
}