Stub in the commands
This commit is contained in:
parent
8a70658b3f
commit
92b937936e
@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
"mcquay.me/pm/keyring"
|
"mcquay.me/pm/keyring"
|
||||||
"mcquay.me/pm/pkg"
|
"mcquay.me/pm/pkg"
|
||||||
|
"mcquay.me/pm/remote"
|
||||||
)
|
)
|
||||||
|
|
||||||
const usage = `pm: simple, cross-platform system package manager
|
const usage = `pm: simple, cross-platform system package manager
|
||||||
@ -14,6 +15,7 @@ const usage = `pm: simple, cross-platform system package manager
|
|||||||
subcommands:
|
subcommands:
|
||||||
environ (env) -- print environment information
|
environ (env) -- print environment information
|
||||||
keyring (key) -- interact with pm's OpenPGP keyring
|
keyring (key) -- interact with pm's OpenPGP keyring
|
||||||
|
remote -- configure remote pmd servers
|
||||||
package (pkg) -- create packages
|
package (pkg) -- create packages
|
||||||
`
|
`
|
||||||
|
|
||||||
@ -35,6 +37,14 @@ subcommands:
|
|||||||
create (c) -- create a fresh keypair
|
create (c) -- create a fresh keypair
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const remoteUsage = `pm remote: configure remote pmd servers
|
||||||
|
|
||||||
|
subcommands:
|
||||||
|
add (a) -- add a URI
|
||||||
|
ls -- list configured remotes
|
||||||
|
rm -- remove a URI
|
||||||
|
`
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if len(os.Args) < 2 {
|
if len(os.Args) < 2 {
|
||||||
fatalf("pm: missing subcommand\n\n%v", usage)
|
fatalf("pm: missing subcommand\n\n%v", usage)
|
||||||
@ -163,6 +173,29 @@ func main() {
|
|||||||
default:
|
default:
|
||||||
fatalf("unknown package subcommand: %q\n\nusage: %v", sub, pkgUsage)
|
fatalf("unknown package subcommand: %q\n\nusage: %v", sub, pkgUsage)
|
||||||
}
|
}
|
||||||
|
case "remote":
|
||||||
|
if len(os.Args[1:]) < 2 {
|
||||||
|
fatalf("pm remote: insufficient args\n\nusage: %v", remoteUsage)
|
||||||
|
}
|
||||||
|
sub := os.Args[2]
|
||||||
|
args := os.Args[3:]
|
||||||
|
|
||||||
|
switch sub {
|
||||||
|
case "add", "a":
|
||||||
|
if err := remote.Add(root, args); err != nil {
|
||||||
|
fatalf("remote add: %v\n", err)
|
||||||
|
}
|
||||||
|
case "rm":
|
||||||
|
if err := remote.Remove(root, args); err != nil {
|
||||||
|
fatalf("remote remove: %v\n", err)
|
||||||
|
}
|
||||||
|
case "ls":
|
||||||
|
if err := remote.List(root, os.Stdout); err != nil {
|
||||||
|
fatalf("list: %v\n", err)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
fatalf("unknown package subcommand: %q\n\nusage: %v", sub, remoteUsage)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
fatalf("uknown subcommand %q\n\nusage: %v", cmd, usage)
|
fatalf("uknown subcommand %q\n\nusage: %v", cmd, usage)
|
||||||
}
|
}
|
||||||
|
21
remote/remote.go
Normal file
21
remote/remote.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package remote
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Add appends the provided uri to the list of configured remotes.
|
||||||
|
func Add(root string, uri []string) error {
|
||||||
|
return errors.New("NYI")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add removes the given uri from the list of configured remotes.
|
||||||
|
func Remove(root string, uri []string) error {
|
||||||
|
return errors.New("NYI")
|
||||||
|
}
|
||||||
|
|
||||||
|
// List prints all configured remotes to w.
|
||||||
|
func List(root string, w io.Writer) error {
|
||||||
|
return errors.New("NYI")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user