cmd

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: EUPL-1.2 Imports: 52 Imported by: 0

Documentation

Overview

Package cmd provides command generic functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List() []string

List returns a sorted list of all registered command names.

func Main

func Main(progName, buildVersion string) int

Main is the real entrypoint of the zettelstore.

func RegisterCommand

func RegisterCommand(cmd Command)

RegisterCommand registers the given command.

Types

type Command

type Command struct {
	Name       string              // command name as it appears on the command line
	Func       CommandFunc         // function that executes a command
	Simple     bool                // Operate in simple-mode
	Boxes      bool                // if true then boxes will be set up
	Header     bool                // Print a heading on startup
	LineServer bool                // Start admin line server
	SetFlags   func(*flag.FlagSet) // function to set up flag.FlagSet
	// contains filtered or unexported fields
}

Command stores information about commands / sub-commands.

func Get

func Get(name string) (Command, bool)

Get returns the command identified by the given name and a bool to signal success.

func (*Command) GetFlags

func (c *Command) GetFlags() *flag.FlagSet

GetFlags return the flag.FlagSet defined for the command.

type CommandFunc

type CommandFunc func(*flag.FlagSet) (int, error)

CommandFunc is the function that executes the command. It accepts the parsed command line parameters. It returns the exit code and an error.

Directories

Path Synopsis
Package main is the starting point for the zettelstore command.
Package main is the starting point for the zettelstore command.

Jump to

Keyboard shortcuts

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