v2.0.0 ae3e752

root.go RawHistoryFolder

1package cmd
2
3import (
4	"fmt"
5	"os"
6
7	"github.com/spf13/cobra"
8	"github.com/spf13/viper"
9)
10
11var cfgFile string
12
13// Version information set by main.go from goreleaser
14var (
15	BuildVersion = "dev"
16	BuildCommit  = "unknown"
17	BuildDate    = "unknown"
18)
19
20var rootCmd = &cobra.Command{
21	Use:   "gordon",
22	Short: "Gordon - Container Registry & Deployment System",
23	Long: `Gordon is a single-binary application that combines a container registry 
24with an intelligent reverse proxy and automated deployment system.`,
25}
26
27func Execute() error {
28	return rootCmd.Execute()
29}
30
31// SetVersionInfo sets the build information from main.go
32func SetVersionInfo(version, commit, date string) {
33	BuildVersion = version
34	BuildCommit = commit
35	BuildDate = date
36}
37
38func init() {
39	cobra.OnInitialize(initConfig)
40	rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is ./gordon.toml)")
41}
42
43func initConfig() {
44	if cfgFile != "" {
45		viper.SetConfigFile(cfgFile)
46	} else {
47		// Search for config file in standard locations
48		viper.SetConfigName("gordon")
49		viper.SetConfigType("toml")
50		
51		// Current directory (highest priority)
52		viper.AddConfigPath(".")
53		
54		// User config directory
55		if userConfigDir, err := os.UserConfigDir(); err == nil {
56			viper.AddConfigPath(userConfigDir + "/gordon")
57		}
58		
59		// User home directory
60		if homeDir, err := os.UserHomeDir(); err == nil {
61			viper.AddConfigPath(homeDir + "/.gordon")
62			viper.AddConfigPath(homeDir)
63		}
64		
65		// System-wide config directories
66		viper.AddConfigPath("/etc/gordon")
67		viper.AddConfigPath("/usr/local/etc/gordon")
68	}
69
70	viper.AutomaticEnv()
71
72	if err := viper.ReadInConfig(); err == nil {
73		fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed())
74	} else {
75		if cfgFile != "" {
76			fmt.Fprintf(os.Stderr, "Error reading config file: %v\n", err)
77		}
78		// Don't fatal for version command - config not needed
79		// Other commands will check for config when needed
80	}
81}

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