From b869bd250c0a41b95c8277cd89853a329bd80f01 Mon Sep 17 00:00:00 2001 From: stephen mcquay Date: Sat, 3 Mar 2018 21:28:24 -0800 Subject: [PATCH] Stub out install subcommand --- cmd/pm/main.go | 9 +++++++++ pkg/install.go | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 pkg/install.go diff --git a/cmd/pm/main.go b/cmd/pm/main.go index 6b292b1..5f81ade 100644 --- a/cmd/pm/main.go +++ b/cmd/pm/main.go @@ -21,6 +21,7 @@ const usage = `pm: simple, cross-platform system package manager subcommands: available (av) -- print out all installable packages environ (env) -- print environment information + install (in) -- install packages keyring (key) -- interact with pm's OpenPGP keyring package (pkg) -- create packages pull -- fetch all available packages from all configured remotes @@ -223,6 +224,14 @@ func main() { if err := db.ListAvailable(root, os.Stdout); err != nil { 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": fmt.Printf("pm: version %v\n", Version) default: diff --git a/pkg/install.go b/pkg/install.go new file mode 100644 index 0000000..6ca39bc --- /dev/null +++ b/pkg/install.go @@ -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") +}