sndotfiles

package
v0.0.0-...-98e1796 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SNServerURL defines the default URL for making calls to syncDBwithFS with SN
	SNServerURL = "https://syncDBwithFS.standardnotes.org"
	// DotFilesTag defines the default tag that all SN Dotfiles will be prefixed with
	DotFilesTag = "dotfiles"
	// DefaultPageSize defines the number of items to attempt to syncDBwithFS per request
	DefaultPageSize = 500
	// SpinnerCharSet defines the characters to use for the spinner shown when syncing
	SpinnerCharSet = 14
	// SpinnerDelay defines the number of milliseconds to wait between each character in the spinner
	SpinnerDelay = 100

	SNAppName = "sn-dotfiles"
)

Variables

View Source
var (
	HiWhite = color.New(color.FgHiWhite).SprintFunc()
)

Functions

func ParseSessionString

func ParseSessionString(in string) (email string, session gosn.Session, err error)

func StringInSlice

func StringInSlice(inStr string, inSlice []string, matchCase bool) bool

func WipeDotfileTagsAndNotes

func WipeDotfileTagsAndNotes(session *cache.Session, pageSize int, useStdErr bool) (int, error)

Types

type AddInput

type AddInput struct {
	Session  *cache.Session
	Home     string
	Paths    []string
	All      bool
	Twn      tagsWithNotes
	PageSize int
}

type AddOutput

type AddOutput struct {
	TagsPushed, NotesPushed                 int
	PathsAdded, PathsExisting, PathsInvalid []string
	Msg                                     string
}

func Add

func Add(ai AddInput, useStdErr bool) (ao AddOutput, err error)

Add tracks local Paths by pushing the local dir as a tag representation and the filename as a note title

type GetNoteConfig

type GetNoteConfig struct {
	Session    cache.Session
	Filters    gosn.ItemFilters
	NoteTitles []string
	TagTitles  []string
	TagUUIDs   []string
	PageSize   int
	Debug      bool
}

GetNoteConfig defines the input for getting notes from SN

type ItemDiff

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

func Diff

func Diff(session *cache.Session, home string, paths []string, pageSize int, close, useStdErr bool) (diffs []ItemDiff, msg string, err error)

func Status

func Status(session *cache.Session, home string, paths []string, pageSize int, debug bool, useStdErr bool) (diffs []ItemDiff, msg string, err error)

Status compares and then outputs status of all items (or a subset defined by Paths param): - local items that missing - local items that are newer - remote items that are newer - local items that are untracked (if Paths specified) - identical local and remote items

type RemoveInput

type RemoveInput struct {
	Session  *cache.Session
	Home     string
	Paths    []string
	PageSize int
	Debug    bool
}

type RemoveOutput

type RemoveOutput struct {
	NotesRemoved, TagsRemoved, NotTracked int
	Msg                                   string
}

func Remove

func Remove(ri RemoveInput, useStdErr bool) (ro RemoveOutput, err error)

Remove stops tracking local Paths by removing the related notes from SN

type SNDotfilesSyncInput

type SNDotfilesSyncInput struct {
	Session        *cache.Session
	Home           string
	Paths, Exclude []string
	PageSize       int
	Debug          bool
}

type SyncOutput

type SyncOutput struct {
	NoPushed, NoPulled int
	Msg                string
}

func Sync

func Sync(si SNDotfilesSyncInput, useStdErr bool) (so SyncOutput, err error)

Sync compares local and remote items and then: - pulls remotes if locals are older or missing - pushes locals if remotes are newer

Jump to

Keyboard shortcuts

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