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

import (
	"os"

	"go.wit.com/lib/gui/prep"
)

/*
	this parses the command line arguements

	this enables command line options from other packages like 'gui' and 'log'
*/

type args struct {
	Quick     *QuickCmd `arg:"subcommand:quick"                  help:"only do repos with patches"`
	DryRun    bool      `arg:"--dry-run,env:DRYRUN"              help:"don't actually do the release"`
	Minor     bool      `arg:"--minor"                           help:"increment minor verion numbers"`
	Protobuf  bool      `arg:"--protobuf"                        help:"increment protobuf repos"`
	KeepGOMOD bool      `arg:"--keep-gomod"                      help:"keep go.* and *.pb.go files in master"`
	Verbose   bool      `arg:"--verbose"                         help:"talk alot"`
	Full      bool      `arg:"--full"                            help:"build every package"`
	Reason    string    `arg:"--reason"                          help:"tag message"`
	Force     bool      `arg:"--force"                           help:"try harder than normal"`
	AutoRun   bool      `arg:"--auto-run"                        help:"automatically process everything"`
	Port      int       `arg:"--port"     default:"9419"         help:"do fun stuff with curl"`
}

func (args) Examples() string {
	var out string
	out += "guireleaser --full    # release everything\n"
	return out
}

type QuickCmd struct {
	List   *EmptyCmd `arg:"subcommand:list"          help:"list available patches"`
	Show   *EmptyCmd `arg:"subcommand:show"          help:"show a specific patch"`
	NoLibs *EmptyCmd `arg:"subcommand:show"          help:"skip libraries that aren't changed"`
}

type EmptyCmd struct {
}

func (a args) Description() string {
	return `
Example usage:
	guireleaser go.wit.com/apps/go-clone --increment --release --dry-run --reason "blerg"

This will pull down the go sources and
the repositories in the go.sum file using git clone`
}

func (args) Version() string {
	return "guireleaser " + VERSION
}

/*
	handles shell autocomplete
*/

func (args) Appname() string {
	return ARGNAME
}

func (args) Buildtime() (string, string) {
	return BUILDTIME, VERSION
}

func (a args) DoAutoComplete(pb *prep.Auto) {
	if pb.Cmd == "" {
		pb.Autocomplete3([]string{"--bash", "quick", "--dry-run", "--full", "--reason", "--version", "--auto-run", "--keep-gomod"})
	} else {
		pb.SubCommand(pb.Goargs...)
	}
	os.Exit(0)
}