summaryrefslogtreecommitdiff
path: root/argv.go
blob: 5b90fc40f028299ffffa3ee47bcfe94dba38f72b (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
package main

/*
	this parses the command line arguements
*/

var argv args

type FindCmd struct {
	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/"`
	// ReadOnly  bool `arg:"--readonly"                      help:"include read-only repos"`
}

type args struct {
	List         *FindCmd `arg:"subcommand:list"                      help:"just show a table of the current state"`
	Dirty        *FindCmd `arg:"subcommand:dirty"                     help:"check if your git repos are dirty"`
	User         *FindCmd `arg:"subcommand:user"                      help:"git checkout user"`
	Devel        *FindCmd `arg:"subcommand:devel"                     help:"git checkout devel"`
	Master       *FindCmd `arg:"subcommand:master"                    help:"git checkout master"`
	GitPull      *FindCmd `arg:"subcommand:pull"                      help:"run 'git pull'"`
	Config       *FindCmd `arg:"subcommand:config"                    help:"show your .config/forge/ settings"`
	ListPatchSet bool     `arg:"--list-patchset"                      help:"list patch sets"`
	DryRun       bool     `arg:"--dry-run"                            help:"show what would be run"`
	Fix          bool     `arg:"--fix"                                help:"fix config, save config & exit"`
	Delete       string   `arg:"--delete"                             help:"delete this repo"`
	URL          string   `arg:"--connect"                            help:"gowebd url"`
	Register     string   `arg:"--register"                           help:"register your git URL (foo.com/mystuff) or (github.com/foo/bar)"`
	GitReset     bool     `arg:"--git-reset"                          help:"run 'git reset --hard'"`
	Scan         bool     `arg:"--scan"                               help:"reload protobuf from .git/"`
	Force        bool     `arg:"--force"                              help:"force redo things"`
	PatchSet     string   `arg:"--patchset"                           help:"make patch set"`
	Apply        string   `arg:"--apply"                              help:"apply a patch set"`
}

func (args) Version() string {
	return "forge " + VERSION + "    Built on " + BUILDTIME
}

func (a args) Description() string {
	return `
forge -- in the spirit of things like sourceforge

Examples:
	forge --config                               # shows your forge config (~/.config/forge/)
	forge find --all   --pull                    # run 'git pull' in every repo
	forge find --mine  --user                    # checkout the user branch
	forge find --all   --devel                   # checkout the devel branch
	forge find --all   --master                  # checkout the master branch

	`
}