diff options
Diffstat (limited to 'argv.go')
| -rw-r--r-- | argv.go | 64 |
1 files changed, 23 insertions, 41 deletions
@@ -35,13 +35,13 @@ type FindCmd struct { } type args struct { - List *FindCmd `arg:"subcommand:list" help:"just show a table of the current state"` - Dirty *EmptyCmd `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"` + List *FindCmd `arg:"subcommand:list" help:"just show a table of the current state"` + Dirty *EmptyCmd `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"` Checkout *CheckoutCmd `arg:"subcommand:checkout" help:"switch git branches"` - Pathc *PatchCmd `arg:"subcommand:patch" help:"examine and make patch sets"` + Patch *PatchCmd `arg:"subcommand:patch" help:"examine and make patch sets"` 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"` @@ -90,6 +90,16 @@ func (args) doBashHelp() { // if this is not the name of the command, the user already started doing something return } + if argv.BashAuto[0] == name { + me.pp.WriteHelp(os.Stderr) + return + } + fmt.Fprintln(os.Stderr, "") + fmt.Fprintln(os.Stderr, "hello world") + fmt.Fprintln(os.Stderr, "") +} + +func (args) doBashHelpDebug() { fmt.Fprintln(os.Stderr, "") fmt.Fprintln(os.Stderr, "hello world") var more string @@ -110,55 +120,27 @@ func (args) doBashAuto() { name := "forge" argv.doBashHelp() switch argv.BashAuto[0] { - case "dirty": - fmt.Println("") case "list": fmt.Println("--all --mine --favorites --private") - case "user": - case "devel": - fmt.Println("reset --mine") case "checkout": fmt.Println("user devel master") - case "patches": + case "patch": fmt.Println("--list --submit --show") + case "pull": + case "dirty": + case "user": + case "devel": + case "master": default: if argv.BashAuto[0] == name { // list the subcommands here - fmt.Println("--bash patches checkout list dirty pull user devel master") + fmt.Println("patch checkout list dirty pull") } } os.Exit(0) } // complete -F forge --bash forge -func (args) doBashNotes() { - fmt.Println("#/usr/bin/env bash") - fmt.Println("") - fmt.Println("# if we add a 'hidden' go-arg option --bash") - fmt.Println("#") - fmt.Println("# then this is all we have to output:") - fmt.Println("# complete -C forge --bash go") - fmt.Println("") - fmt.Println("_forge_complete()") - fmt.Println("{") - fmt.Println(" # sets local to this func vars") - fmt.Println(" local cur prev all") - fmt.Println(" cur=${COMP_WORDS[COMP_CWORD]}") - fmt.Println(" prev=${COMP_WORDS[COMP_CWORD-1]}") - fmt.Println(" all=${COMP_WORDS[@]}") - fmt.Println("") - fmt.Println(" # this is where we generate the go-arg output") - fmt.Println(" FORGE=$(forge --bash-auto -- $prev \\'$cur\\' $all)") - fmt.Println("") - fmt.Println(" # this compares the command line input from the user") - fmt.Println(" # to whatever strings we output") - fmt.Println(" COMPREPLY=( $(compgen -W \"$FORGE\" -- $cur) ) # THIS WORKS") - fmt.Println(" return 0") - fmt.Println("}") - os.Exit(0) -} - -// complete -F forge --bash forge func (args) doBash() { name := "forge" fmt.Println("# add this in your bashrc:") |
