Debian Codegraph @

dummy-monitor/args/args.go

raw symbols SCIP
1 // This file is part of dummy-monitor.
2 //
3 // SPDX-FileCopyrightText: Arduino s.r.l. and/or its affiliated companies
4 // SPDX-License-Identifier: GPL-3.0-or-later
5
6 package args
7
8 import (
9 "fmt"
10 "os"
11 )
12
13 // Tag is the current git tag
14 var Tag = "snapshot"
15
16 // Timestamp is the current timestamp
17 var Timestamp = "unknown"
18
19 // Parse arguments passed by the user
20 func Parse() {
21 for _, arg := range os.Args[1:] {
22 if arg == "" {
23 continue
24 }
25 if arg == "-v" || arg == "--version" {
26 fmt.Printf("dummy-monitor %s (build timestamp: %s)\n", Tag, Timestamp)
27 os.Exit(0)
28 }
29 fmt.Fprintf(os.Stderr, "invalid argument: %s\n", arg)
30 os.Exit(1)
31 }
32 }