ssx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(e *entry.Entry, repo Repo) *Client

func (*Client) Execute added in v0.0.6

func (c *Client) Execute(ctx context.Context, opt *ExecuteOption) error

Execute a command combined stdout and stderr output, then exit

func (*Client) Interact added in v0.0.6

func (c *Client) Interact(ctx context.Context) error

Interact Bind the current terminal to provide an interactive interface

func (*Client) Login added in v0.0.6

func (c *Client) Login(ctx context.Context) error

Login connect remote server and touch enrty in storage

type CmdOption

type CmdOption struct {
	DBFile       string
	EntryID      uint64
	Addr         string
	Tag          string
	IdentityFile string
	Keyword      string
	Command      string
	Timeout      time.Duration
}

func (*CmdOption) Tidy

func (o *CmdOption) Tidy() error

Tidy complete unset fields with default values

type ExecuteOption added in v0.0.6

type ExecuteOption struct {
	Command string
	Stdout  io.Writer
	Stderr  io.Writer
	Timeout time.Duration
}

type Repo

type Repo interface {
	Init() error
	GetMetadata(key []byte) ([]byte, error)
	SetMetadata(key []byte, value []byte) error
	TouchEntry(e *entry.Entry) (err error)
	GetEntry(id uint64) (*entry.Entry, error)
	GetAllEntries() (map[uint64]*entry.Entry, error)
	DeleteEntry(id uint64) error
}

Repo define a KV store interface

type SSX

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

func NewSSX

func NewSSX(opt *CmdOption) (*SSX, error)

func (*SSX) AppendTagByID

func (s *SSX) AppendTagByID(id int, tags ...string) error

func (*SSX) DeleteEntryByID

func (s *SSX) DeleteEntryByID(ids ...int) error

func (*SSX) DeleteTagByID added in v0.0.2

func (s *SSX) DeleteTagByID(id int, tags ...string) error

func (*SSX) GetEntry added in v0.0.7

func (s *SSX) GetEntry(opt *CmdOption) (*entry.Entry, error)

func (*SSX) ListEntries

func (s *SSX) ListEntries() error

func (*SSX) Main

func (s *SSX) Main(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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