Skip to content

Commit cd04dc6

Browse files
authored
Merge branch 'main' into issue/249/hide-duplicates-and-hide-attached-bug
2 parents b15cb14 + f575a54 commit cd04dc6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1687
-4313
lines changed

.github/workflows/ci-cd.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ jobs:
2222
- uses: actions/checkout@v4
2323
- uses: actions/setup-go@v5
2424
with:
25-
go-version: "1.21"
26-
- name: Install deps
25+
go-version: "1.24"
26+
- name: Install junit report
2727
run: go install github.com/jstemmer/go-junit-report/v2@latest
28+
- name: Install mockery
29+
run: go install github.com/vektra/mockery/[email protected]
30+
- name: Create mocks
31+
run: mockery
2832
- name: Run tests
2933
run: go test -cover -bench=. -benchmem -race -v 2>&1 ./... | go-junit-report -set-exit-code > report.xml
3034
- name: Test Summary
@@ -47,7 +51,7 @@ jobs:
4751
- name: Set up Go
4852
uses: actions/setup-go@v5
4953
with:
50-
go-version: "1.21"
54+
go-version: "1.24"
5155
- name: Run GoReleaser
5256
uses: goreleaser/goreleaser-action@v5
5357
with:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# Test binary, built with `go test -c`
1212
*.test
1313

14+
# Mocks
15+
mock_*
16+
1417
# Output of the go coverage tool, specifically when used with LiteIDE
1518
*.out
1619

.goreleaser.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ builds:
2222
- linux
2323
- windows
2424
- darwin
25+
ldflags:
26+
- -X main.version={{.Version}}
2527

2628
archives:
2729
- format: tar.gz

.mockery.yaml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
with-expecter: True
2-
inpackage: True
3-
testonly: False
4-
issue-845-fix: True
5-
resolve-type-alias: False
6-
dir: "{{.InterfaceDir}}"
7-
mockname: "Mock{{.InterfaceName}}"
8-
outpkg: "{{.PackageName}}"
9-
filename: "mock_{{.InterfaceName}}.go"
10-
all: True
1+
all: true
2+
dir: '{{.InterfaceDir}}'
3+
structname: Mock{{.InterfaceName}}
4+
pkgname: '{{.SrcPackageName}}'
5+
filename: mock_{{.InterfaceName}}.go
6+
template: testify
7+
template-data:
8+
unroll-variadic: true
119
packages:
1210
github.com/joshmedeski/sesh:
1311
config:
14-
recursive: True
12+
recursive: true

CLAUDE.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Sesh is a smart terminal session manager written in Go that helps users create and manage tmux sessions quickly and easily using zoxide. It's a CLI tool that integrates with tmux and zoxide to provide intelligent session management.
8+
9+
## Core Architecture
10+
11+
- **Module**: `github.com/joshmedeski/sesh/v2`
12+
- **Go Version**: 1.23.0 (toolchain 1.24.3)
13+
- **Main Entry Point**: `main.go``seshcli.App()`
14+
15+
### Key Packages
16+
17+
- `seshcli/` - CLI command implementations (connect, list, preview, clone, last, tui)
18+
- `lister/` - Lists sessions from various sources (tmux, zoxide, config)
19+
- `connector/` - Handles session connections
20+
- `tmux/` - Tmux integration
21+
- `zoxide/` - Zoxide integration
22+
- `configurator/` - Configuration management (`sesh.toml` in `$XDG_CONFIG_HOME/sesh`)
23+
- `tui/` - Terminal UI implementation using Bubble Tea (currently under development)
24+
25+
### Session Sources
26+
27+
1. **Tmux**: Active tmux sessions
28+
2. **Zoxide**: Frequently used directories
29+
3. **Config**: User-defined sessions in configuration
30+
4. **Tmuxinator**: Tmuxinator project configurations
31+
32+
## Common Development Commands
33+
34+
### Build
35+
```bash
36+
make build
37+
# Or directly:
38+
go build -ldflags "-X 'main.version=`git describe --tags --abbrev=0`'" -o $GOPATH/bin/sesh
39+
```
40+
41+
### Test
42+
```bash
43+
make test
44+
# Or directly:
45+
go test -cover -bench=. -benchmem -race ./... -coverprofile=coverage.out
46+
```
47+
48+
### Run a single test
49+
```bash
50+
go test -run TestFunctionName ./package/...
51+
```
52+
53+
### Generate mocks
54+
```bash
55+
# Uses mockery v2.52.3
56+
mockery --all
57+
```
58+
59+
## Development Notes
60+
61+
- The project uses dependency injection with interfaces for testability
62+
- Mock files follow the pattern `mock_*.go` generated by mockery
63+
- Configuration is stored in TOML format (`sesh.toml`)
64+
- The TUI feature is currently under active development on the `tui` branch
65+
- When editing code, follow existing patterns for error handling, logging, and interface design

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
BUILD_FLAGS="-X 'main.version=`git describe --tags --abbrev=0`'"
44

