zei

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

README

zei

A basic CLI for storing and executing command snippets.

screen-01
# Display help info
zei -h

# Execute stored snippet's command
zei <command-id>

[!TIP] Go templating is supported within a snippet's command.

For example, setting a snippet with a command like

echo {{.Message}}

will prompt for the value of Message when the snippet is executed.

[!TIP] Piped commands are supported within a snippet's command.

Setting a snippet with a command like

<command-1> | <command-2>

will pipe command-1's output to command-2 when the snippet is executed.

Installing

Download a binary from releases and add it to your PATH.

or

Install with go:

go install github.com/sammy-t/zei/cmd/zei@latest

Development

Add Go dependencies
go get ./...
Run the CLI
go run ./cmd/zei
Build the CLI
go build -C ./cmd/zei

The binary will output to the cmd/zei/ directory.

Install the CLI
go install ./cmd/zei

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSnippet

func AddSnippet(id string, cmdText string, description string) error

AddSnippet stores a new snippet in the database.

func IsValidId

func IsValidId(id string) bool

IsValidId is a helper to determine if the snippet id is valid.

func RemoveSnippet

func RemoveSnippet(ids []string) error

RemoveSnippet removes the matching snippet from the database.

func UpdateSnippet

func UpdateSnippet(id string, updated Snippet) error

Update stores the updated snippet in the database.

Types

type Snippet

type Snippet struct {
	ID          string `gorm:"primaryKey"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Command     string `gorm:"not null"`
	Description string
}

func GetSnippet

func GetSnippet(id string) (Snippet, error)

GetSnippet retrieves the snippet with the provided id.

func GetSnippets

func GetSnippets() ([]Snippet, error)

GetSnippets returns all stored snippets.

func (*Snippet) DisplayText

func (s *Snippet) DisplayText() string

DisplayText returns the main fields of the snippet as a "friendly" string.

Directories

Path Synopsis
cmd
zei command
internal

Jump to

Keyboard shortcuts

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