@cryptotaxi247 / kubo / commits / 5fa3053e1

added command stubs

Henry committed Oct 18, 2014 at 21:10 UTC 5fa3053e193dcef57c6c86c0c7f9a6b2701e61ce
3 files changed +81
cmd/ipfs/ipfs.go
+1
@@ -68,6 +68,7 @@ Use "ipfs help <command>" for more information about a command.
68 cmdIpfsDiag,
69 cmdIpfsBlock,
70 cmdIpfsObject,
71 + cmdIpfsUpdate,
72 cmdIpfsLog,
73 cmdIpfsPin,
74 },
cmd/ipfs/update.go new
+58
@@ -0,0 +1,58 @@
1 +package main
2 +
3 +import (
4 + flag "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
5 + commander "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
6 + "github.com/jbenet/go-ipfs/core/commands"
7 +)
8 +
9 +var cmdIpfsUpdate = &commander.Command{
10 + UsageLine: "update",
11 + Short: "check for updates and apply them",
12 + Long: `ipfs update - check for updates and apply them
13 +
14 + ipfs update <version> - apply
15 + ipfs update check - just check
16 + ipfs update log - list the changelogs
17 +
18 +ipfs update is a utility command used to check for updates and apply them.
19 +I wont even try, @jbenet. You do this much better :)`,
20 + Run: makeCommand(command{
21 + name: "updateApply",
22 + args: 0,
23 + flags: nil,
24 + online: true,
25 + cmdFn: commands.UpdateApply,
26 + }),
27 + Subcommands: []*commander.Command{
28 + cmdIpfsUpdateCheck,
29 + cmdIpfsUpdateLog,
30 + },
31 + Flag: *flag.NewFlagSet("ipfs-update", flag.ExitOnError),
32 +}
33 +
34 +var cmdIpfsUpdateCheck = &commander.Command{
35 + UsageLine: "check",
36 + Short: "",
37 + Long: `ipfs update check <key>`,
38 + Run: makeCommand(command{
39 + name: "updateCheck",
40 + args: 0,
41 + flags: nil,
42 + online: false,
43 + cmdFn: commands.UpdateCheck,
44 + }),
45 +}
46 +
47 +var cmdIpfsUpdateLog = &commander.Command{
48 + UsageLine: "log",
49 + Short: "list the last versions and their changelog",
50 + Long: `ipfs updage log - list the last versions and their changelog`,
51 + Run: makeCommand(command{
52 + name: "updateLog",
53 + args: 0,
54 + flags: nil,
55 + online: false,
56 + cmdFn: commands.UpdateCheck,
57 + }),
58 +}
core/commands/update.go new
+22
@@ -0,0 +1,22 @@
1 +package commands
2 +
3 +import (
4 + "errors"
5 + "io"
6 +
7 + "github.com/jbenet/go-ipfs/core"
8 +)
9 +
10 +// UpdateApply applys an update of the ipfs binary and shuts down the node if successful
11 +func UpdateApply(n *core.IpfsNode, args []string, opts map[string]interface{}, out io.Writer) error {
12 + return errors.New("TODOUpdateApply")
13 +}
14 +
15 +// UpdateCheck checks wether there is an update available
16 +func UpdateCheck(n *core.IpfsNode, args []string, opts map[string]interface{}, out io.Writer) error {
17 + return errors.New("TODOUpdateCheck")
18 +}
19 +
20 +func UpdateLog(n *core.IpfsNode, args []string, opts map[string]interface{}, out io.Writer) error {
21 + return errors.New("TODOUpdateLog")
22 +}