123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package main
- import (
- cli "github.com/urfave/cli/v2"
- "os"
- )
- const VERSION = "0.0.1"
- func main() {
- app := &cli.App{
- Name: "sakish",
- Usage: "ELIP4NG management script shell. Default subcommand is 'repl'.",
- Version: VERSION,
- Flags: []cli.Flag{
- &cli.StringFlag{
- Name: "config",
- Aliases: []string{"c"},
- Usage: "config file path. if not specified, use default config at '/nagae/elip4ng/config/sakish.toml'.",
- },
- &cli.BoolFlag{
- Name: "suppress-warn",
- Aliases: []string{"no-warn"},
- Usage: "suppress runtime warning messages",
- },
- },
- Commands: []*cli.Command{
- {
- Name: "repl",
- Aliases: []string{},
- Usage: "start REPL mode",
- Flags: []cli.Flag{},
- Action: CmdRepl,
- },
- {
- Name: "exec",
- Aliases: []string{"e"},
- Usage: "execute a script file",
- Flags: []cli.Flag{
- &cli.BoolFlag{
- Name: "strict-mode",
- Aliases: []string{"s"},
- Usage: "enable ECMAScript strict mode",
- },
- &cli.BoolFlag{
- Name: "no-js-result-print",
- Aliases: []string{"nrp"},
- Usage: "do not print js result after execute",
- },
- },
- Action: CmdRun,
- },
- {
- Name: "version",
- Aliases: []string{"v", "ver"},
- Usage: "print version information",
- Flags: []cli.Flag{},
- Action: CmdVersion,
- },
- },
- }
- app.DefaultCommand = "repl"
- if err := app.Run(os.Args); err != nil {
- ErrorExit(err)
- }
- }
|