aboutsummaryrefslogtreecommitdiff
path: root/cmd/maleeni/root.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-05-08 19:44:17 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-05-08 19:44:17 +0900
commit7e9f616639c29436ab66cc08c70028beded2877d (patch)
treec5f2f2823336c36e76bc4deb666a33e1f26ce1ea /cmd/maleeni/root.go
parentAdd --break-on-error option to lex command (diff)
downloadtre-7e9f616639c29436ab66cc08c70028beded2877d.tar.gz
tre-7e9f616639c29436ab66cc08c70028beded2877d.tar.xz
Change package structure
The executable can be installed using `go install ./cmd/maleeni`.
Diffstat (limited to 'cmd/maleeni/root.go')
-rw-r--r--cmd/maleeni/root.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/cmd/maleeni/root.go b/cmd/maleeni/root.go
new file mode 100644
index 0000000..41c3081
--- /dev/null
+++ b/cmd/maleeni/root.go
@@ -0,0 +1,28 @@
+package main
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/spf13/cobra"
+)
+
+var rootCmd = &cobra.Command{
+ Use: "maleeni",
+ Short: "Generate a portable DFA from a lexical specification",
+ Long: `maleeni provides two features:
+* Generates a portable DFA from a lexical specification.
+* Tokenizes a text stream according to the lexical specification.
+ This feature is primarily aimed at debugging the lexical specification.`,
+ SilenceErrors: true,
+ SilenceUsage: true,
+}
+
+func Execute() error {
+ err := rootCmd.Execute()
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "%v\n", err)
+ return err
+ }
+ return nil
+}