go-clone/argv.go

41 lines
1.8 KiB
Go

package main
/*
this parses the command line arguements
this enables command line options from other packages like 'gui' and 'log'
*/
var argv args
type args struct {
Repo string `arg:"positional" help:"go import path"`
AutoWork bool `arg:"--auto-work" default:"false" help:"auto recreate the go.work file"`
DryRun bool `arg:"--dry-run" help:"show what would be run"`
Recursive bool `arg:"--recursive" default:"false" help:"resursively clone all dependencies"`
Pull bool `arg:"--git-pull" default:"false" help:"run 'git pull' on all your repos"`
Build bool `arg:"--build" default:"true" help:"also try to build it"`
Install bool `arg:"--install" default:"false" help:"try to install every binary package"`
RedoGoMod bool `arg:"--go-reset" default:"false" help:"remake all the go.sum and go.mod files"`
// Fetch bool `arg:"--git-fetch" default:"false" help:"run 'git fetch' on all your repos"`
}
func (args) Version() string {
return "go-clone " + VERSION + " Built on " + BUILDTIME
}
func (a args) Description() string {
return `
git clone go repositories
Examples:
go-clone go.wit.com/apps/go-clone # simply try to git clone this
go-clone --recursive go.wit.com/apps/go-clone # recursively clone all the dependancies
go-clone --auto-work go.wit.com/apps/go-clone # if you are using a go.work file, recreate the go.work file
go-clone --go-reset # recreate every go.mod and go.sum file
go-clone --git-pull # run 'git pull' in every repo
go-clone --build # build every binary package
go-clone --install # install every binary package
`
}