Stub out install subcommand

This commit is contained in:
Stephen McQuay 2018-03-03 21:28:24 -08:00
parent bc8a4a1905
commit b869bd250c
Signed by untrusted user: sm
GPG Key ID: 4E4B72F479BA3CE5
2 changed files with 19 additions and 0 deletions

View File

@ -21,6 +21,7 @@ const usage = `pm: simple, cross-platform system package manager
subcommands: subcommands:
available (av) -- print out all installable packages available (av) -- print out all installable packages
environ (env) -- print environment information environ (env) -- print environment information
install (in) -- install packages
keyring (key) -- interact with pm's OpenPGP keyring keyring (key) -- interact with pm's OpenPGP keyring
package (pkg) -- create packages package (pkg) -- create packages
pull -- fetch all available packages from all configured remotes pull -- fetch all available packages from all configured remotes
@ -223,6 +224,14 @@ func main() {
if err := db.ListAvailable(root, os.Stdout); err != nil { if err := db.ListAvailable(root, os.Stdout); err != nil {
fatalf("pulling available packages: %v\n", err) fatalf("pulling available packages: %v\n", err)
} }
case "install", "in":
if len(os.Args[1:]) < 2 {
fatalf("pm install: insufficient args\n\nusage: pm install [pkg1, pkg2, ..., pkgN]\n")
}
pkgs := os.Args[2:]
if err := pkg.Install(root, pkgs); err != nil {
fatalf("installing: %v\n", err)
}
case "version", "v": case "version", "v":
fmt.Printf("pm: version %v\n", Version) fmt.Printf("pm: version %v\n", Version)
default: default:

10
pkg/install.go Normal file
View File

@ -0,0 +1,10 @@
package pkg
import (
"github.com/pkg/errors"
)
// Install fetches and installs pkgs from appropriate remotes.
func Install(root string, pkgs []string) error {
return errors.New("NYI")
}