Documentation ¶
Overview ¶
print gathers all tools for formatting output
Index ¶
- Constants
- Variables
- func ErrExit(err error)
- func Execute()
- func ExitIfErr(err error)
- func GetFilestore(online bool) (cafs.Filestore, error)
- func GetWd() string
- func PrintErr(err error, params ...interface{})
- func PrintInfo(msg string, params ...interface{})
- func PrintNotYetFinished(cmd *cobra.Command)
- func PrintSuccess(msg string, params ...interface{})
- func PrintWarning(msg string, params ...interface{})
- func SetLogger(logger Logger)
- func SetNoColor()
- type Logger
Constants ¶
const (
IpfsFsPath = "IpfsFsPath"
)
Variables ¶
var RootCmd = &cobra.Command{
Use: "dt",
Short: "data together CLI",
Long: `command line client for data together`,
}
RootCmd represents the base command when called without any subcommands
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func GetWd ¶
func GetWd() string
GetWd is a convenience method to get the working directory or bail.
func PrintNotYetFinished ¶
func PrintSuccess ¶
func PrintSuccess(msg string, params ...interface{})
func PrintWarning ¶
func PrintWarning(msg string, params ...interface{})
func SetNoColor ¶
func SetNoColor()
Types ¶
type Logger ¶
type Logger interface { Info(...interface{}) Infof(string, ...interface{}) Debug(...interface{}) Debugf(string, ...interface{}) }
Logger interface is to get around the package-level logger anti-pattern https://dave.cheney.net/2017/01/23/the-package-level-logger-anti-pattern I agree in principle with Dave that importing loggers into packages is an anti-pattern, but don't want to pollute custom types with logging details. So, we'll still use a global logging variable, and packages need simply implement the SetLogger interface with anything that accepts a logger. As a default we drop to using fmt-level logging & fmt as a stand-in, defined in this file. consumers of this package should call SetLogger with a chosen logger