cli

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2024 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClientCommand = &cli.Command{
	Name:     "client",
	Usage:    "NodeISP Management Client",
	Commands: ClientCommands,
}
View Source
var ClientCommands = []*cli.Command{
	{
		Name:   "status",
		Usage:  "Get the current status of the NodeISP server",
		Action: client.StatusCmd,
	},
	{
		Name:   "version",
		Usage:  "Get the current version and check for updates",
		Action: client.VersionCmd,
	},

	{
		Name:   "update",
		Usage:  "Update the NodeISP server",
		Action: client.UpdateCmd,
	},

	{
		Name:  "restart",
		Usage: "Restart the NodeISP server",
		Commands: []*cli.Command{
			{
				Name:   "all",
				Usage:  "Restart all services",
				Action: client.RestartAllCmd,
			},
			{
				Name:      "service",
				Usage:     "Restart a specific service",
				ArgsUsage: "<service>",
				Action:    client.RestartServiceCmd,
			},
		},
	},
}
View Source
var ConfigFlag = &cli.StringFlag{
	Name:        "config",
	Aliases:     []string{"c"},
	Usage:       "Load configuration from `FILE`",
	Sources:     cli.EnvVars("NODEISP_CONFIG"),
	Value:       "/etc/node-isp/config.yaml",
	Destination: &config.File,
}
View Source
var RootCommand = &cli.Command{
	Name:    "node-isp",
	Usage:   "Building blocks for your own ISP",
	Version: version.Version,
	Flags: []cli.Flag{
		ConfigFlag,
	},
	Commands: append([]*cli.Command{
		SetupCommand,
		ServerCommand,
	}, ClientCommands...),
}
View Source
var ServerCommand = &cli.Command{
	Name:  "server",
	Usage: "NodeISP Server",
	Action: func(ctx context.Context, cmd *cli.Command) error {

		_, err := os.Stat(config.File)
		if os.IsNotExist(err) {
			c := SetupCommand
			c.Flags = append(c.Flags, ConfigFlag)
			return SetupCommand.Run(ctx, os.Args)
		}

		return server.Run()
	},
}
View Source
var SetupCommand = &cli.Command{
	Name:  "setup",
	Usage: "Setup NodeISP for the first time",
	Action: func(ctx context.Context, cmd *cli.Command) error {
		return setup.Run()
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL