tmuxproject

package module
v0.0.0-...-ed293d0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: MIT Imports: 23 Imported by: 0

README

forthebadge forthebadge forthebadge

tmux-project

tmux-project creates, maintains, archives and removes profiles used by the resume command. This command allows the user to list and use different tmux based profiles. Together with bash (or other shell based) profiles you can easily maintain multiple sessions.

Synopsis

archive

Archive a project

tmux-project archive [-v] [-a|archivename <archivename>] -n | -projectname <projectname> 
  -a string
        Archive file
  -archivename string
        Archive file
  -n string
        Name of project
  -projectname string
        Name of project
  -v    Verbose logging

create

Create a new project.

tmux-project create [-t|-projecttype <type>] -n <name> | -projectname <name> [-v]
  -n string
        Name of project
  -projectname string
        Name of project
  -projecttype string
        Type of project (default "default")
  -t string
        Type of project (default "default")
  -v    Verbose logging

edit

Edit a projects environment and tmux configfile

tmux-project edit -n <projectname> [-v]
  -n string
        Name of project
  -projectname string
        Name of project
  -v    Verbose logging

init

Initialize a new project type

tmux-project init [-v] -t | -projecttype <projecttype>
  -f    Force (re)creation
  -projecttype string
        Type of project (default "default")
  -t string
        Type of project (default "default")
  -v    Verbose logging

list

The "list" command list projects currrently configured

tmux-project list [-projectname|-n <name>] [-v] [-v]
  -f    Print full
  -n string
        Name of project
  -projectname string
        Name of project
  -v    Verbose logging

listfiles

The "listfiles" command lists the projects currrently in a project's configuration.

tmux-project listfiles [-projectname|-n <name>] [-v]
  -n string
        Name of project
  -projectname string
        Name of project
  -v    Verbose logging

shell

Allows tmux-project to be integrated in a shell. For example for bash add the following to the profile (bash is the default).

eval "$(tmux-project shell)"
tmux-project shell [-s | -shellname <shell>]

  -s string
        Name of the shell profile to provide (default "bash")
  -shellname string
        Name of the shell profile to provide (default "bash")
  -v    Verbose logging

Functionality

Targets

Target Description
${HOME}/.bash/tmux.d/<project>.env environment file
${HOME}/.bash/tmux.d/<project>.rc tmux configuration
PROJECTS location projects are setup

Documentation

Index

Constants

View Source
const (
	ApplicationName string = "tmux-project"
	Editor          string = "vim"
)
View Source
const AssetDebug = false

AssetDebug is true if the assets were built with the debug flag enabled.

Variables

This section is empty.

Functions

func Ask

func Ask(question string) string

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDigest

func AssetDigest(name string) ([sha256.Size]byte, error)

AssetDigest returns the digest of the file with the given name. It returns an error if the asset could not be found or the digest could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"}, AssetDir("data/img") would return []string{"a.png", "b.png"}, AssetDir("foo.txt") and AssetDir("notexist") would return an error, and AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func AssetString

func AssetString(name string) (string, error)

AssetString returns the asset contents as a string (instead of a []byte).

func CreateProject

func CreateProject(projecttype, projectname string) error

CreateProject create a new project

func Digests

func Digests() (map[string][sha256.Size]byte, error)

Digests returns a map of all known files and their checksums.

func Edit

func Edit(args ...string)

func Exec

func Exec(cwd, args string) ([]string, []string, error)

func ExitOnError

func ExitOnError(err error)

ExitOnError check error and exit if not nil

func ExpandHome

func ExpandHome(pathstr string) (string, error)

ExpandHome expand the tilde in a given path.

func GetMatches

func GetMatches(regEx string, lines []string) (paramsMap map[string]string)

GetMatches parses each line and sticks the findings in a map

func LoadStringLines

func LoadStringLines(target string) ([]string, error)

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func MustAssetString

func MustAssetString(name string) string

MustAssetString is like AssetString but panics when Asset would return an error. It simplifies safe initialization of global variables.

func NewProjectConfig

func NewProjectConfig(projecttype, projectname string) pt.ProjectTypeConfig

NewProjectConfig derives from ProjectTypeConfig and returns an updated object with translated values.

func PrintFullList

func PrintFullList()

func PrintShortList

func PrintShortList()

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory.

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively.

func RunSetupAction

func RunSetupAction(workdir, action string)

Types

type ListTable

type ListTable struct {
	Name        string
	Description string
	Workdir     string
}

func ListTmuxConfigs

func ListTmuxConfigs() []ListTable

type ProjTmplVars

type ProjTmplVars struct {
	HomeDir            string
	ProjectDescription string
	ProjectDir         string
	ProjectName        string
}

func NewProjTmplVars

func NewProjTmplVars(projectname string, conf projecttype.ProjectTypeConfig) *ProjTmplVars

func (ProjTmplVars) LoadFile

func (t ProjTmplVars) LoadFile(target string) (string, error)

func (ProjTmplVars) Parse

func (t ProjTmplVars) Parse(templatestring string) string

buildConfig construct the text from the template definition and arguments.

Directories

Path Synopsis
cmd
Example: import ( "fmt" "github.com/jvzantvoort/tmux-project/config" ) mainconfig := NewMainConfig() fmt.Printf("home dir: %s", mainconfig.HomeDir) fmt.Printf("tmux dir: %s", mainconfig.TmuxDir) fmt.Printf("project type config dir: %s", mainconfig.ProjTypeConfigDir) Package config provides configuration data globally used
Example: import ( "fmt" "github.com/jvzantvoort/tmux-project/config" ) mainconfig := NewMainConfig() fmt.Printf("home dir: %s", mainconfig.HomeDir) fmt.Printf("tmux dir: %s", mainconfig.TmuxDir) fmt.Printf("project type config dir: %s", mainconfig.ProjTypeConfigDir) Package config provides configuration data globally used
Package tmux provides interface import ( "fmt" "github.com/jvzantvoort/tmux-project/tmux" ) tmux := tmux.NewTmux()
Package tmux provides interface import ( "fmt" "github.com/jvzantvoort/tmux-project/tmux" ) tmux := tmux.NewTmux()

Jump to

Keyboard shortcuts

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