diff options
| author | Jeff Carr <[email protected]> | 2025-10-05 07:35:57 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-05 07:35:57 -0500 |
| commit | e8857d62d91538e0760c50c5e1a68eaa16caf309 (patch) | |
| tree | ed5a5a2526ed0025a450e28c7d177f8bfbd7b5d0 /argv.go | |
| parent | b65fe9b53c549ba63ec390b2fb2950345ed1fdb9 (diff) | |
a binary to replace aptly
Diffstat (limited to 'argv.go')
| -rw-r--r-- | argv.go | 50 |
1 files changed, 50 insertions, 0 deletions
@@ -0,0 +1,50 @@ +// Copyright 2017-2025 WIT.COM Inc. All rights reserved. +// Use of this source code is governed by the GPL 3.0 + +package main + +/* + this parses the command line arguements + this enables command line options from other packages like 'gui' and 'log' +*/ + +import ( + "os" + + "go.wit.com/lib/gui/prep" +) + +var argv args + +type args struct { + Update *EmptyCmd `arg:"subcommand:update" help:"update the apt repo"` + DryRun bool `arg:"--dry-run" help:"only show what would be packaged"` + Verbose bool `arg:"--verbose" help:"be loud about it"` + Force bool `arg:"--force" help:"rebuild everything"` +} + +type EmptyCmd struct { +} + +func (args) Buildtime() (string, string) { + return BUILDTIME, VERSION +} + +func (args) Version() string { + return ARGNAME + " " + VERSION + " Built on " + BUILDTIME +} + +func (args) Appname() string { + return ARGNAME +} + +func (a args) DoAutoComplete(pb *prep.Auto) { + base := []string{"--version", "update", "--dry-run", "--force"} + + if pb.Cmd == "" { + pb.Autocomplete3(base) + } else { + pb.SubCommand(pb.Goargs...) + } + os.Exit(0) +} |
