diff options
Diffstat (limited to 'argv.go')
| -rw-r--r-- | argv.go | 41 |
1 files changed, 28 insertions, 13 deletions
@@ -19,13 +19,9 @@ import ( var argv args type args struct { - Pull *EmptyCmd `arg:"subcommand:pull" help:"'git pull' on the repos"` - List *EmptyCmd `arg:"subcommand:list" help:"list the repos"` - Clean *EmptyCmd `arg:"subcommand:clean" help:"clean the repos"` + Repos *ReposCmd `arg:"subcommand:repos" help:"the forged repos"` + Patch *PatchCmd `arg:"subcommand:patches" help:"the forged patches"` Gui *EmptyCmd `arg:"subcommand:gui" help:"show gui"` - Merge *EmptyCmd `arg:"subcommand:merge" help:"merge in new patchsets"` - Init *EmptyCmd `arg:"subcommand:init" help:"init the repo list"` - Repos *EmptyCmd `arg:"subcommand:repos" help:"show the repos"` Port int `arg:"--port" default:"2520" help:"port to run on"` Hostname string `arg:"--hostname" help:"hostname to use"` Daemon bool `arg:"--daemon" help:"run as a daemon"` @@ -36,10 +32,28 @@ type args struct { type EmptyCmd struct { } +type PatchCmd struct { + List *EmptyCmd `arg:"subcommand:list" help:"list the patches"` + Clean *EmptyCmd `arg:"subcommand:clean" help:"clean the patches"` + Init *EmptyCmd `arg:"subcommand:init" help:"init"` +} + +type ReposCmd struct { + List *EmptyCmd `arg:"subcommand:list" help:"list the repos"` + Pull *EmptyCmd `arg:"subcommand:pull" help:"'git pull' on the repos"` + Clean *EmptyCmd `arg:"subcommand:clean" help:"clean the repos"` + Merge *EmptyCmd `arg:"subcommand:merge" help:"merge in new patchsets"` + Init *EmptyCmd `arg:"subcommand:init" help:"init the repo list"` +} + func (args) Appname() string { return ARGNAME } +func (args) Buildtime() (string, string) { + return BUILDTIME, VERSION +} + func (args) Version() string { parts := strings.Split(BUILDTIME, ".") if len(parts) == 1 { @@ -73,14 +87,15 @@ func (args) Version() string { return ARGNAME + " " + VERSION + " Built on " + BUILDTIME } +/* + handles shell autocomplete +*/ + func (a args) DoAutoComplete(pb *prep.Auto) { - switch pb.Cmd { - case "list": - pb.Autocomplete2("--missing") - case "clean": - pb.Autocomplete2("") - default: - pb.Autocomplete2("list clean") + if pb.Cmd == "" { + pb.Autocomplete3([]string{"--bash", "repos", "gui", "patches", "--daemon"}) + } else { + pb.SubCommand(pb.Argv...) } os.Exit(0) } |
