From 07e7881d5f1dd913484e3a9fe34710ecbcd3370c Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sat, 19 Jun 2021 10:29:39 +0900 Subject: Add CLI --- cmd/vartan/root.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 cmd/vartan/root.go (limited to 'cmd/vartan/root.go') diff --git a/cmd/vartan/root.go b/cmd/vartan/root.go new file mode 100644 index 0000000..ad163a6 --- /dev/null +++ b/cmd/vartan/root.go @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "os" + + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "vartan", + Short: "Generate a portable parsing table from a grammar", + Long: `vartan provides two features: +- Generates a portable parsing table from a grammar. +- Tokenizes a text stream according to the grammar. + This feature is primarily aimed at debugging the grammar.`, + SilenceErrors: true, + SilenceUsage: true, +} + +func Execute() error { + err := rootCmd.Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + return err + } + return nil +} -- cgit v1.2.3