55
test:
6-
@go test -cover -bench=. -benchmem -race ./... -coverprofile=coverage.out
6+
@mockery && go test -cover -bench=. -benchmem -race ./... -coverprofile=coverage.out
77

88
build:
9-
@go build -ldflags ${BUILD_FLAGS} -o $(shell echo $$GOPATH)/bin/sesh
9+
@go build -ldflags ${BUILD_FLAGS} -o $(shell go env GOPATH)/bin/sesh

README.md

Lines changed: 124 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,24 @@ This will download and install the latest version of Sesh. Make sure that your G
6363

6464
</details>
6565

66+
<details>
67+
<summary>Conda</summary>
68+
69+
To install sesh, run **one** of the following commands, depending on your setup:
70+
71+
* Conda/(micro)mamba users
72+
```sh
73+
# Replace with mamba/micromamba if required
74+
conda -c conda-forge install sesh
75+
```
76+
77+
* Pixi users
78+
```sh
79+
pixi global install sesh
80+
```
81+
82+
</details>
83+
6684
<details>
6785
<summary>Nix</summary>
6886

@@ -72,6 +90,8 @@ See the [nix package directory](https://search.nixos.org/packages?channel=unstab
7290

7391
**Note:** Do you want this on another package manager? [Create an issue](https://github.com/joshmedeski/sesh/issues/new) and let me know!
7492

93+
## Extensions
94+
7595
## Raycast Extension
7696

7797
The [sesh companion extension](https://www.raycast.com/joshmedeski/sesh) for [Raycast](https://www.raycast.com/) makes it easy to use sesh outside of the terminal.
@@ -83,7 +103,45 @@ Here are limitations to keep in mind:
83103

84104
<a title="Install sesh Raycast Extension" href="https://www.raycast.com/joshmedeski/sesh"><img src="https://www.raycast.com/joshmedeski/sesh/[email protected]?v=1.1" height="64" alt="" style="height: 64px;"></a>
85105

86-
## How to use
106+
## Ulauncher Extension
107+
108+
For Linux users using [Ulauncher](https://ulauncher.io/) there are two extensions to use sesh outside the terminal:
109+
- [Sesh Session Manager](https://ext.ulauncher.io/-/github-jacostag-sesh-ulauncher)
110+
- [SESHion Manager](https://ext.ulauncher.io/-/github-mrinfinidy-seshion-manager)
111+
112+
Here are limitations to keep in mind for Sesh Session Manager:
113+
114+
- tmux has to be running before you can use the extension
115+
116+
117+
## Walker launcher usage (Linux)
118+
119+
Create an action directly on $XDG_CONFIG_HOME/config.toml
120+
121+
122+
```
123+
[[plugins]]
124+
name = "sesh"
125+
prefix = ";s "
126+
src_once = "sesh list -d -c -t -T"
127+
cmd = "sesh connect --switch %RESULT%"
128+
keep_sort = false
129+
recalculate_score = true
130+
show_icon_when_single = true
131+
switcher_only = true
132+
```
133+
134+
### For the dmenu mode you can use:
135+
136+
#### Fish shell:
137+
set ssession $(sesh l -t -T -d -H | walker -d -f -k -p "Sesh sessions"); sesh cn --switch $ssession
138+
139+
#### Bash/Zsh:
140+
ssession=$(sesh l -t -T -d -H | walker -d -f -k -p "Sesh sessions"); sesh cn --switch $ssession
141+
142+
##### For dmenu launchers replace walker -dfk with dmenu or rofi)
143+
144+
### How to use
87145

88146
### tmux for sessions
89147

@@ -231,9 +289,39 @@ You may want to blacklist certain tmux sessions from showing up in the results.
231289
blacklist = ["scratch"]
232290
```
233291

292+
### Directory Length
293+
294+
Control how many directory components are used for session names. Default is 1 (only the directory basename).
295+
296+
```toml
297+
dir_length = 2 # Uses last 2 directories: "projects/sesh" instead of just "sesh"
298+
```
299+
234300
> [!NOTE]
235301
> Works great with [tmux-floatx](https://github.com/omerxx/tmux-floax)
236302
303+
### Sorting
304+
305+
If you'd like to change the order of the sessions shown, you can configure `sort_order` in your `sesh.toml` file
306+
307+
```toml
308+
sort_order = [
309+
"tmuxinator", # show first
310+
"config",
311+
"tmux",
312+
"zoxide", # show last
313+
]
314+
```
315+
316+
The default order is `tmux`, `config`, `tmuxinator`, and then `zoxide`.
317+
318+
You can omit session types if you only care about the order of specific ones.
319+
320+
```toml
321+
sort_order = [
322+
"config", # resulting order: config, tmux, tmuxinator, zoxide
323+
]
324+
```
237325
### Default Session
238326

239327
The default session can be configured to run a command when connecting to a session. This is useful for running a dev server or starting a tmux plugin.
@@ -273,6 +361,41 @@ startup_command = "nvim tmux.conf"
273361
preview_command = "bat --color=always ~/c/dotfiles/.config/tmux/tmux.conf"
274362
```
275363

364+
### Path substitution
365+
If you want to use the path of the selected session in your startup or preview command, you can use the `{}` placeholder.
366+
This will be replaced with the session's path when the command is run.
367+
368+
An example of this in use is the following, where the `tmuxinator` default_project uses the path as key/value pair using [ERB syntax](https://github.com/tmuxinator/tmuxinator?tab=readme-ov-file#erb):
369+
```toml
370+
[default_session]
371+
startup_command = "tmuxinator start default_project path={}"
372+
preview_command = "eza --all --git --icons --color=always {}"
373+
```
374+
375+
### Multiple windows
376+
377+
If you want your session to have multiple windows you can define windows in your configuration. You can then use these window layouts in your sessions. These windows can be reused as many times as you want and you can add as many windows to each session as you want.
378+
379+
Note: If you do not specify a path in the window, it will use the session's path.
380+
381+
```toml
382+
[[session]]
383+
name = "Downloads 📥"
384+
path = "~/Downloads"
385+
startup_command = "ls"
386+
387+
[[session]]
388+
name = "tmux config"
389+
path = "~/c/dotfiles/.config/tmux"
390+
startup_command = "nvim tmux.conf"
391+
preview_command = "bat --color=always ~/c/dotfiles/.config/tmux/tmux.conf"
392+
windows = [ "git" ]
393+
394+
[[window]]
395+
name = "git"
396+
startup_script = "git pull"
397+
```
398+
276399
### Listing Configurations
277400

278401
Session configurations will load by default if no flags are provided (the return after tmux sessions and before zoxide results). If you want to explicitly list them, you can use the `-c` flag.

cloner/mock_Cloner.go

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)