blob: b0d3799a4f7e2f7b5e58225fee81beafad9a90c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
  | 
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0
package main
/*
	this parses the command line arguements using alex flint's go-arg
*/
var argv args
type args struct {
	Show        *ShowCmd     `arg:"subcommand:show"                      help:"show tables"`
	Commit      *CommitCmd   `arg:"subcommand:commit"                    help:"'git commit'"`
	Merge       *MergeCmd    `arg:"subcommand:merge"                     help:"merge branches"`
	Rebuild     *RebuildCmd  `arg:"subcommand:rebuild"                   help:"download all the forge sources and rebuild forge"`
	Generate    *GenerateCmd `arg:"subcommand:generate"                  help:"helps run autogenpb in repos with .proto files"`
	Clean       *EmptyCmd    `arg:"subcommand:clean"                     help:"'git clean' + reset repos to original state"`
	Pull        *PullCmd     `arg:"subcommand:pull"                      help:"'git pull'"`
	Normal      *EmptyCmd    `arg:"subcommand:normal"                    help:"shortcut to 'forge mode normal'"`
	Patch       *PatchCmd    `arg:"subcommand:patch"                     help:"work with patches"`
	Dev         *DevCmd      `arg:"subcommand:dev"                       help:"features under development"`
	Mode        *ModeCmd     `arg:"subcommand:mode"                      help:"sets the mode (hacking, merging, publishing)"`
	Cache       *CacheCmd    `arg:"subcommand:cache"                     help:"chose the cache of repos to work with"`
	Config      *ConfigCmd   `arg:"subcommand:config"        help:"show your .config/forge/ settings"`
	Add         *EmptyCmd    `arg:"subcommand:add"                       help:"Scan directores for git repos"`
	Whatchanged *EmptyCmd    `arg:"subcommand:whatchanged"               `
	All         bool         `arg:"--all"                                help:"whatever you are doing, do it all over"`
	Force       bool         `arg:"--force"                              help:"try to strong-arm things"`
	Verbose     bool         `arg:"--verbose"                            help:"show more output than usual"`
	Fix         bool         `arg:"--fix"                                help:"try to make repairs"`
	// Gui         *EmptyCmd    `arg:"subcommand:gui"                       help:"open the gui"`
}
type EmptyCmd struct {
}
type testCmd string
type ShowCmd struct {
	Dirty *EmptyCmd `arg:"subcommand:dirty"                     help:"show dirty git repos"`
	Mtime *EmptyCmd `arg:"subcommand:mtime"                     help:"show mtime changes"`
	ENV   *EmptyCmd `arg:"subcommand:ENV"                       help:"show lib/env"`
	Tag   *TagCmd   `arg:"subcommand:tag"                       help:"show the git tag table"`
	Repo  *RepoCmd  `arg:"subcommand:repos"                     help:"show repos by type. deprecate."`
	// MasterDefault *EmptyCmd `arg:"subcommand:masterdefault"             help:"run the default behavior for master branches"`
}
type RebuildCmd struct {
	Forge     *EmptyCmd `arg:"subcommand:forge"                     help:"rebuild forge"`
	GoClone   *EmptyCmd `arg:"subcommand:go-clone"                  help:"rebuild go-clone"`
	Autogenpb *EmptyCmd `arg:"subcommand:autogenpb"                 help:"rebuild autogenpb"`
}
type FixCmd struct {
	Porcelain  *EmptyCmd `arg:"subcommand:porcelain"                 help:"git status --porcelain"`
	Urls       bool      `arg:"--urls"                               help:"check for changes in repo urls"`
	Untracked  bool      `arg:"--untracked"                          help:"git untracked file list"`
	DeleteUser bool      `arg:"--delete-user"                        help:"delete all user branches (checks for safety)"`
	Prune      bool      `arg:"--prune"                              help:"'git fetch --prune' everywhere"`
}
type VerifyCmd struct {
	DryRun bool `arg:"--dry-run"                          help:"try not to change anything"`
}
type StatsCmd struct {
	All   bool `arg:"--all"                              help:"process all stats"`
	Sizes bool `arg:"--sizes"                            help:"show sizes"`
	List  bool `arg:"--list"                             help:"list all stats"`
}
func (ShowCmd) Examples() string {
	return "forge show dirty\nforge show repos --all"
}
type RepoCmd struct {
	Urls      *EmptyCmd `arg:"subcommand:urls"                 help:"show repo urls"`
	All       bool      `arg:"--all"                           help:"select every repo (the default)"`
	Mine      bool      `arg:"--mine"                          help:"your repos as defined in the forge config"`
	Favorites bool      `arg:"--favorites"                     help:"your repos configured as favorites"`
	Private   bool      `arg:"--private"                       help:"your private repos from your .config/forge/"`
	User      bool      `arg:"--user"                          help:"show repos on the user branch"`
	Full      bool      `arg:"--full"                          help:"show full repo names"`
}
type ModeCmd struct {
	Master *EmptyCmd `arg:"subcommand:master"              help:"keep all repos on the master branch"`
	Devel  *EmptyCmd `arg:"subcommand:devel"               help:"use devel branches"`
	User   *EmptyCmd `arg:"subcommand:user"                help:"use user branches"`
	Normal *EmptyCmd `arg:"subcommand:normal"              help:"use the 'normal' forge development mode"`
	Clean  *EmptyCmd `arg:"subcommand:clean"               help:"clean mode. removes everything to origin/HEAD"`
	Config string    `arg:"--config"                       help:"select which config to use"`
	// Config *EmptyCmd `arg:"subcommand:config"              help:"select which config to use"`
}
type CommitCmd struct {
	All bool `arg:"--all"                             help:"git commit in all dirty repos"`
}
type DevCmd struct {
	Build     *EmptyCmd `arg:"subcommand:build"               help:"build this repo"`
	Install   *EmptyCmd `arg:"subcommand:install"             help:"build & install this repo"`
	GoWork    *EmptyCmd `arg:"subcommand:gowork"              help:"make a go.work"`
	Fixer     *FixCmd   `arg:"subcommand:fixer"               help:"send in the fixer"`
	URL       string    `arg:"--connect"                      help:"forge url"`
	Stats     *StatsCmd `arg:"subcommand:stats"               help:"generate origin.pb"`
	Namespace *EmptyCmd `arg:"subcommand:namespace"           help:"check the namespaces"`
}
type GenerateCmd struct {
	Make    *EmptyCmd `arg:"subcommand:make"                help:"make all the autogenerated files"`
	Clean   *EmptyCmd `arg:"subcommand:clean"               help:"clean out all the autogenerated files"`
	Verbose bool      `arg:"--verbose"                 help:"be verbose about it"`
	Strict  bool      `arg:"--strict"                  help:"die if any namespaces are missing"`
}
type CacheCmd struct {
	Filename string `arg:"positional"`
}
type CleanDevelCmd struct {
	Force bool `arg:"--force"                         help:"try to strong arm things"`
}
type PatchCmd struct {
	Apply  bool `arg:"--apply"                   help:"attempt to apply any new patches"`
	Show   bool `arg:"--show"                    help:"show the current patches"`
	Submit bool `arg:"--resubmit"                help:"resubmit your git commits"`
}
type PullCmd struct {
	Force  bool      `arg:"--force"                   help:"try to strong-arm things"`
	List   *EmptyCmd `arg:"subcommand:list"           help:"list repo versions"`
	Check  *RepoCmd  `arg:"subcommand:check"          help:"check for repo changes"`
	Update *EmptyCmd `arg:"subcommand:update"         help:"report updates"`
}
type TagCmd struct {
	List   *EmptyCmd `arg:"subcommand:list"           help:"list the tags"`
	Clean  *EmptyCmd `arg:"subcommand:clean"          help:"clean out old and duplicate tags"`
	Delete string    `arg:"--delete"                  help:"delete a tag"`
}
type MergeCmd struct {
	All     bool      `arg:"--all"                    help:"merge all user branches to devel and master"`
	Devel   *EmptyCmd `arg:"subcommand:devel"         help:"merge user to devel"`
	Master  *EmptyCmd `arg:"subcommand:master"        help:"merge devel to master"`
	Publish *EmptyCmd `arg:"subcommand:publish"       help:"increment versions and publish master branch"`
	Check   *EmptyCmd `arg:"subcommand:check"         help:"check if merge is complete and ready to publish"`
}
type ConfigCmd struct {
	Add      *ConfigAddCmd `arg:"subcommand:add"      help:"add a config setting"`
	List     *EmptyCmd     `arg:"subcommand:list"     help:"list your config settings"`
	Delete   string        `arg:"--delete"            help:"delete this repo"`
	Register string        `arg:"--register"          help:"register your git URL (foo.com/mystuff) or (github.com/foo/bar)"`
}
type ConfigAddCmd struct {
	Path        string `arg:"--path"                            help:"absolute path of the git repo"`
	Namespace   string `arg:"--namespace"                       help:"namespace of the git repo"`
	Directory   bool   `arg:"--directory"                       help:"repo is a directory to match against"`
	ReadOnly    bool   `arg:"--readonly"                        help:"repo is readonly"`
	Writable    bool   `arg:"--writable"                        help:"repo is writable"`
	Favorite    bool   `arg:"--favorite"                        help:"forge will always go-clone or git clone this" default:"false"`
	Private     bool   `arg:"--private"      default:"false"    help:"repo can not be published"`
	Interesting bool   `arg:"--interesting"  default:"false"    help:"something you decided was cool"`
	DebName     string `arg:"--debname"                         help:"the name of the debian package (or rpm, etc)"`
	Master      string `arg:"--master"                          help:"the git 'master' or 'main' branch name"`
	Devel       string `arg:"--devel"                           help:"the git devel branch name"`
	User        string `arg:"--user"                            help:"the git user branch name"`
}
  |