| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- package main
- import (
- "fmt"
- "os"
- "git.linuxit.ro/turos.robert/mynotes/lib/server"
- )
- func main() {
- args := os.Args
- switch len(args) {
- case 3:
- if args[1] == "--run" {
- serve(args[2])
- os.Exit(0)
- }
- fmt.Printf("Comanda %s nu este configurata\n", args[1])
- default:
- fmt.Println("Aplicatia necesita minim 2 parametri")
- }
- fmt.Printf("Argumente rulare: %v\n", args)
- }
- func serve(filename string) {
- srv := server.NewServer(filename)
- checkError(srv.Err)
- srv.Run()
- }
- func checkError(err error) {
- if err != nil {
- fmt.Printf("Eroare %+v\n", err)
- os.Exit(0)
- }
- }
|