app

package
v0.0.0-...-89074a5 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCheckpoint

func AddCheckpoint(name string, path string) error

AddCheckpoint adds a single key value pair in the form of name and path of a checkpoint to the database

func ChangeDirectory

func ChangeDirectory(name string) (string, error)

ChangeDirectory is a wrapper function for fetch checkpoint which either changes the path or fetches the path from the database

func CleanArgs

func CleanArgs(args []string, flags Flags) (string, error)

CleanArgs checks the arguments provided to the cli

func DestroyDatabase

func DestroyDatabase() error

DestroyDatabase removes the directory where the leveldb stores the checkpoints

func ErrorHandler

func ErrorHandler(err error)

ErrorHandler used to handle the errors encountered by the CLI

func FetchCheckpoint

func FetchCheckpoint(name string) (string, error)

FetchCheckpoint return the string path of a checkpoint in the database

func GetCurrentDirectory

func GetCurrentDirectory() (string, error)

GetCurrentDirectory is used to return the directory from where the CLI was called

func GetDatabase

func GetDatabase() (*leveldb.DB, error)

GetDatabase returns a levelDB object that can be used to access the database

func GetDatabasePath

func GetDatabasePath() (string, error)

GetDatabasePath return the path of the database

func GetFolder

func GetFolder(name string) (string, error)

GetFolder is used to check if the folder exists in the same directory

func RemoveCheckpoint

func RemoveCheckpoint(name string) (string, error)

RemoveCheckpoint removes a single checkpoint from the database

func WriteToConsole

func WriteToConsole(msgs []string, code int)

WriteToConsole writes to the console with the given code

func WriteToTable

func WriteToTable(checkpoints Checkpoints)

WriteToTable takes a list of checkpoints and displays them in table format

Types

type Checkpoint

type Checkpoint struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

Checkpoint is used to hold context for the data

type Checkpoints

type Checkpoints []Checkpoint

Checkpoints is a slice of checkpoint

func ShowCheckpoints

func ShowCheckpoints() (Checkpoints, error)

ShowCheckpoints return a list of all the checkpoints

type Flags

type Flags struct {
	All bool `json:"all"`
	Raw bool `json:"raw"`
}

Flags is used to hold the context for the flags

Jump to

Keyboard shortcuts

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