cli

package
v0.0.0-...-71c93ef Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const Help = "TODO..."

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App represents the command line interface.

func NewApp

func NewApp(userService *service.User, fileService *service.File, display Display, logger *log.Logger) *App

NewApp creates a new App instance.

func (*App) CheckPassword

func (a *App) CheckPassword(ctx context.Context, args ...string)

CheckPassword checks if a password matches the password hash stored for a user.

func (*App) CheckPasswordHash

func (a *App) CheckPasswordHash(ctx context.Context, args ...string)

CheckPasswordHash checks if a password matches a password hash.

func (*App) CookieKey

func (a *App) CookieKey(args ...string)

CookieKey generates a new cookie key.

func (*App) CreateUser

func (a *App) CreateUser(ctx context.Context, args ...string)

CreateUser creates a user.

func (*App) HashPassword

func (a *App) HashPassword(ctx context.Context, args ...string)

HashPassword hashes a password.

func (*App) Login

func (a *App) Login(ctx context.Context, args ...string)

Login logs in a user.

func (*App) Route

func (a *App) Route(ctx context.Context, subCommand string, args ...string)

Route routes the command to the appropriate method.

func (*App) Size

func (a *App) Size(ctx context.Context, args ...string)

Size retrieves a file and displays its size.

func (*App) Upload

func (a *App) Upload(ctx context.Context, args ...string)

Upload uploads a file.

type Display

type Display interface {
	Println(args ...interface{})
	ExitWithHelp(msg, help string)
	Exit(msg string, err error)
}

Display is an interface for displaying output.

type Stdout

type Stdout struct{}

Stdout is the standard output.

func NewStdout

func NewStdout() *Stdout

NewStdout creates a new Stdout instance.

func (*Stdout) Exit

func (s *Stdout) Exit(msg string, err error)

Exit exits the application after displaying a message and an error.

func (*Stdout) ExitWithHelp

func (s *Stdout) ExitWithHelp(msg, help string)

ExitWithHelp exits the application with a help message.

func (*Stdout) Println

func (s *Stdout) Println(args ...interface{})

Println prints the arguments to the standard output.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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