v0.3.35 a159f47

args_test.go RawHistoryFolder

1package agent
2
3import "testing"
4
5func TestParseArgsTemperatureAllowsZero(t *testing.T) {
6	args, err := ParseArgs([]string{"--temperature", "0"})
7	if err != nil {
8		t.Fatalf("ParseArgs returned %v", err)
9	}
10	if args.Temperature == nil || *args.Temperature != 0 {
11		t.Fatalf("Temperature = %v; want 0", args.Temperature)
12	}
13}
14
15func TestParseArgsTemperatureRejectsOutOfRange(t *testing.T) {
16	if _, err := ParseArgs([]string{"--temperature", "2.1"}); err == nil {
17		t.Fatal("ParseArgs accepted out-of-range temperature")
18	}
19}
20
21func TestParseArgsYes(t *testing.T) {
22	for _, flag := range []string{"-y", "--yes"} {
23		args, err := ParseArgs([]string{flag, "--print", "hi"})
24		if err != nil {
25			t.Fatalf("ParseArgs(%q): %v", flag, err)
26		}
27		if !args.Yes {
28			t.Fatalf("ParseArgs(%q): Yes = false", flag)
29		}
30		if args.Mode != ModePrint || args.Prompt != "hi" {
31			t.Fatalf("ParseArgs(%q): Mode=%q Prompt=%q", flag, args.Mode, args.Prompt)
32		}
33	}
34}
35
36func TestParseArgsStatsRequiresPrintMode(t *testing.T) {
37	args, err := ParseArgs([]string{"-p", "--stats", "stats.json", "hi"})
38	if err != nil {
39		t.Fatal(err)
40	}
41	if args.StatsPath != "stats.json" || args.Mode != ModePrint {
42		t.Fatalf("StatsPath=%q Mode=%q", args.StatsPath, args.Mode)
43	}
44
45	if _, err := ParseArgs([]string{"--stats", "stats.json", "hi"}); err == nil {
46		t.Fatal("ParseArgs accepted --stats without print mode")
47	}
48}
49
50func TestParseArgsStream(t *testing.T) {
51	args, err := ParseArgs([]string{"--stream", "hi"})
52	if err != nil {
53		t.Fatal(err)
54	}
55	if args.Mode != ModeStream || args.Prompt != "hi" {
56		t.Fatalf("Mode=%q Prompt=%q", args.Mode, args.Prompt)
57	}
58}

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 1

Tags 476

↑↓ moveenter openesc close