summaryrefslogtreecommitdiff
path: root/argv.go
diff options
context:
space:
mode:
Diffstat (limited to 'argv.go')
-rw-r--r--argv.go97
1 files changed, 46 insertions, 51 deletions
diff --git a/argv.go b/argv.go
index 173cbb5..6242e8f 100644
--- a/argv.go
+++ b/argv.go
@@ -33,19 +33,22 @@ type args struct {
}
type ShowCmd struct {
- Dirty *EmptyCmd `arg:"subcommand:dirty" help:"show dirty git repos"`
- List *EmptyCmd `arg:"subcommand:list" help:"print a table of the current repos"`
- Tag *TagCmd `arg:"subcommand:tag" help:"manage git tags"`
- Build string `arg:"--build" help:"build a repo"`
- Install string `arg:"--install" help:"install a repo"`
- BuildForge bool `arg:"--forge-rebuild" help:"download and rebuild forge"`
- URL string `arg:"--connect" help:"forge url"`
- 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"`
+ Dirty *EmptyCmd `arg:"subcommand:dirty" help:"show dirty git repos"`
+ Repo *RepoCmd `arg:"subcommand:repo" help:"print a table of the current repos"`
+ Tag *TagCmd `arg:"subcommand:tag" help:"show git tags"`
+ // Build string `arg:"--build" help:"build a repo"`
+ // Install string `arg:"--install" help:"install a repo"`
+ // BuildForge bool `arg:"--forge-rebuild" help:"download and rebuild forge"`
+ // URL string `arg:"--connect" help:"forge url"`
+}
+
+type RepoCmd 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/"`
+ User bool `arg:"--user" help:"show repos on the user branch"`
+ Full bool `arg:"--full" help:"show full repo names"`
// ReadOnly bool `arg:"--readonly" help:"include read-only repos"`
}
@@ -65,8 +68,8 @@ type CommitCmd struct {
type testCmd string
type CleanCmd struct {
- Verify *EmptyCmd `arg:"subcommand:verify" help:"rescan repo"`
- Repo string `arg:"--repo" help:"which repo to look at"`
+ // Verify *EmptyCmd `arg:"subcommand:verify" help:"rescan repo"`
+ // Repo string `arg:"--repo" help:"which repo to look at"`
}
type CleanDevelCmd struct {
@@ -87,9 +90,10 @@ type SubmitCmd struct {
}
type PullCmd struct {
- Check *EmptyCmd `arg:"subcommand:check" help:"check repo versions"`
- Dirty *EmptyCmd `arg:"subcommand:dirty" help:"only check dirty repos"`
- Patches *EmptyCmd `arg:"subcommand:patches" help:"only check repos with patches"`
+ Force bool `arg:"--force" help:"try to strong-arm things"`
+ // Check *EmptyCmd `arg:"subcommand:check" help:"check repo versions"`
+ // Dirty *EmptyCmd `arg:"subcommand:dirty" help:"only check dirty repos"`
+ // Patches *EmptyCmd `arg:"subcommand:patches" help:"only check repos with patches"`
}
type TagCmd struct {
@@ -98,21 +102,6 @@ type TagCmd struct {
Delete string `arg:"--delete" help:"delete a tag"`
}
-type ConfigAddCmd struct {
- Path string `arg:"--path" help:"absolute path of the git repo"`
- GoPath string `arg:"--gopath" help:"GO path of the git repo"`
- Directory bool `arg:"--directory" default:"false" help:"repo is a directory to match against"`
- ReadOnly bool `arg:"--readonly" default:"false" help:"repo is readonly"`
- Writable bool `arg:"--writable" default:"false" help:"repo is writable"`
- Favorite bool `arg:"--favorite" default:"false" help:"forge will always go-clone or git clone this"`
- 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"`
-}
-
type CheckoutCmd struct {
User *EmptyCmd `arg:"subcommand:user" help:"git checkout user"`
Devel *EmptyCmd `arg:"subcommand:devel" help:"git checkout devel"`
@@ -120,9 +109,10 @@ type CheckoutCmd struct {
}
type MergeCmd struct {
+ All bool `arg:"--all" help:"merge all"`
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"`
+ Publish *EmptyCmd `arg:"subcommand:publish" help:"increment versions and publish master branch"`
}
type ConfigCmd struct {
@@ -133,6 +123,21 @@ type ConfigCmd struct {
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"`
+ GoPath string `arg:"--gopath" help:"GO path of the git repo"`
+ Directory bool `arg:"--directory" default:"false" help:"repo is a directory to match against"`
+ ReadOnly bool `arg:"--readonly" default:"false" help:"repo is readonly"`
+ Writable bool `arg:"--writable" default:"false" help:"repo is writable"`
+ Favorite bool `arg:"--favorite" default:"false" help:"forge will always go-clone or git clone this"`
+ 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"`
+}
+
func (args) Version() string {
return ARGNAME + " " + VERSION + " Built on " + BUILDTIME
}
@@ -163,21 +168,6 @@ forge -- a tool to manage lots of git repos. forge includes a GUI and TUI.
`
}
-// handles shell autocomplete
-func DoAutoComplete(pb *prep.Auto) {
- switch pb.Cmd {
- case "show":
- pb.SubCommand(pb.Cmd)
- default:
- if pb.Cmd == "" {
- pb.Autocomplete2("checkout clean commit normal merge show")
- } else {
- pb.SubCommand(pb.Cmd)
- }
- }
- os.Exit(0)
-}
-
func (args) Appname() string {
return ARGNAME
}
@@ -190,6 +180,11 @@ func ifBlank(arg string) bool {
return false
}
-func (a args) DoAutoComplete(autoArgv *prep.Auto) {
- DoAutoComplete(autoArgv)
+func (a args) DoAutoComplete(pb *prep.Auto) {
+ if pb.Cmd == "" {
+ pb.Autocomplete3([]string{"checkout", "clean", "commit", "config", "gui", "merge", "normal", "patch", "pull", "show"})
+ } else {
+ pb.SubCommand(pb.Argv...)
+ }
+ os.Exit(0)
}