v0.26.0 ae3a77a

session.go RawHistoryFolder

1package logging
2
3import (
4	"crypto/rand"
5	"encoding/hex"
6	"time"
7)
8
9// GenerateSessionID creates a unique session identifier.
10// Format: YYYYMMDD_HHMMSS_xxxx (timestamp + 4 random hex chars)
11// Example: 20251217_205106_a7b3
12func GenerateSessionID() string {
13	now := time.Now()
14	random := make([]byte, 2)
15	_, _ = rand.Read(random)
16	return now.Format("20060102_150405") + "_" + hex.EncodeToString(random)
17}
18
19// ShortSessionID extracts the short ID (last 4 hex chars) from a full session ID.
20// Example: "20251217_205106_a7b3" -> "a7b3"
21func ShortSessionID(sessionID string) string {
22	if len(sessionID) < 4 {
23		return sessionID
24	}
25	return sessionID[len(sessionID)-4:]
26}
27
28// ParseSessionFilename extracts session info from a log filename.
29// Example: "session_20251217_205106_a7b3.log" -> "20251217_205106_a7b3", true
30func ParseSessionFilename(filename string) (sessionID string, ok bool) {
31	const prefix = "session_"
32	const suffix = ".log"
33
34	if len(filename) < len(prefix)+len(suffix) {
35		return "", false
36	}
37	if filename[:len(prefix)] != prefix {
38		return "", false
39	}
40	if filename[len(filename)-len(suffix):] != suffix {
41		return "", false
42	}
43
44	return filename[len(prefix) : len(filename)-len(suffix)], true
45}
46
47// SessionFilename generates the log filename for a session ID.
48// Example: "20251217_205106_a7b3" -> "session_20251217_205106_a7b3.log"
49func SessionFilename(sessionID string) string {
50	return "session_" + sessionID + ".log"
51}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close