summaryrefslogtreecommitdiff
path: root/argv.go
diff options
context:
space:
mode:
Diffstat (limited to 'argv.go')
-rw-r--r--argv.go68
1 files changed, 34 insertions, 34 deletions
diff --git a/argv.go b/argv.go
index a6c4ade..d01841c 100644
--- a/argv.go
+++ b/argv.go
@@ -19,6 +19,14 @@ type PatchCmd struct {
Show string `arg:"--show" help:"show a specific patch"`
}
+type ConfigCmd struct {
+ Add *EmptyCmd `arg:"subcommand:add" help:"add a config setting"`
+ Fix *EmptyCmd `arg:"subcommand:fix" help:"fix .config/forge/ and/or repos.pb protobuf file"`
+ List *EmptyCmd `arg:"subcommand:list" help:"list your config settings"`
+ Delete string `arg:"--delete" help:"delete this repo"`
+ Register string `arg:"--register" help:"register your git URL (foo.com/mystuff) or (github.com/foo/bar)"`
+}
+
type CheckoutCmd struct {
User *FindCmd `arg:"subcommand:user" help:"git checkout user"`
Devel *FindCmd `arg:"subcommand:devel" help:"git checkout devel"`
@@ -35,28 +43,17 @@ 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"`
- Checkout *CheckoutCmd `arg:"subcommand:checkout" help:"switch git branches"`
- 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"`
- DryRun bool `arg:"--dry-run" help:"show what would be run"`
- Fix bool `arg:"--fix" help:"fix config, save config & exit"`
- Delete string `arg:"--delete" help:"delete this repo"`
- URL string `arg:"--connect" help:"gowebd url"`
- Register string `arg:"--register" help:"register your git URL (foo.com/mystuff) or (github.com/foo/bar)"`
- GitReset bool `arg:"--git-reset" help:"run 'git reset --hard'"`
- Scan bool `arg:"--scan" help:"reload protobuf from .git/"`
- Force bool `arg:"--force" help:"force redo things"`
- PatchSet string `arg:"--patchset" help:"make patch set"`
- Apply string `arg:"--apply" help:"apply a patch set"`
- Bash bool `arg:"--bash" help:"generage bash completion"`
- BashAuto []string `arg:"--bash-auto" help:"generage bash completion"`
+ Checkout *CheckoutCmd `arg:"subcommand:checkout" help:"switch git branches"`
+ Config *ConfigCmd `arg:"subcommand:config" help:"show your .config/forge/ settings"`
+ Dirty *EmptyCmd `arg:"subcommand:dirty" help:"check if your git repos are dirty"`
+ GitReset *EmptyCmd `arg:"subcommand:hard-reset" help:"hard reset your user git branch"`
+ List *FindCmd `arg:"subcommand:list" help:"just show a table of the current state"`
+ Patch *PatchCmd `arg:"subcommand:patch" help:"examine and make patch sets"`
+ GitPull *FindCmd `arg:"subcommand:pull" help:"run 'git pull'"`
+ Rescan *EmptyCmd `arg:"subcommand:rescan" help:"recreate the git protobuf repos.pb file"`
+ URL string `arg:"--connect" help:"gowebd url"`
+ Bash bool `arg:"--bash" help:"generate bash completion"`
+ BashAuto []string `arg:"--auto-complete" help:"does the actual autocompletion"`
}
func (args) Version() string {
@@ -68,13 +65,11 @@ func (a args) Description() string {
forge -- in the spirit of things like sourceforge
Examples:
- forge config # shows your forge config (~/.config/forge/)
+ forge # opens the GUI
forge list # show every repo state
- forge dirty # show only dirty repos
+ forge dirty # check for dirty git repos
forge pull # run 'git pull' in every repo
- forge checkout user # git checkout the user branch
- forge checkout devel # git checkout the devel branch
- forge checkout master # git checkout the master branch
+ forge checkout # switch git branches
`
}
@@ -120,13 +115,16 @@ func (args) doBashAuto() {
name := "forge"
argv.doBashHelp()
switch argv.BashAuto[0] {
- case "list":
- fmt.Println("--all --mine --favorites --private")
case "checkout":
fmt.Println("user devel master")
+ case "config":
+ fmt.Println("add fix list delete")
+ case "list":
+ fmt.Println("--all --mine --favorites --private")
+ case "pull":
+ fmt.Println("--all --mine --favorites --private")
case "patch":
fmt.Println("--list --submit --show")
- case "pull":
case "dirty":
case "user":
case "devel":
@@ -134,7 +132,7 @@ func (args) doBashAuto() {
default:
if argv.BashAuto[0] == name {
// list the subcommands here
- fmt.Println("patch checkout list dirty pull")
+ fmt.Println("--bash checkout config dirty hard-reset list patch pull rescan")
}
}
os.Exit(0)
@@ -145,9 +143,9 @@ func (args) doBash() {
name := "forge"
fmt.Println("# add this in your bashrc:")
fmt.Println("")
- fmt.Println("# if we add a 'hidden' go-arg option --bash")
+ fmt.Println("# todo: add this to go-arg as a 'hidden' go-arg option --bash")
fmt.Println("#")
- fmt.Println("# then this is all we have to output:")
+ fmt.Println("# todo: make this output work/parse with:")
fmt.Println("# complete -C " + name + " --bash go")
fmt.Println("")
fmt.Println("_" + name + "_complete()")
@@ -159,7 +157,7 @@ func (args) doBash() {
fmt.Println(" all=${COMP_WORDS[@]}")
fmt.Println("")
fmt.Println(" # this is where we generate the go-arg output")
- fmt.Println(" GOARGS=$(" + name + " --bash-auto $prev \\'$cur\\' $all)")
+ fmt.Println(" GOARGS=$(" + name + " --auto-complete $prev \\'$cur\\' $all)")
fmt.Println("")
fmt.Println(" # this compares the command line input from the user")
fmt.Println(" # to whatever strings we output")
@@ -167,5 +165,7 @@ func (args) doBash() {
fmt.Println(" return 0")
fmt.Println("}")
fmt.Println("complete -F _" + name + "_complete " + name)
+ fmt.Println("")
+ fmt.Println("# copy and paste the above into your bash shell should work")
os.Exit(0)
}