sessionizer

package
v0.0.0-...-f74eb5f Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Index

Constants

This section is empty.

Variables

View Source
var ErrNotInTmux = errors.New("not in a tmux session")
View Source
var FdCmd = &cobra.Command{
	Use:          "fd",
	Short:        "List all dirs in home and lest u create the session else switches to one",
	SilenceUsage: true,
	RunE: func(cmd *cobra.Command, args []string) error {
		if err := Fd(); err != nil {

			return err
		}
		return nil
	},
}

fdCmd represents the fd command

View Source
var FgCmd = &cobra.Command{
	Use:   "fg",
	Short: "Select a GitHub repo, clone it if absent, and create a session",
	Long: `Uses the GitHub API to list available repositories. If the repository does not exist in
~/HOME/github.com/DnFreddie, it will be cloned and a tmux session created. Otherwise, it switches to an existing session.`,
	SilenceUsage: true,
	RunE: func(cmd *cobra.Command, args []string) error {

		if _reposDir == "" {
			_reposDir = os.ExpandEnv("${HOME}/github.com")
		}
		if _git_url != "" {
			return cloneAndTmux(_git_url, _reposDir)
		}

		if err := Fg(_reposDir); err != nil {
			return fmt.Errorf("error in Fg operation: %w", err)
		}
		return nil
	},
}
View Source
var FsCmd = &cobra.Command{
	Use:          "fs",
	Short:        "Read .ssh/config and create or switch the tmux session ",
	SilenceUsage: true,
	Long:         `Chose the Host and ssh into it wiht new tmux session created`,
	RunE: func(cmd *cobra.Command, args []string) error {
		if err := Fs(); err != nil {
			return err
		}
		return nil
	},
}

fsCmd represents the fs command

View Source
var VfCmd = &cobra.Command{
	Use:          "vf",
	Short:        "Look on directories in home and open one in nvim in tmux pane",
	SilenceUsage: true,
	RunE: func(cmd *cobra.Command, args []string) error {

		if err := Vf(); err != nil {
			return err
		}
		return nil
	},
}

vfCmd represents the tn command

Functions

func Fd

func Fd() error

func Fg

func Fg(gitDir string) error

func Fs

func Fs() error

func Vf

func Vf() error

Types

type Host

type Host string

func GetHosts

func GetHosts(r io.Reader) ([]Host, error)

func (Host) String

func (h Host) String() string

type Path

type Path string

Find searches for directories within the specified directory up to a depth of 3. It returns a slice of maps where each map contains the basename and absolute path of a directory. The function limits concurrent processing to 5 goroutines.

func Find

func Find(dir string) ([]Path, error)

func (Path) String

func (p Path) String() string

type Tmux

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

func NewTmux

func NewTmux(sessionName, dir string) (*Tmux, error)

func (*Tmux) CreateSession

func (t *Tmux) CreateSession() error

func (*Tmux) GetName

func (t *Tmux) GetName() string

func (*Tmux) HasSession

func (t *Tmux) HasSession() (bool, error)

func (*Tmux) Run

func (t *Tmux) Run(args ...string) (string, error)

func (*Tmux) SetName

func (t *Tmux) SetName(s string)

Jump to

Keyboard shortcuts

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