main ece7682

web_options.go RawHistoryFolder

1package app
2
3import (
4	"fmt"
5	"strings"
6
7	"github.com/bnema/vev/internal/adapters/config"
8	"github.com/bnema/vev/internal/adapters/webterm"
9	"github.com/bnema/vev/internal/domain"
10	"github.com/bnema/vev/internal/platform"
11)
12
13type webOptions struct {
14	listen string
15	origin string
16}
17
18func parseWebArgs(args []string) (command, error) {
19	cmd := command{kind: kindWebDaemon}
20	if args[0] == "--web-serve" {
21		cmd.kind = kindWebServe
22	}
23	for i := 1; i < len(args); i++ {
24		key, value, inline := strings.Cut(args[i], "=")
25		if key != "--web-listen" && key != "--web-origin" {
26			return command{}, usagef("unexpected web argument %q", key)
27		}
28		if !inline {
29			i++
30			if i == len(args) {
31				return command{}, usagef("%s requires a value", key)
32			}
33			value = args[i]
34		}
35		if value == "" || strings.HasPrefix(value, "--") {
36			return command{}, usagef("%s requires a value", key)
37		}
38		if key == "--web-listen" {
39			cmd.web.listen = value
40		} else {
41			cmd.web.origin = value
42		}
43	}
44	return cmd, nil
45}
46
47func loadWebSettings(options webOptions) (webterm.Settings, []domain.Warning, error) {
48	cfg, warnings, err := config.Load(platform.ConfigPath())
49	if err != nil {
50		return webterm.Settings{}, nil, fmt.Errorf("loading web configuration: %w", err)
51	}
52	if options.listen != "" {
53		cfg.WebListen = options.listen
54	}
55	if options.origin != "" {
56		cfg.WebOrigin = options.origin
57	}
58	settings, err := webterm.ParseSettings(cfg.WebListen, cfg.WebOrigin)
59	if err != nil {
60		return webterm.Settings{}, warnings, err
61	}
62	return settings, warnings, nil
63}

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 12

Tags 11

↑↓ moveenter openesc close