aboutsummaryrefslogtreecommitdiff
path: root/cmd/list.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/list.go')
-rw-r--r--cmd/list.go24
1 files changed, 20 insertions, 4 deletions
diff --git a/cmd/list.go b/cmd/list.go
index d2b9a03..99d5f24 100644
--- a/cmd/list.go
+++ b/cmd/list.go
@@ -1,8 +1,8 @@
package cmd
import (
- "flag"
"fmt"
+ "flag"
)
func List(params []string) {
@@ -10,12 +10,28 @@ func List(params []string) {
var withPaths bool
- const WITH_PATHS_HELP = "print paths to the provided reference within the snapshot"
+ withName := aliasedBoolVar(
+ flags,
+ &withPaths,
+ false,
+ "print paths to the provided reference within the snapshot",
+ )
- flags.BoolVar(&withPaths, "paths", false, WITH_PATHS_HELP);
- flags.BoolVar(&withPaths, "p", false, WITH_PATHS_HELP);
+ 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);
}