Documentation ¶
Overview ¶
Package base defines shared basic pieces of the slackdump command.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CmdName string
var Slackdump = &Command{
UsageLine: "slackdump",
Long: `
Slackdump is a tool for exporting Slack conversations, emojis, users, etc.
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it
under certain conditions. Read LICENSE for more information.
`,
}
var Usage func()
Usage is the usage-reporting function, filled in by package main but here for reference by other packages.
Functions ¶
func Executable ¶
func Executable() string
Executable returns the name of the executable for the current OS.
func Render ¶
Render renders the string formatted as markdown into a string with escape sequences for the terminal output. The width of output is calculated based on the terminal width.
func SetExitStatus ¶
func SetExitStatus(n StatusCode)
Types ¶
type Command ¶
type Command struct { // Run runs the command. // The args are the arguments after the command name. Run func(ctx context.Context, cmd *Command, args []string) error Wizard func(ctx context.Context, cmd *Command, args []string) error // UsageLine is the one-line usage message. UsageLine string // Short is the short description shown in the 'slackdump help' output. Short string // Long is the long message shown in the 'slackdump help <this-command>' output. Long string // Flag is a set of flags specific to this command. Flag flag.FlagSet // CustomFlags indicates that the command will do its own // flag parsing. CustomFlags bool // FlagMask specifies the flags to be used with the command. FlagMask cfg.FlagMask // PrintFlags indicates that generic help handler should print the // flags in the flagset. Set it to false, if a Long lists all the flags. // It only matters for the commands that have no subcommands. PrintFlags bool // RequireAuth is a flag that indicates that the command requires // authentication. RequireAuth bool // Commands lists the available commands and help topics. // The order here is the order in which they are printed by 'slackdump help'. // Note that subcommands are in general best avoided. Commands []*Command //HideWizard if set to true disables the display in wizard. HideWizard bool }
A Command is an implementation of a slackdump command.
func (*Command) LongName ¶
LongName returns the command's long name: all the words in the usage line between "go" and a flag or argument,
func (*Command) Name ¶
Name returns the command's short name: the last word in the usage line before a flag or argument.
type StatusCode ¶
type StatusCode uint8
StatusCode is the code returned to the OS.
const ( SNoError StatusCode = iota // No Error SGenericError // Generic Error SHelpRequested // Help Requested SInvalidParameters // Invalid Parameters SAuthError // Authentication Error SInitializationError // Initialization Error SApplicationError // Application Error SWorkspaceError // Workspace Error SCacheError // Cache Error SUserError // User Error SCancelled // Cancelled )
Status codes returned by the main executable.
func ExitStatus ¶
func ExitStatus() (sc StatusCode)
func (StatusCode) String ¶
func (i StatusCode) String() string