aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/onsi/gomega/gexec/_fixture/firefly/main.go
blob: 16091c22b13a0a2924408bab26244d9fa36c64df (plain)
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
34
35
36
package main

import (
	"fmt"
	"math/rand"
	"os"
	"strconv"
	"time"
)

var outQuote = "We've done the impossible, and that makes us mighty."
var errQuote = "Ah, curse your sudden but inevitable betrayal!"

var randomQuotes = []string{
	"Can we maybe vote on the whole murdering people issue?",
	"I swear by my pretty floral bonnet, I will end you.",
	"My work's illegal, but at least it's honest.",
}

func main() {
	fmt.Fprintln(os.Stdout, outQuote)
	fmt.Fprintln(os.Stderr, errQuote)

	randomIndex := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(randomQuotes))

	time.Sleep(100 * time.Millisecond)

	fmt.Fprintln(os.Stdout, randomQuotes[randomIndex])

	if len(os.Args) == 2 {
		exitCode, _ := strconv.Atoi(os.Args[1])
		os.Exit(exitCode)
	} else {
		os.Exit(randomIndex)
	}
}