forge/argv.go

54 lines
2.8 KiB
Go
Raw Normal View History

2024-12-02 06:59:56 -06:00
package main
/*
this parses the command line arguements
*/
var argv args
2024-12-24 01:54:33 -06:00
type FindCmd struct {
2024-12-27 04:36:29 -06:00
All bool `arg:"--all" help:"select every repo (the default)"`
2024-12-24 01:54:33 -06:00
Mine bool `arg:"--mine" help:"your repos as defined in the forge config"`
Favorites bool `arg:"--favorites" help:"your repos configured as favorites"`
2024-12-27 04:36:29 -06:00
Private bool `arg:"--private" help:"your private repos from your .config/forge/"`
// ReadOnly bool `arg:"--readonly" help:"include read-only repos"`
2024-12-24 01:54:33 -06:00
}
2024-12-02 06:59:56 -06:00
type args struct {
2024-12-27 03:39:53 -06:00
List *FindCmd `arg:"subcommand:list" help:"just show a table of the current state"`
2024-12-27 04:36:29 -06:00
Dirty *FindCmd `arg:"subcommand:dirty" help:"check if your git repos are dirty"`
2024-12-27 03:39:53 -06:00
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"`
GitPull *FindCmd `arg:"subcommand:pull" help:"run 'git pull'"`
2024-12-27 04:36:29 -06:00
Config *FindCmd `arg:"subcommand:config" help:"show your .config/forge/ settings"`
2024-12-24 02:26:54 -06:00
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)"`
2024-12-27 04:36:29 -06:00
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"`
2024-12-02 06:59:56 -06:00
}
func (args) Version() string {
return "forge " + VERSION + " Built on " + BUILDTIME
}
func (a args) Description() string {
return `
forge -- in the spirit of things like sourceforge
Examples:
2024-12-24 02:26:54 -06:00
forge --config # shows your forge config (~/.config/forge/)
2024-12-25 23:17:24 -06:00
forge find --all --pull # run 'git pull' in every repo
forge find --mine --user # checkout the user branch
2024-12-24 02:26:54 -06:00
forge find --all --devel # checkout the devel branch
forge find --all --master # checkout the master branch
2024-12-05 12:29:47 -06:00
2024-12-23 11:15:16 -06:00
`
2024-12-02 06:59:56 -06:00
}