2.0.1 dcf7d6b

root.go RawHistoryFolder

1package cmd
2
3import (
4	"fmt"
5	"os"
6
7	"github.com/rs/zerolog/log"
8	"github.com/spf13/cobra"
9	"github.com/spf13/viper"
10)
11
12var cfgFile string
13
14var rootCmd = &cobra.Command{
15	Use:   "gordon",
16	Short: "Gordon - Container Registry & Deployment System",
17	Long: `Gordon is a single-binary application that combines a container registry 
18with an intelligent reverse proxy and automated deployment system.`,
19}
20
21func Execute() error {
22	return rootCmd.Execute()
23}
24
25func init() {
26	cobra.OnInitialize(initConfig)
27	rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is ./gordon.toml)")
28}
29
30func initConfig() {
31	if cfgFile != "" {
32		viper.SetConfigFile(cfgFile)
33	} else {
34		// Search for config file in standard locations
35		viper.SetConfigName("gordon")
36		viper.SetConfigType("toml")
37		
38		// Current directory (highest priority)
39		viper.AddConfigPath(".")
40		
41		// User config directory
42		if userConfigDir, err := os.UserConfigDir(); err == nil {
43			viper.AddConfigPath(userConfigDir + "/gordon")
44		}
45		
46		// User home directory
47		if homeDir, err := os.UserHomeDir(); err == nil {
48			viper.AddConfigPath(homeDir + "/.gordon")
49			viper.AddConfigPath(homeDir)
50		}
51		
52		// System-wide config directories
53		viper.AddConfigPath("/etc/gordon")
54		viper.AddConfigPath("/usr/local/etc/gordon")
55	}
56
57	viper.AutomaticEnv()
58
59	if err := viper.ReadInConfig(); err == nil {
60		fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed())
61	} else {
62		if cfgFile != "" {
63			fmt.Fprintf(os.Stderr, "Error reading config file: %v\n", err)
64		} else {
65			log.Fatal().Msg("config file not found - please specify with --config flag or ensure gordon.toml exists in current directory")
66		}
67	}
68}

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 7

Tags 106

↑↓ moveenter openesc close