flags

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package flags provides the command line interface for the Defacto2 server application. With the configuration of the application done using the environment variables, the use of commands should be kept to a minimum.

Index

Constants

View Source
const (
	Title      = "Defacto2 web application" // Title of this program.
	Domain     = "defacto2.net"             // Domain of the website.
	Program    = "defacto2-server"          // Program is the command line name of this program.
	Author     = "Ben Garrett"              // Author is the primary programmer of this program.
	Email      = "contact@defacto2.net"     // Email contact for public display.
	RecentYear = 2024                       // Most recent year of compilation for this program.
)

Variables

View Source
var ErrCmd = errors.New("cannot run command as config is nil")

Functions

func Address

func Address(c *config.Config) *cli.Command

Address command lists the server addresses.

func App

func App(ver string, c *config.Config) *cli.App

App returns the command line interface for this program. It uses the github.com/urfave.cli/v2 package.

func Arch

func Arch() string

Arch returns the program CPU architecture.

func Commit

func Commit(ver string) string

Commit returns a formatted, git commit description for the repository, including git tag version and git commit date.

func Config

func Config(c *config.Config) *cli.Command

Config command lists the server configuration.

func Copyright() string

Copyright returns a "©" copyright symbol, the respective years and author of this program.

The most recent copyright year is generated from the last commit date.

func Fix

func Fix(c *config.Config) *cli.Command

Fix command the database and assets.

func OS

func OS() string

OS returns the program operating system.

func Vers

func Vers(version string) string

Vers returns a formatted version. The version string is generated by GoReleaser.

func Version

func Version(s string) string

Version returns a formatted version string for this program including the Commit, OS and CPU Arch.

Types

type ExitCode

type ExitCode int // ExitCode is the exit code for this program.
const (
	Continue     ExitCode = iota - 1 // Continue is a special case to indicate the program should not exit.
	ExitOK                           // ExitOK is the exit code for a successful run.
	GenericError                     // GenericError is the exit code for a generic error.
	UsageError                       // UsageError is the exit code for an incorrect command line argument or usage.
)

func Run

func Run(ver string, c *config.Config) (ExitCode, error)

Run parses optional command line arguments for this program.

Jump to

Keyboard shortcuts

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