fs

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: MIT Imports: 20 Imported by: 0

README

FS: File Snippet

banner

ci release go report card license go version release

FS is the file snippet CLI.

Install

Binary

Download from GitHub Releases.

Source
go get github.com/skmatz/fs/...

Usage

After the installation, prepare a TOML file in ~/.config/fs/fs.toml.

[config]
head_size = 10
item_size = 10

[[snippet]]
id = "makefile-go"
name = "Makefile"
content = """
.PHONY: build
build:
	go build -o bin/{{ .Command }} cmd/{{ .Command }}/main.go

.PHONY: format
format:
	goimports -w .

.PHONY: test
test:
	go test -v ./...
"""

[[snippet]]
id = "makefile-go"
name = "Makefile"
path = "~/src/github.com/skmatz/fs/misc/Makefile"

[[snippet]]
id = "makefile-go"
name = "Makefile"
url = "https://raw.githubusercontent.com/skmatz/fs/master/misc/Makefile"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.2.0

type Config struct {
	HeadSize int    `default:"10" toml:"head_size"`
	ItemSize int    `default:"10" toml:"item_size"`
	Theme    string `default:"dracula" toml:"theme"`
}

Config represents a configuration of the application.

type FS

type FS struct {
	Config   Config   `toml:"config"`
	Snippets Snippets `toml:"snippet"`
}

FS represents a FS client.

func New

func New(path string) (*FS, error)

New returns a FS client.

type Snippet

type Snippet struct {
	ID      string `toml:"id"`
	Name    string `toml:"name"`
	Content string `toml:"content"`
	Path    string `toml:"path"`
	URL     string `toml:"url"`

	ColoredContent string
}

Snippet represents a snippet.

func (*Snippet) FillAllFields added in v0.2.0

func (s *Snippet) FillAllFields() error

FillAllFields fills the all fields according to the text template.

func (*Snippet) ToClipboard

func (s *Snippet) ToClipboard() error

ToClipboard writes its content to the clipboard.

func (*Snippet) ToFile

func (s *Snippet) ToFile() error

ToFile writes its content to a file.

type Snippets added in v0.2.0

type Snippets []Snippet

Snippets is a list of snippets.

func (Snippets) Select added in v0.2.0

func (s Snippets) Select() (*Snippet, error)

Select selects a snippet.

Directories

Path Synopsis
cmd
fs

Jump to

Keyboard shortcuts

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