argv autocomplete improvements
This commit is contained in:
parent
21313117b7
commit
a28318fbcb
4
argv.go
4
argv.go
|
@ -27,7 +27,7 @@ type args struct {
|
||||||
ListPkgs *EmptyCmd `arg:"subcommand:list" help:"list all the packages on mirrors.wit.com"`
|
ListPkgs *EmptyCmd `arg:"subcommand:list" help:"list all the packages on mirrors.wit.com"`
|
||||||
Test *EmptyCmd `arg:"subcommand:test" help:"test build everything first"`
|
Test *EmptyCmd `arg:"subcommand:test" help:"test build everything first"`
|
||||||
Clone *EmptyCmd `arg:"subcommand:repomap-clone" help:"go-clone from a gowebd repomap"`
|
Clone *EmptyCmd `arg:"subcommand:repomap-clone" help:"go-clone from a gowebd repomap"`
|
||||||
Upgrade *EmptyCmd `arg:"subcommand:upgrade" help:"apt upgrade packages installed from mirrors.wit.com"`
|
Upgrade *DefaultCmd `arg:"subcommand:upgrade" help:"apt upgrade packages installed from mirrors.wit.com"`
|
||||||
RepoMap string `arg:"--repomap" help:"location of the repomap"`
|
RepoMap string `arg:"--repomap" help:"location of the repomap"`
|
||||||
Release bool `arg:"--release" help:"use go-deb --release"`
|
Release bool `arg:"--release" help:"use go-deb --release"`
|
||||||
DryRun bool `arg:"--dry-run" help:"only show what would be packaged"`
|
DryRun bool `arg:"--dry-run" help:"only show what would be packaged"`
|
||||||
|
@ -86,7 +86,7 @@ func (args) Appname() string {
|
||||||
|
|
||||||
func (a args) DoAutoComplete(pb *prep.Auto) {
|
func (a args) DoAutoComplete(pb *prep.Auto) {
|
||||||
if pb.Cmd == "" {
|
if pb.Cmd == "" {
|
||||||
pb.Autocomplete3([]string{"--bash", "build", "debian", "install", "macos"})
|
pb.Autocomplete3([]string{"--bash", "build", "debian", "install", "upgrade", "macos", "--witcom"})
|
||||||
} else {
|
} else {
|
||||||
pb.SubCommand(pb.Argv...)
|
pb.SubCommand(pb.Argv...)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,11 @@ func doAptUpgrade() {
|
||||||
loop := me.machine.Wit.SortByName()
|
loop := me.machine.Wit.SortByName()
|
||||||
for loop.Scan() {
|
for loop.Scan() {
|
||||||
p := loop.Next()
|
p := loop.Next()
|
||||||
// log.Info("apt install", name)
|
// log.Info("apt install", p.Name)
|
||||||
|
if p.Name == "" {
|
||||||
|
log.Info("something wrong. p.Name was blank", p)
|
||||||
|
continue
|
||||||
|
}
|
||||||
if me.machine.IsInstalled(p.Name) {
|
if me.machine.IsInstalled(p.Name) {
|
||||||
cmd := []string{"apt", "install", p.Name}
|
cmd := []string{"apt", "install", p.Name}
|
||||||
if argv.DryRun {
|
if argv.DryRun {
|
||||||
|
|
|
@ -28,8 +28,6 @@ func doWITCOM() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add a common header for WIT files
|
// add a common header for WIT files
|
||||||
// add a common header for WIT files
|
|
||||||
|
|
||||||
func addCommonHeader(filename string) error {
|
func addCommonHeader(filename string) error {
|
||||||
// read in the .proto file
|
// read in the .proto file
|
||||||
data, err := os.ReadFile(filename)
|
data, err := os.ReadFile(filename)
|
||||||
|
@ -66,7 +64,8 @@ func addCommonHeader(filename string) error {
|
||||||
// print the header once
|
// print the header once
|
||||||
if !done {
|
if !done {
|
||||||
newfile += fmt.Sprintln("// Copyright 2017-2025 WIT.COM Inc. All rights reserved.")
|
newfile += fmt.Sprintln("// Copyright 2017-2025 WIT.COM Inc. All rights reserved.")
|
||||||
newfile += fmt.Sprintln("// Use of this source code is governed by the GPL 3.0")
|
// todo, verify LICENSE file is GPL 3.0 here
|
||||||
|
newfile += fmt.Sprintln("// Use of this source code is governed by the GPL")
|
||||||
newfile += fmt.Sprintln("")
|
newfile += fmt.Sprintln("")
|
||||||
done = true
|
done = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue