aboutsummaryrefslogtreecommitdiff
path: root/cmd/list.go
blob: 99d5f2402f94b405e078f03c6aa1d8f825cf58f3 (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
37
package cmd

import (
	"fmt"
	"flag"
)

func List(params []string) {
	flags := flag.NewFlagSet("list", flag.ExitOnError)

	var withPaths bool

	withName := aliasedBoolVar(
		flags,
		&withPaths,
		false,
		"print paths to the provided reference within the snapshot",
	)

	withName("paths")
	withName("p")

	flags.Parse(params);

	if(flags.NArg() == 0) {
		die.Fatal("Reference file is required")
	}

	if(flags.NArg() > 1) {
		die.Fatal("Too many arguments provided")
	}
	
	reference := flags.Arg(0)

	fmt.Printf(reference)
	fmt.Printf("Your flag is: %t", withPaths);
}