Commit fcce36dd authored by Felix Delattre's avatar Felix Delattre
Browse files

Added basic command line argument for buildingId

parent 3ce78369
Pipeline #19494 failed with stages
in 4 seconds
......@@ -21,6 +21,7 @@
package main
import (
"flag"
"log"
)
......@@ -29,4 +30,12 @@ import (
*/
func main() {
log.Println("Hello world")
// Read command line argument for buildingId
buildingIdPointer := flag.Int64("building", 0, "set building ID")
flag.Parse()
// Initiate variables
buildingId := *buildingIdPointer
log.Println("buildingId: ", buildingId)
}
......@@ -21,12 +21,32 @@
package main
import (
"bytes"
"flag"
"testing"
)
func TestMain(t *testing.T) {
type Config struct {
building int64
args []string
}
func parseFlags(t *testing.T) {
err := error(nil)
if err != nil {
t.Fatal(err)
}
flags := flag.NewFlagSet("rcli", flag.ContinueOnError)
var buf bytes.Buffer
flags.SetOutput(&buf)
var stringArray = [2]string
var conf Config
flags.Int64Var(&conf.building, "building", 1, "set building ID")
err = flags.Parse()
if err != nil {
return nil, buf.String(), err
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment