Go to file
Ivan Klymenchenko 98e62d97b6 Update README.md
2020-12-22 19:49:47 +02:00
.github/workflows Create go.yml 2020-12-20 22:56:33 +02:00
.gitignore Update .gitignore 2020-12-22 14:45:22 +02:00
.goreleaser.yml Add goreleaser 2020-12-22 12:46:06 +02:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2020-12-20 20:13:06 +02:00
commander.go Init 2020-12-20 16:10:48 +02:00
config.go Add support for layout in windows (#7) 2020-12-22 00:05:59 +02:00
errors.go Init 2020-12-20 15:48:13 +02:00
go.mod Init 2020-12-20 15:48:13 +02:00
go.sum Init 2020-12-20 15:48:13 +02:00
LICENSE Create LICENSE 2020-12-20 17:45:39 +02:00
main.go Terminate session on fail (#12) 2020-12-22 15:10:38 +02:00
Makefile Init 2020-12-20 15:48:13 +02:00
options_test.go Init 2020-12-20 15:48:13 +02:00
options.go Init 2020-12-20 15:48:13 +02:00
README.md Update README.md 2020-12-22 19:49:47 +02:00
smug_test.go Attach to first window from list-windows. (#13) 2020-12-22 18:32:46 +02:00
smug.go Attach to first window from list-windows. (#13) 2020-12-22 18:32:46 +02:00
tmux.go #8 Always kill first window from list-windows command (#9) 2020-12-22 08:32:13 +02:00

Smug - tmux session manager

Inspired by tmuxinator and tmuxp.

Smug automates your tmux workflow. You can create a single configuration file, and Smug will create all the required windows and panes from it.

gif

The configuration used in this GIF can be found here.

Installation

Download from the releases page

Download the latest version of Smug from the releases page After that, run this command:

mkdir smug && tar -xzf smug_0.1.0_Darwin_x86_64.tar.gz -C ./smug && sudo mv smug/smug /usr/local/bin && rm -rf smug

Don't forget to replace smug_0.1.0_Darwin_x86_64.tar.gz with the archive that you've downloaded.

Git

Prerequisite Tools

Fetch from GitHub

The easiest way is to clone Smug from GitHub and install it using go-cli:

cd /tmp
git clone https://github.com/ivaaaan/smug.git
cd smug
go install

Usage

smug <command> <project>[:window name] [-w window name].

Examples

To start/stop a project and all windows, run:

xyz@localhost:~$ smug start project

xyz@localhost:~$ smug stop project

When you already have a running session, and you want only to create some windows from the configuration file, you can do something like this:

xyz@localhost:~$ smug start project:window1

xyz@localhost:~$ smug start project:window1,window2

xyz@localhost:~$ smug start project -w window1

xyz@localhost:~$ smug start project -w window1 -w window2

xyz@localhost:~$ smug stop project:window1

xyz@localhost:~$ smug stop project -w window1 -w window2

Configuration

Configuration files stored in the ~/.config/smug directory in the YAML format, e.g ~/.config/smug/your_project.yml.

Examples

Example 1

session: blog

root: ~/Developer/blog

before_start:
  - docker-compose -f my-microservices/docker-compose.yml up -d # my-microservices/docker-compose.yml is a relative to `root`

stop:
  - docker stop $(docker ps -q)

windows:
  - name: code
    root: blog # a relative path to root
    manual: true # you can start this window only manually, using the -w arg
    layout: main-vertical
    commands:
      - docker-compose start
    panes:
      - type: horizontal
        root: .
        commands:
          - docker-compose exec php /bin/sh
          - clear

  - name: infrastructure
    root: ~/Developer/blog/my-microservices
    layout: tiled
    panes:
      - type: horizontal
        root: .
        commands:
          - docker-compose up -d
          - docker-compose exec php /bin/sh
          - clear

Example 2

session: blog

root: ~/Code/blog

before_start:
  - docker-compose up -d

stop:
  - docker-compose stop

windows:
  - name: code
    layout: main-horizontal
    commands:
      - vim app/dependencies.php
    panes:
      - type: horizontal
        commands:
          - make run-tests
  - name: ssh
    commands:
      - ssh -i ~/keys/blog.pem ubuntu@127.0.0.1