@cryptotaxi247 / kubo / commits / 5f64b270f

cmdkit -> cmds

License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>

Steven Allen committed May 10, 2019 at 23:00 UTC 5f64b270f8cf6d203a2092224d249fa6b305523b
57 files changed +623 -680
README.md
-1
@@ -353,7 +353,6 @@ Listing of the main packages used in the IPFS ecosystem. There are also three sp
353 | [`go-ipfs-blockstore`](//github.com/ipfs/go-ipfs-blockstore) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-blockstore.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-blockstore) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-blockstore/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-blockstore) | blockstore interfaces and implementations |
354 | **Commands** |
355 | [`go-ipfs-cmds`](//github.com/ipfs/go-ipfs-cmds) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-cmds.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-cmds) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-cmds/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-cmds) | CLI & HTTP commands library |
356 -| [`go-ipfs-cmdkit`](//github.com/ipfs/go-ipfs-cmdkit) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-cmdkit.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-cmdkit) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-cmdkit/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-cmdkit) | helper types for the commands library |
356 | [`go-ipfs-api`](//github.com/ipfs/go-ipfs-api) | [![Travis CI](https://travis-ci.com/ipfs/go-ipfs-api.svg?branch=master)](https://travis-ci.com/ipfs/go-ipfs-api) | [![codecov](https://codecov.io/gh/ipfs/go-ipfs-api/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-ipfs-api) | a shell for the IPFS HTTP API |
357 | **Metrics & Logging** |
358 | [`go-metrics-interface`](//github.com/ipfs/go-metrics-interface) | [![Travis CI](https://travis-ci.com/ipfs/go-metrics-interface.svg?branch=master)](https://travis-ci.com/ipfs/go-metrics-interface) | [![codecov](https://codecov.io/gh/ipfs/go-metrics-interface/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-metrics-interface) | metrics collection interfaces |
cmd/ipfs/daemon.go
+21 -22
@@ -26,8 +26,7 @@ import (
26 migrate "github.com/ipfs/go-ipfs/repo/fsrepo/migrations"
27
28 "github.com/hashicorp/go-multierror"
29 - "github.com/ipfs/go-ipfs-cmdkit"
30 - cmds "github.com/ipfs/go-ipfs-cmds"
29 + "github.com/ipfs/go-ipfs-cmds"
30 mprome "github.com/ipfs/go-metrics-prometheus"
31 goprocess "github.com/jbenet/goprocess"
32 ma "github.com/multiformats/go-multiaddr"
@@ -62,7 +61,7 @@ const (
61 )
62
63 var daemonCmd = &cmds.Command{
65 - Helptext: cmdkit.HelpText{
64 + Helptext: cmds.HelpText{
65 Tagline: "Run a network-connected IPFS node.",
66 ShortDescription: `
67 'ipfs daemon' runs a persistent ipfs daemon that can serve commands
@@ -153,26 +152,26 @@ Headers.
152 `,
153 },
154
156 - Options: []cmdkit.Option{
157 - cmdkit.BoolOption(initOptionKwd, "Initialize ipfs with default settings if not already initialized"),
158 - cmdkit.StringOption(initProfileOptionKwd, "Configuration profiles to apply for --init. See ipfs init --help for more"),
159 - cmdkit.StringOption(routingOptionKwd, "Overrides the routing option").WithDefault(routingOptionDefaultKwd),
160 - cmdkit.BoolOption(mountKwd, "Mounts IPFS to the filesystem"),
161 - cmdkit.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)"),
162 - cmdkit.StringOption(ipfsMountKwd, "Path to the mountpoint for IPFS (if using --mount). Defaults to config setting."),
163 - cmdkit.StringOption(ipnsMountKwd, "Path to the mountpoint for IPNS (if using --mount). Defaults to config setting."),
164 - cmdkit.BoolOption(unrestrictedApiAccessKwd, "Allow API access to unlisted hashes"),
165 - cmdkit.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)"),
166 - cmdkit.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection"),
167 - cmdkit.BoolOption(adjustFDLimitKwd, "Check and raise file descriptor limits if needed").WithDefault(true),
168 - cmdkit.BoolOption(migrateKwd, "If true, assume yes at the migrate prompt. If false, assume no."),
169 - cmdkit.BoolOption(enablePubSubKwd, "Instantiate the ipfs daemon with the experimental pubsub feature enabled."),
170 - cmdkit.BoolOption(enableIPNSPubSubKwd, "Enable IPNS record distribution through pubsub; enables pubsub."),
171 - cmdkit.BoolOption(enableMultiplexKwd, "Add the experimental 'go-multiplex' stream muxer to libp2p on construction.").WithDefault(true),
155 + Options: []cmds.Option{
156 + cmds.BoolOption(initOptionKwd, "Initialize ipfs with default settings if not already initialized"),
157 + cmds.StringOption(initProfileOptionKwd, "Configuration profiles to apply for --init. See ipfs init --help for more"),
158 + cmds.StringOption(routingOptionKwd, "Overrides the routing option").WithDefault(routingOptionDefaultKwd),
159 + cmds.BoolOption(mountKwd, "Mounts IPFS to the filesystem"),
160 + cmds.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)"),
161 + cmds.StringOption(ipfsMountKwd, "Path to the mountpoint for IPFS (if using --mount). Defaults to config setting."),
162 + cmds.StringOption(ipnsMountKwd, "Path to the mountpoint for IPNS (if using --mount). Defaults to config setting."),
163 + cmds.BoolOption(unrestrictedApiAccessKwd, "Allow API access to unlisted hashes"),
164 + cmds.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)"),
165 + cmds.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection"),
166 + cmds.BoolOption(adjustFDLimitKwd, "Check and raise file descriptor limits if needed").WithDefault(true),
167 + cmds.BoolOption(migrateKwd, "If true, assume yes at the migrate prompt. If false, assume no."),
168 + cmds.BoolOption(enablePubSubKwd, "Instantiate the ipfs daemon with the experimental pubsub feature enabled."),
169 + cmds.BoolOption(enableIPNSPubSubKwd, "Enable IPNS record distribution through pubsub; enables pubsub."),
170 + cmds.BoolOption(enableMultiplexKwd, "Add the experimental 'go-multiplex' stream muxer to libp2p on construction.").WithDefault(true),
171
172 // TODO: add way to override addresses. tricky part: updating the config if also --init.
174 - // cmdkit.StringOption(apiAddrKwd, "Address for the daemon rpc API (overrides config)"),
175 - // cmdkit.StringOption(swarmAddrKwd, "Address for the swarm socket (overrides config)"),
173 + // cmds.StringOption(apiAddrKwd, "Address for the daemon rpc API (overrides config)"),
174 + // cmds.StringOption(swarmAddrKwd, "Address for the swarm socket (overrides config)"),
175 },
176 Subcommands: map[string]*cmds.Command{},
177 Run: daemonFunc,
@@ -384,7 +383,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
383 // construct fuse mountpoints - if the user provided the --mount flag
384 mount, _ := req.Options[mountKwd].(bool)
385 if mount && offline {
387 - return cmdkit.Errorf(cmdkit.ErrClient, "mount is not currently supported in offline mode")
386 + return cmds.Errorf(cmds.ErrClient, "mount is not currently supported in offline mode")
387 }
388 if mount {
389 if err := mountFuse(req, cctx); err != nil {
cmd/ipfs/init.go
+8 -9
@@ -16,7 +16,6 @@ import (
16 namesys "github.com/ipfs/go-ipfs/namesys"
17 fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"
18
19 - "github.com/ipfs/go-ipfs-cmdkit"
19 "github.com/ipfs/go-ipfs-cmds"
20 "github.com/ipfs/go-ipfs-config"
21 "github.com/ipfs/go-ipfs-files"
@@ -30,7 +29,7 @@ const (
29 )
30
31 var initCmd = &cmds.Command{
33 - Helptext: cmdkit.HelpText{
32 + Helptext: cmds.HelpText{
33 Tagline: "Initializes ipfs config file.",
34 ShortDescription: `
35 Initializes ipfs configuration files and generates a new keypair.
@@ -47,18 +46,18 @@ environment variable:
46 export IPFS_PATH=/path/to/ipfsrepo
47 `,
48 },
50 - Arguments: []cmdkit.Argument{
51 - cmdkit.FileArg("default-config", false, false, "Initialize with the given configuration.").EnableStdin(),
49 + Arguments: []cmds.Argument{
50 + cmds.FileArg("default-config", false, false, "Initialize with the given configuration.").EnableStdin(),
51 },
53 - Options: []cmdkit.Option{
54 - cmdkit.IntOption(bitsOptionName, "b", "Number of bits to use in the generated RSA private key.").WithDefault(nBitsForKeypairDefault),
55 - cmdkit.BoolOption(emptyRepoOptionName, "e", "Don't add and pin help files to the local storage."),
56 - cmdkit.StringOption(profileOptionName, "p", "Apply profile settings to config. Multiple profiles can be separated by ','"),
52 + Options: []cmds.Option{
53 + cmds.IntOption(bitsOptionName, "b", "Number of bits to use in the generated RSA private key.").WithDefault(nBitsForKeypairDefault),
54 + cmds.BoolOption(emptyRepoOptionName, "e", "Don't add and pin help files to the local storage."),
55 + cmds.StringOption(profileOptionName, "p", "Apply profile settings to config. Multiple profiles can be separated by ','"),
56
57 // TODO need to decide whether to expose the override as a file or a
58 // directory. That is: should we allow the user to also specify the
59 // name of the file?
61 - // TODO cmdkit.StringOption("event-logs", "l", "Location for machine-readable event logs."),
60 + // TODO cmds.StringOption("event-logs", "l", "Location for machine-readable event logs."),
61 },
62 PreRun: func(req *cmds.Request, env cmds.Environment) error {
63 cctx := env.(*oldcmds.Context)
core/commands/active.go
+7 -8
@@ -9,7 +9,6 @@ import (
9
10 oldcmds "github.com/ipfs/go-ipfs/commands"
11
12 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
12 cmds "github.com/ipfs/go-ipfs-cmds"
13 )
14
@@ -18,7 +17,7 @@ const (
17 )
18
19 var ActiveReqsCmd = &cmds.Command{
21 - Helptext: cmdkit.HelpText{
20 + Helptext: cmds.HelpText{
21 Tagline: "List commands run on this IPFS node.",
22 ShortDescription: `
23 Lists running and recently run commands.
@@ -28,8 +27,8 @@ Lists running and recently run commands.
27 ctx := env.(*oldcmds.Context)
28 return cmds.EmitOnce(res, ctx.ReqLog.Report())
29 },
31 - Options: []cmdkit.Option{
32 - cmdkit.BoolOption(verboseOptionName, "v", "Print extra information."),
30 + Options: []cmds.Option{
31 + cmds.BoolOption(verboseOptionName, "v", "Print extra information."),
32 },
33 Subcommands: map[string]*cmds.Command{
34 "clear": clearInactiveCmd,
@@ -86,7 +85,7 @@ Lists running and recently run commands.
85 }
86
87 var clearInactiveCmd = &cmds.Command{
89 - Helptext: cmdkit.HelpText{
88 + Helptext: cmds.HelpText{
89 Tagline: "Clear inactive requests from the log.",
90 },
91 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
@@ -97,11 +96,11 @@ var clearInactiveCmd = &cmds.Command{
96 }
97
98 var setRequestClearCmd = &cmds.Command{
100 - Helptext: cmdkit.HelpText{
99 + Helptext: cmds.HelpText{
100 Tagline: "Set how long to keep inactive requests in the log.",
101 },
103 - Arguments: []cmdkit.Argument{
104 - cmdkit.StringArg("time", true, false, "Time to keep inactive requests in log."),
102 + Arguments: []cmds.Argument{
103 + cmds.StringArg("time", true, false, "Time to keep inactive requests in log."),
104 },
105 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
106 tval, err := time.ParseDuration(req.Arguments[0])
core/commands/add.go
+20 -21
@@ -10,7 +10,6 @@ import (
10
11 "github.com/ipfs/go-ipfs/core/commands/cmdenv"
12
13 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
13 cmds "github.com/ipfs/go-ipfs-cmds"
14 "github.com/ipfs/go-ipfs-files"
15 coreiface "github.com/ipfs/interface-go-ipfs-core"
@@ -51,7 +50,7 @@ const (
50 const adderOutChanSize = 8
51
52 var AddCmd = &cmds.Command{
54 - Helptext: cmdkit.HelpText{
53 + Helptext: cmds.HelpText{
54 Tagline: "Add a file or directory to ipfs.",
55 ShortDescription: `
56 Adds contents of <path> to ipfs. Use -r to add directories (recursively).
@@ -106,30 +105,30 @@ You can now check what blocks have been created by:
105 `,
106 },
107
109 - Arguments: []cmdkit.Argument{
110 - cmdkit.FileArg("path", true, true, "The path to a file to be added to ipfs.").EnableRecursive().EnableStdin(),
108 + Arguments: []cmds.Argument{
109 + cmds.FileArg("path", true, true, "The path to a file to be added to ipfs.").EnableRecursive().EnableStdin(),
110 },
112 - Options: []cmdkit.Option{
111 + Options: []cmds.Option{
112 cmds.OptionRecursivePath, // a builtin option that allows recursive paths (-r, --recursive)
113 cmds.OptionDerefArgs, // a builtin option that resolves passed in filesystem links (--dereference-args)
114 cmds.OptionStdinName, // a builtin option that optionally allows wrapping stdin into a named file
115 cmds.OptionHidden,
117 - cmdkit.BoolOption(quietOptionName, "q", "Write minimal output."),
118 - cmdkit.BoolOption(quieterOptionName, "Q", "Write only final hash."),
119 - cmdkit.BoolOption(silentOptionName, "Write no output."),
120 - cmdkit.BoolOption(progressOptionName, "p", "Stream progress data."),
121 - cmdkit.BoolOption(trickleOptionName, "t", "Use trickle-dag format for dag generation."),
122 - cmdkit.BoolOption(onlyHashOptionName, "n", "Only chunk and hash - do not write to disk."),
123 - cmdkit.BoolOption(wrapOptionName, "w", "Wrap files with a directory object."),
124 - cmdkit.StringOption(chunkerOptionName, "s", "Chunking algorithm, size-[bytes] or rabin-[min]-[avg]-[max]").WithDefault("size-262144"),
125 - cmdkit.BoolOption(pinOptionName, "Pin this object when adding.").WithDefault(true),
126 - cmdkit.BoolOption(rawLeavesOptionName, "Use raw blocks for leaf nodes. (experimental)"),
127 - cmdkit.BoolOption(noCopyOptionName, "Add the file using filestore. Implies raw-leaves. (experimental)"),
128 - cmdkit.BoolOption(fstoreCacheOptionName, "Check the filestore for pre-existing blocks. (experimental)"),
129 - cmdkit.IntOption(cidVersionOptionName, "CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. (experimental)"),
130 - cmdkit.StringOption(hashOptionName, "Hash function to use. Implies CIDv1 if not sha2-256. (experimental)").WithDefault("sha2-256"),
131 - cmdkit.BoolOption(inlineOptionName, "Inline small blocks into CIDs. (experimental)"),
132 - cmdkit.IntOption(inlineLimitOptionName, "Maximum block size to inline. (experimental)").WithDefault(32),
116 + cmds.BoolOption(quietOptionName, "q", "Write minimal output."),
117 + cmds.BoolOption(quieterOptionName, "Q", "Write only final hash."),
118 + cmds.BoolOption(silentOptionName, "Write no output."),
119 + cmds.BoolOption(progressOptionName, "p", "Stream progress data."),
120 + cmds.BoolOption(trickleOptionName, "t", "Use trickle-dag format for dag generation."),
121 + cmds.BoolOption(onlyHashOptionName, "n", "Only chunk and hash - do not write to disk."),
122 + cmds.BoolOption(wrapOptionName, "w", "Wrap files with a directory object."),
123 + cmds.StringOption(chunkerOptionName, "s", "Chunking algorithm, size-[bytes] or rabin-[min]-[avg]-[max]").WithDefault("size-262144"),
124 + cmds.BoolOption(pinOptionName, "Pin this object when adding.").WithDefault(true),
125 + cmds.BoolOption(rawLeavesOptionName, "Use raw blocks for leaf nodes. (experimental)"),
126 + cmds.BoolOption(noCopyOptionName, "Add the file using filestore. Implies raw-leaves. (experimental)"),
127 + cmds.BoolOption(fstoreCacheOptionName, "Check the filestore for pre-existing blocks. (experimental)"),
128 + cmds.IntOption(cidVersionOptionName, "CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. (experimental)"),
129 + cmds.StringOption(hashOptionName, "Hash function to use. Implies CIDv1 if not sha2-256. (experimental)").WithDefault("sha2-256"),
130 + cmds.BoolOption(inlineOptionName, "Inline small blocks into CIDs. (experimental)"),
131 + cmds.IntOption(inlineLimitOptionName, "Maximum block size to inline. (experimental)").WithDefault(32),
132 },
133 PreRun: func(req *cmds.Request, env cmds.Environment) error {
134 quiet, _ := req.Options[quietOptionName].(bool)
core/commands/bitswap.go
+13 -14
@@ -11,13 +11,12 @@ import (
11 bitswap "github.com/ipfs/go-bitswap"
12 decision "github.com/ipfs/go-bitswap/decision"
13 cidutil "github.com/ipfs/go-cidutil"
14 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
14 cmds "github.com/ipfs/go-ipfs-cmds"
15 peer "github.com/libp2p/go-libp2p-peer"
16 )
17
18 var BitswapCmd = &cmds.Command{
20 - Helptext: cmdkit.HelpText{
19 + Helptext: cmds.HelpText{
20 Tagline: "Interact with the bitswap agent.",
21 ShortDescription: ``,
22 },
@@ -35,13 +34,13 @@ const (
34 )
35
36 var showWantlistCmd = &cmds.Command{
38 - Helptext: cmdkit.HelpText{
37 + Helptext: cmds.HelpText{
38 Tagline: "Show blocks currently on the wantlist.",
39 ShortDescription: `
40 Print out all blocks currently on the bitswap wantlist for the local peer.`,
41 },
43 - Options: []cmdkit.Option{
44 - cmdkit.StringOption(peerOptionName, "p", "Specify which peer to show wantlist for. Default: self."),
42 + Options: []cmds.Option{
43 + cmds.StringOption(peerOptionName, "p", "Specify which peer to show wantlist for. Default: self."),
44 },
45 Type: KeyList{},
46 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
@@ -94,13 +93,13 @@ const (
93 )
94
95 var bitswapStatCmd = &cmds.Command{
97 - Helptext: cmdkit.HelpText{
96 + Helptext: cmds.HelpText{
97 Tagline: "Show some diagnostic information on the bitswap agent.",
98 ShortDescription: ``,
99 },
101 - Options: []cmdkit.Option{
102 - cmdkit.BoolOption(bitswapVerboseOptionName, "v", "Print extra information"),
103 - cmdkit.BoolOption(bitswapHumanOptionName, "Print sizes in human readable format (e.g., 1K 234M 2G)"),
100 + Options: []cmds.Option{
101 + cmds.BoolOption(bitswapVerboseOptionName, "v", "Print extra information"),
102 + cmds.BoolOption(bitswapHumanOptionName, "Print sizes in human readable format (e.g., 1K 234M 2G)"),
103 },
104 Type: bitswap.Stat{},
105 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
@@ -110,7 +109,7 @@ var bitswapStatCmd = &cmds.Command{
109 }
110
111 if !nd.IsOnline {
113 - return cmdkit.Errorf(cmdkit.ErrClient, ErrNotOnline.Error())
112 + return cmds.Errorf(cmds.ErrClient, ErrNotOnline.Error())
113 }
114
115 bs, ok := nd.Exchange.(*bitswap.Bitswap)
@@ -169,7 +168,7 @@ var bitswapStatCmd = &cmds.Command{
168 }
169
170 var ledgerCmd = &cmds.Command{
172 - Helptext: cmdkit.HelpText{
171 + Helptext: cmds.HelpText{
172 Tagline: "Show the current ledger for a peer.",
173 ShortDescription: `
174 The Bitswap decision engine tracks the number of bytes exchanged between IPFS
@@ -177,8 +176,8 @@ nodes, and stores this information as a collection of ledgers. This command
176 prints the ledger associated with a given peer.
177 `,
178 },
180 - Arguments: []cmdkit.Argument{
181 - cmdkit.StringArg("peer", true, false, "The PeerID (B58) of the ledger to inspect."),
179 + Arguments: []cmds.Argument{
180 + cmds.StringArg("peer", true, false, "The PeerID (B58) of the ledger to inspect."),
181 },
182 Type: decision.Receipt{},
183 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
@@ -218,7 +217,7 @@ prints the ledger associated with a given peer.
217 }
218
219 var reprovideCmd = &cmds.Command{
221 - Helptext: cmdkit.HelpText{
220 + Helptext: cmds.HelpText{
221 Tagline: "Trigger reprovider.",
222 ShortDescription: `
223 Trigger reprovider to announce our data to network.
core/commands/block.go
+21 -22
@@ -9,7 +9,6 @@ import (
9 util "github.com/ipfs/go-ipfs/blocks/blockstoreutil"
10 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
11
12 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
12 cmds "github.com/ipfs/go-ipfs-cmds"
13 options "github.com/ipfs/interface-go-ipfs-core/options"
14 path "github.com/ipfs/interface-go-ipfs-core/path"
@@ -26,7 +25,7 @@ func (bs BlockStat) String() string {
25 }
26
27 var BlockCmd = &cmds.Command{
29 - Helptext: cmdkit.HelpText{
28 + Helptext: cmds.HelpText{
29 Tagline: "Interact with raw IPFS blocks.",
30 ShortDescription: `
31 'ipfs block' is a plumbing command used to manipulate raw IPFS blocks.
@@ -44,7 +43,7 @@ multihash.
43 }
44
45 var blockStatCmd = &cmds.Command{
47 - Helptext: cmdkit.HelpText{
46 + Helptext: cmds.HelpText{
47 Tagline: "Print information of a raw IPFS block.",
48 ShortDescription: `
49 'ipfs block stat' is a plumbing command for retrieving information
@@ -56,8 +55,8 @@ on raw IPFS blocks. It outputs the following to stdout:
55 `,
56 },
57
59 - Arguments: []cmdkit.Argument{
60 - cmdkit.StringArg("key", true, false, "The base58 multihash of an existing block to stat.").EnableStdin(),
58 + Arguments: []cmds.Argument{
59 + cmds.StringArg("key", true, false, "The base58 multihash of an existing block to stat.").EnableStdin(),
60 },
61 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
62 api, err := cmdenv.GetApi(env, req)
@@ -85,7 +84,7 @@ on raw IPFS blocks. It outputs the following to stdout:
84 }
85
86 var blockGetCmd = &cmds.Command{
88 - Helptext: cmdkit.HelpText{
87 + Helptext: cmds.HelpText{
88 Tagline: "Get a raw IPFS block.",
89 ShortDescription: `
90 'ipfs block get' is a plumbing command for retrieving raw IPFS blocks.
@@ -93,8 +92,8 @@ It outputs to stdout, and <key> is a base58 encoded multihash.
92 `,
93 },
94
96 - Arguments: []cmdkit.Argument{
97 - cmdkit.StringArg("key", true, false, "The base58 multihash of an existing block to get.").EnableStdin(),
95 + Arguments: []cmds.Argument{
96 + cmds.StringArg("key", true, false, "The base58 multihash of an existing block to get.").EnableStdin(),
97 },
98 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
99 api, err := cmdenv.GetApi(env, req)
@@ -118,7 +117,7 @@ const (
117 )
118
119 var blockPutCmd = &cmds.Command{
121 - Helptext: cmdkit.HelpText{
120 + Helptext: cmds.HelpText{
121 Tagline: "Store input as an IPFS block.",
122 ShortDescription: `
123 'ipfs block put' is a plumbing command for storing raw IPFS blocks.
@@ -129,14 +128,14 @@ than 'sha2-256' or format to anything other than 'v0' will result in CIDv1.
128 `,
129 },
130
132 - Arguments: []cmdkit.Argument{
133 - cmdkit.FileArg("data", true, false, "The data to be stored as an IPFS block.").EnableStdin(),
131 + Arguments: []cmds.Argument{
132 + cmds.FileArg("data", true, false, "The data to be stored as an IPFS block.").EnableStdin(),
133 },
135 - Options: []cmdkit.Option{
136 - cmdkit.StringOption(blockFormatOptionName, "f", "cid format for blocks to be created with."),
137 - cmdkit.StringOption(mhtypeOptionName, "multihash hash function").WithDefault("sha2-256"),
138 - cmdkit.IntOption(mhlenOptionName, "multihash hash length").WithDefault(-1),
139 - cmdkit.BoolOption(pinOptionName, "pin added blocks recursively").WithDefault(false),
134 + Options: []cmds.Option{
135 + cmds.StringOption(blockFormatOptionName, "f", "cid format for blocks to be created with."),
136 + cmds.StringOption(mhtypeOptionName, "multihash hash function").WithDefault("sha2-256"),
137 + cmds.IntOption(mhlenOptionName, "multihash hash length").WithDefault(-1),
138 + cmds.BoolOption(pinOptionName, "pin added blocks recursively").WithDefault(false),
139 },
140 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
141 api, err := cmdenv.GetApi(env, req)
@@ -199,19 +198,19 @@ const (
198 )
199
200 var blockRmCmd = &cmds.Command{
202 - Helptext: cmdkit.HelpText{
201 + Helptext: cmds.HelpText{
202 Tagline: "Remove IPFS block(s).",
203 ShortDescription: `
204 'ipfs block rm' is a plumbing command for removing raw ipfs blocks.
205 It takes a list of base58 encoded multihashes to remove.
206 `,
207 },
209 - Arguments: []cmdkit.Argument{
210 - cmdkit.StringArg("hash", true, true, "Bash58 encoded multihash of block(s) to remove."),
208 + Arguments: []cmds.Argument{
209 + cmds.StringArg("hash", true, true, "Bash58 encoded multihash of block(s) to remove."),
210 },
212 - Options: []cmdkit.Option{
213 - cmdkit.BoolOption(forceOptionName, "f", "Ignore nonexistent blocks."),
214 - cmdkit.BoolOption(blockQuietOptionName, "q", "Write minimal output."),
211 + Options: []cmds.Option{
212 + cmds.BoolOption(forceOptionName, "f", "Ignore nonexistent blocks."),
213 + cmds.BoolOption(blockQuietOptionName, "q", "Write minimal output."),
214 },
215 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
216 api, err := cmdenv.GetApi(env, req)
core/commands/bootstrap.go
+14 -15
@@ -9,7 +9,6 @@ import (
9 repo "github.com/ipfs/go-ipfs/repo"
10 fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"
11
12 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
12 cmds "github.com/ipfs/go-ipfs-cmds"
13 config "github.com/ipfs/go-ipfs-config"
14 )
@@ -21,7 +20,7 @@ type BootstrapOutput struct {
20 var peerOptionDesc = "A peer to add to the bootstrap list (in the format '<multiaddr>/<peerID>')"
21
22 var BootstrapCmd = &cmds.Command{
24 - Helptext: cmdkit.HelpText{
23 + Helptext: cmds.HelpText{
24 Tagline: "Show or edit the list of bootstrap peers.",
25 ShortDescription: `
26 Running 'ipfs bootstrap' with no arguments will run 'ipfs bootstrap list'.
@@ -44,19 +43,19 @@ const (
43 )
44
45 var bootstrapAddCmd = &cmds.Command{
47 - Helptext: cmdkit.HelpText{
46 + Helptext: cmds.HelpText{
47 Tagline: "Add peers to the bootstrap list.",
48 ShortDescription: `Outputs a list of peers that were added (that weren't already
49 in the bootstrap list).
50 ` + bootstrapSecurityWarning,
51 },
52
54 - Arguments: []cmdkit.Argument{
55 - cmdkit.StringArg("peer", false, true, peerOptionDesc).EnableStdin(),
53 + Arguments: []cmds.Argument{
54 + cmds.StringArg("peer", false, true, peerOptionDesc).EnableStdin(),
55 },
56
58 - Options: []cmdkit.Option{
59 - cmdkit.BoolOption(defaultOptionName, "Add default bootstrap nodes. (Deprecated, use 'default' subcommand instead)"),
57 + Options: []cmds.Option{
58 + cmds.BoolOption(defaultOptionName, "Add default bootstrap nodes. (Deprecated, use 'default' subcommand instead)"),
59 },
60 Subcommands: map[string]*cmds.Command{
61 "default": bootstrapAddDefaultCmd,
@@ -122,7 +121,7 @@ in the bootstrap list).
121 }
122
123 var bootstrapAddDefaultCmd = &cmds.Command{
125 - Helptext: cmdkit.HelpText{
124 + Helptext: cmds.HelpText{
125 Tagline: "Add default peers to the bootstrap list.",
126 ShortDescription: `Outputs a list of peers that were added (that weren't already
127 in the bootstrap list).`,
@@ -169,17 +168,17 @@ const (
168 )
169
170 var bootstrapRemoveCmd = &cmds.Command{
172 - Helptext: cmdkit.HelpText{
171 + Helptext: cmds.HelpText{
172 Tagline: "Remove peers from the bootstrap list.",
173 ShortDescription: `Outputs the list of peers that were removed.
174 ` + bootstrapSecurityWarning,
175 },
176
178 - Arguments: []cmdkit.Argument{
179 - cmdkit.StringArg("peer", false, true, peerOptionDesc).EnableStdin(),
177 + Arguments: []cmds.Argument{
178 + cmds.StringArg("peer", false, true, peerOptionDesc).EnableStdin(),
179 },
181 - Options: []cmdkit.Option{
182 - cmdkit.BoolOption(bootstrapAllOptionName, "Remove all bootstrap peers. (Deprecated, use 'all' subcommand)"),
180 + Options: []cmds.Option{
181 + cmds.BoolOption(bootstrapAllOptionName, "Remove all bootstrap peers. (Deprecated, use 'all' subcommand)"),
182 },
183 Subcommands: map[string]*cmds.Command{
184 "all": bootstrapRemoveAllCmd,
@@ -232,7 +231,7 @@ var bootstrapRemoveCmd = &cmds.Command{
231 }
232
233 var bootstrapRemoveAllCmd = &cmds.Command{
235 - Helptext: cmdkit.HelpText{
234 + Helptext: cmds.HelpText{
235 Tagline: "Remove all peers from the bootstrap list.",
236 ShortDescription: `Outputs the list of peers that were removed.`,
237 },
@@ -269,7 +268,7 @@ var bootstrapRemoveAllCmd = &cmds.Command{
268 }
269
270 var bootstrapListCmd = &cmds.Command{
272 - Helptext: cmdkit.HelpText{
271 + Helptext: cmds.HelpText{
272 Tagline: "Show peers in the bootstrap list.",
273 ShortDescription: "Peers are output in the format '<multiaddr>/<peerID>'.",
274 },
core/commands/cat.go
+8 -9
@@ -8,8 +8,7 @@ import (
8
9 "github.com/ipfs/go-ipfs/core/commands/cmdenv"
10
11 - "github.com/ipfs/go-ipfs-cmdkit"
12 - cmds "github.com/ipfs/go-ipfs-cmds"
11 + "github.com/ipfs/go-ipfs-cmds"
12 "github.com/ipfs/go-ipfs-files"
13 "github.com/ipfs/interface-go-ipfs-core"
14 "github.com/ipfs/interface-go-ipfs-core/path"
@@ -22,17 +21,17 @@ const (
21 )
22
23 var CatCmd = &cmds.Command{
25 - Helptext: cmdkit.HelpText{
24 + Helptext: cmds.HelpText{
25 Tagline: "Show IPFS object data.",
26 ShortDescription: "Displays the data contained by an IPFS or IPNS object(s) at the given path.",
27 },
28
30 - Arguments: []cmdkit.Argument{
31 - cmdkit.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to be outputted.").EnableStdin(),
29 + Arguments: []cmds.Argument{
30 + cmds.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to be outputted.").EnableStdin(),
31 },
33 - Options: []cmdkit.Option{
34 - cmdkit.Int64Option(offsetOptionName, "o", "Byte offset to begin reading from."),
35 - cmdkit.Int64Option(lengthOptionName, "l", "Maximum number of bytes to read."),
32 + Options: []cmds.Option{
33 + cmds.Int64Option(offsetOptionName, "o", "Byte offset to begin reading from."),
34 + cmds.Int64Option(lengthOptionName, "l", "Maximum number of bytes to read."),
35 },
36 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
37 api, err := cmdenv.GetApi(env, req)
@@ -66,7 +65,7 @@ var CatCmd = &cmds.Command{
65
66 /*
67 if err := corerepo.ConditionalGC(req.Context, node, length); err != nil {
69 - re.SetError(err, cmdkit.ErrNormal)
68 + re.SetError(err, cmds.ErrNormal)
69 return
70 }
71 */
core/commands/cid.go
+19 -20
@@ -9,7 +9,6 @@ import (
9
10 cid "github.com/ipfs/go-cid"
11 cidutil "github.com/ipfs/go-cidutil"
12 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
12 cmds "github.com/ipfs/go-ipfs-cmds"
13 verifcid "github.com/ipfs/go-verifcid"
14 mbase "github.com/multiformats/go-multibase"
@@ -17,7 +16,7 @@ import (
16 )
17
18 var CidCmd = &cmds.Command{
20 - Helptext: cmdkit.HelpText{
19 + Helptext: cmds.HelpText{
20 Tagline: "Convert and discover properties of CIDs",
21 },
22 Subcommands: map[string]*cmds.Command{
@@ -36,7 +35,7 @@ const (
35 )
36
37 var cidFmtCmd = &cmds.Command{
39 - Helptext: cmdkit.HelpText{
38 + Helptext: cmds.HelpText{
39 Tagline: "Format and convert a CID in various useful ways.",
40 LongDescription: `
41 Format and converts <cid>'s in various useful ways.
@@ -44,13 +43,13 @@ Format and converts <cid>'s in various useful ways.
43 The optional format string is a printf style format string:
44 ` + cidutil.FormatRef,
45 },
47 - Arguments: []cmdkit.Argument{
48 - cmdkit.StringArg("cid", true, true, "Cids to format.").EnableStdin(),
46 + Arguments: []cmds.Argument{
47 + cmds.StringArg("cid", true, true, "Cids to format.").EnableStdin(),
48 },
50 - Options: []cmdkit.Option{
51 - cmdkit.StringOption(cidFormatOptionName, "Printf style format string.").WithDefault("%s"),
52 - cmdkit.StringOption(cidVerisonOptionName, "CID version to convert to."),
53 - cmdkit.StringOption(cidMultibaseOptionName, "Multibase to display CID in."),
49 + Options: []cmds.Option{
50 + cmds.StringOption(cidFormatOptionName, "Printf style format string.").WithDefault("%s"),
51 + cmds.StringOption(cidVerisonOptionName, "CID version to convert to."),
52 + cmds.StringOption(cidMultibaseOptionName, "Multibase to display CID in."),
53 },
54 Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error {
55 fmtStr, _ := req.Options[cidFormatOptionName].(string)
@@ -107,11 +106,11 @@ type CidFormatRes struct {
106 }
107
108 var base32Cmd = &cmds.Command{
110 - Helptext: cmdkit.HelpText{
109 + Helptext: cmds.HelpText{
110 Tagline: "Convert CIDs to Base32 CID version 1.",
111 },
113 - Arguments: []cmdkit.Argument{
114 - cmdkit.StringArg("cid", true, true, "Cids to convert.").EnableStdin(),
112 + Arguments: []cmds.Argument{
113 + cmds.StringArg("cid", true, true, "Cids to convert.").EnableStdin(),
114 },
115 Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error {
116 opts := cidFormatOpts{
@@ -226,12 +225,12 @@ const (
225 )
226
227 var basesCmd = &cmds.Command{
229 - Helptext: cmdkit.HelpText{
228 + Helptext: cmds.HelpText{
229 Tagline: "List available multibase encodings.",
230 },
232 - Options: []cmdkit.Option{
233 - cmdkit.BoolOption(prefixOptionName, "also include the single leter prefixes in addition to the code"),
234 - cmdkit.BoolOption(numericOptionName, "also include numeric codes"),
231 + Options: []cmds.Option{
232 + cmds.BoolOption(prefixOptionName, "also include the single leter prefixes in addition to the code"),
233 + cmds.BoolOption(numericOptionName, "also include numeric codes"),
234 },
235 Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error {
236 var res []CodeAndName
@@ -274,11 +273,11 @@ const (
273 )
274
275 var codecsCmd = &cmds.Command{
277 - Helptext: cmdkit.HelpText{
276 + Helptext: cmds.HelpText{
277 Tagline: "List available CID codecs.",
278 },
280 - Options: []cmdkit.Option{
281 - cmdkit.BoolOption(codecsNumericOptionName, "also include numeric codes"),
279 + Options: []cmds.Option{
280 + cmds.BoolOption(codecsNumericOptionName, "also include numeric codes"),
281 },
282 Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error {
283 var res []CodeAndName
@@ -306,7 +305,7 @@ var codecsCmd = &cmds.Command{
305 }
306
307 var hashesCmd = &cmds.Command{
309 - Helptext: cmdkit.HelpText{
308 + Helptext: cmds.HelpText{
309 Tagline: "List available multihashes.",
310 },
311 Options: codecsCmd.Options,
core/commands/cmdenv/cidbase.go
+2 -3
@@ -6,13 +6,12 @@ import (
6
7 cid "github.com/ipfs/go-cid"
8 cidenc "github.com/ipfs/go-cidutil/cidenc"
9 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
9 cmds "github.com/ipfs/go-ipfs-cmds"
10 mbase "github.com/multiformats/go-multibase"
11 )
12
14 -var OptionCidBase = cmdkit.StringOption("cid-base", "Multibase encoding used for version 1 CIDs in output.")
15 -var OptionUpgradeCidV0InOutput = cmdkit.BoolOption("upgrade-cidv0-in-output", "Upgrade version 0 to version 1 CIDs in output.")
13 +var OptionCidBase = cmds.StringOption("cid-base", "Multibase encoding used for version 1 CIDs in output.")
14 +var OptionUpgradeCidV0InOutput = cmds.BoolOption("upgrade-cidv0-in-output", "Upgrade version 0 to version 1 CIDs in output.")
15
16 // GetCidEncoder processes the `cid-base` and `output-cidv1` options and
17 // returns a encoder to use based on those parameters.
core/commands/commands.go
+4 -5
@@ -12,8 +12,7 @@ import (
12 "sort"
13 "strings"
14
15 - "github.com/ipfs/go-ipfs-cmdkit"
16 - cmds "github.com/ipfs/go-ipfs-cmds"
15 + "github.com/ipfs/go-ipfs-cmds"
16 )
17
18 type commandEncoder struct {
@@ -60,12 +59,12 @@ const (
59 // and returns a command that lists the subcommands in that root
60 func CommandsCmd(root *cmds.Command) *cmds.Command {
61 return &cmds.Command{
63 - Helptext: cmdkit.HelpText{
62 + Helptext: cmds.HelpText{
63 Tagline: "List all available commands.",
64 ShortDescription: `Lists all available commands (and subcommands) and exits.`,
65 },
67 - Options: []cmdkit.Option{
68 - cmdkit.BoolOption(flagsOptionName, "f", "Show command flags"),
66 + Options: []cmds.Option{
67 + cmds.BoolOption(flagsOptionName, "f", "Show command flags"),
68 },
69 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
70 rootCmd := cmd2outputCmd("ipfs", root)
core/commands/config.go
+18 -19
@@ -15,7 +15,6 @@ import (
15 "github.com/ipfs/go-ipfs/repo/fsrepo"
16
17 "github.com/elgris/jsondiff"
18 - "github.com/ipfs/go-ipfs-cmdkit"
18 "github.com/ipfs/go-ipfs-cmds"
19 "github.com/ipfs/go-ipfs-config"
20 )
@@ -38,7 +37,7 @@ const (
37 )
38
39 var ConfigCmd = &cmds.Command{
41 - Helptext: cmdkit.HelpText{
40 + Helptext: cmds.HelpText{
41 Tagline: "Get and set ipfs config values.",
42 ShortDescription: `
43 'ipfs config' controls configuration variables. It works like 'git config'.
@@ -66,13 +65,13 @@ Set the value of the 'Datastore.Path' key:
65 "replace": configReplaceCmd,
66 "profile": configProfileCmd,
67 },
69 - Arguments: []cmdkit.Argument{
70 - cmdkit.StringArg("key", true, false, "The key of the config entry (e.g. \"Addresses.API\")."),
71 - cmdkit.StringArg("value", false, false, "The value to set the config entry to."),
68 + Arguments: []cmds.Argument{
69 + cmds.StringArg("key", true, false, "The key of the config entry (e.g. \"Addresses.API\")."),
70 + cmds.StringArg("value", false, false, "The value to set the config entry to."),
71 },
73 - Options: []cmdkit.Option{
74 - cmdkit.BoolOption(configBoolOptionName, "Set a boolean value."),
75 - cmdkit.BoolOption(configJSONOptionName, "Parse stringified JSON."),
72 + Options: []cmds.Option{
73 + cmds.BoolOption(configBoolOptionName, "Set a boolean value."),
74 + cmds.BoolOption(configJSONOptionName, "Parse stringified JSON."),
75 },
76 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
77 args := req.Arguments
@@ -142,7 +141,7 @@ Set the value of the 'Datastore.Path' key:
141 }
142
143 var configShowCmd = &cmds.Command{
145 - Helptext: cmdkit.HelpText{
144 + Helptext: cmds.HelpText{
145 Tagline: "Output config file contents.",
146 ShortDescription: `
147 NOTE: For security reasons, this command will omit your private key. If you would like to make a full backup of your config (private key included), you must copy the config file from your repo.
@@ -233,7 +232,7 @@ func scrubValue(m map[string]interface{}, key []string) error {
232 }
233
234 var configEditCmd = &cmds.Command{
236 - Helptext: cmdkit.HelpText{
235 + Helptext: cmds.HelpText{
236 Tagline: "Open the config file for editing in $EDITOR.",
237 ShortDescription: `
238 To use 'ipfs config edit', you must have the $EDITOR environment
@@ -257,7 +256,7 @@ variable set to your preferred text editor.
256 }
257
258 var configReplaceCmd = &cmds.Command{
260 - Helptext: cmdkit.HelpText{
259 + Helptext: cmds.HelpText{
260 Tagline: "Replace the config with <file>.",
261 ShortDescription: `
262 Make sure to back up the config file first if necessary, as this operation
@@ -265,8 +264,8 @@ can't be undone.
264 `,
265 },
266
268 - Arguments: []cmdkit.Argument{
269 - cmdkit.FileArg("file", true, false, "The file to use as the new config."),
267 + Arguments: []cmds.Argument{
268 + cmds.FileArg("file", true, false, "The file to use as the new config."),
269 },
270 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
271 cfgRoot, err := cmdenv.GetConfigRoot(env)
@@ -291,7 +290,7 @@ can't be undone.
290 }
291
292 var configProfileCmd = &cmds.Command{
294 - Helptext: cmdkit.HelpText{
293 + Helptext: cmds.HelpText{
294 Tagline: "Apply profiles to config.",
295 ShortDescription: fmt.Sprintf(`
296 Available profiles:
@@ -305,14 +304,14 @@ Available profiles:
304 }
305
306 var configProfileApplyCmd = &cmds.Command{
308 - Helptext: cmdkit.HelpText{
307 + Helptext: cmds.HelpText{
308 Tagline: "Apply profile to config.",
309 },
311 - Options: []cmdkit.Option{
312 - cmdkit.BoolOption(configDryRunOptionName, "print difference between the current config and the config that would be generated"),
310 + Options: []cmds.Option{
311 + cmds.BoolOption(configDryRunOptionName, "print difference between the current config and the config that would be generated"),
312 },
314 - Arguments: []cmdkit.Argument{
315 - cmdkit.StringArg("profile", true, false, "The profile to apply to the config."),
313 + Arguments: []cmds.Argument{
314 + cmds.StringArg("profile", true, false, "The profile to apply to the config."),
315 },
316 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
317 profile, ok := config.Profiles[req.Arguments[0]]
core/commands/dag/dag.go
+15 -16
@@ -11,7 +11,6 @@ import (
11
12 cid "github.com/ipfs/go-cid"
13 cidenc "github.com/ipfs/go-cidutil/cidenc"
14 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
14 cmds "github.com/ipfs/go-ipfs-cmds"
15 files "github.com/ipfs/go-ipfs-files"
16 ipld "github.com/ipfs/go-ipld-format"
@@ -21,7 +20,7 @@ import (
20 )
21
22 var DagCmd = &cmds.Command{
24 - Helptext: cmdkit.HelpText{
23 + Helptext: cmds.HelpText{
24 Tagline: "Interact with ipld dag objects.",
25 ShortDescription: `
26 'ipfs dag' is used for creating and manipulating dag objects.
@@ -49,21 +48,21 @@ type ResolveOutput struct {
48 }
49
50 var DagPutCmd = &cmds.Command{
52 - Helptext: cmdkit.HelpText{
51 + Helptext: cmds.HelpText{
52 Tagline: "Add a dag node to ipfs.",
53 ShortDescription: `
54 'ipfs dag put' accepts input from a file or stdin and parses it
55 into an object of the specified format.
56 `,
57 },
59 - Arguments: []cmdkit.Argument{
60 - cmdkit.FileArg("object data", true, true, "The object to put").EnableStdin(),
58 + Arguments: []cmds.Argument{
59 + cmds.FileArg("object data", true, true, "The object to put").EnableStdin(),
60 },
62 - Options: []cmdkit.Option{
63 - cmdkit.StringOption("format", "f", "Format that the object will be added as.").WithDefault("cbor"),
64 - cmdkit.StringOption("input-enc", "Format that the input object will be.").WithDefault("json"),
65 - cmdkit.BoolOption("pin", "Pin this object when adding."),
66 - cmdkit.StringOption("hash", "Hash function to use").WithDefault(""),
61 + Options: []cmds.Option{
62 + cmds.StringOption("format", "f", "Format that the object will be added as.").WithDefault("cbor"),
63 + cmds.StringOption("input-enc", "Format that the input object will be.").WithDefault("json"),
64 + cmds.BoolOption("pin", "Pin this object when adding."),
65 + cmds.StringOption("hash", "Hash function to use").WithDefault(""),
66 },
67 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
68 api, err := cmdenv.GetApi(env, req)
@@ -144,15 +143,15 @@ into an object of the specified format.
143 }
144
145 var DagGetCmd = &cmds.Command{
147 - Helptext: cmdkit.HelpText{
146 + Helptext: cmds.HelpText{
147 Tagline: "Get a dag node from ipfs.",
148 ShortDescription: `
149 'ipfs dag get' fetches a dag node from ipfs and prints it out in the specified
150 format.
151 `,
152 },
154 - Arguments: []cmdkit.Argument{
155 - cmdkit.StringArg("ref", true, false, "The object to get").EnableStdin(),
153 + Arguments: []cmds.Argument{
154 + cmds.StringArg("ref", true, false, "The object to get").EnableStdin(),
155 },
156 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
157 api, err := cmdenv.GetApi(env, req)
@@ -185,14 +184,14 @@ format.
184
185 // DagResolveCmd returns address of highest block within a path and a path remainder
186 var DagResolveCmd = &cmds.Command{
188 - Helptext: cmdkit.HelpText{
187 + Helptext: cmds.HelpText{
188 Tagline: "Resolve ipld block",
189 ShortDescription: `
190 'ipfs dag resolve' fetches a dag node from ipfs, prints it's address and remaining path.
191 `,
192 },
194 - Arguments: []cmdkit.Argument{
195 - cmdkit.StringArg("ref", true, false, "The path to resolve").EnableStdin(),
193 + Arguments: []cmds.Argument{
194 + cmds.StringArg("ref", true, false, "The path to resolve").EnableStdin(),
195 },
196 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
197 api, err := cmdenv.GetApi(env, req)
core/commands/dht.go
+34 -35
@@ -10,7 +10,6 @@ import (
10 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
11
12 cid "github.com/ipfs/go-cid"
13 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
13 cmds "github.com/ipfs/go-ipfs-cmds"
14 ipld "github.com/ipfs/go-ipld-format"
15 dag "github.com/ipfs/go-merkledag"
@@ -28,7 +27,7 @@ var ErrNotDHT = errors.New("routing service is not a DHT")
27 // Everything *except `query` goes into `ipfs routing`.
28
29 var DhtCmd = &cmds.Command{
31 - Helptext: cmdkit.HelpText{
30 + Helptext: cmds.HelpText{
31 Tagline: "Issue commands directly through the DHT.",
32 ShortDescription: ``,
33 },
@@ -48,16 +47,16 @@ const (
47 )
48
49 var queryDhtCmd = &cmds.Command{
51 - Helptext: cmdkit.HelpText{
50 + Helptext: cmds.HelpText{
51 Tagline: "Find the closest Peer IDs to a given Peer ID by querying the DHT.",
52 ShortDescription: "Outputs a list of newline-delimited Peer IDs.",
53 },
54
56 - Arguments: []cmdkit.Argument{
57 - cmdkit.StringArg("peerID", true, true, "The peerID to run the query against."),
55 + Arguments: []cmds.Argument{
56 + cmds.StringArg("peerID", true, true, "The peerID to run the query against."),
57 },
59 - Options: []cmdkit.Option{
60 - cmdkit.BoolOption(dhtVerboseOptionName, "v", "Print extra information."),
58 + Options: []cmds.Option{
59 + cmds.BoolOption(dhtVerboseOptionName, "v", "Print extra information."),
60 },
61 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
62 nd, err := cmdenv.GetNode(env)
@@ -123,17 +122,17 @@ const (
122 )
123
124 var findProvidersDhtCmd = &cmds.Command{
126 - Helptext: cmdkit.HelpText{
125 + Helptext: cmds.HelpText{
126 Tagline: "Find peers that can provide a specific value, given a key.",
127 ShortDescription: "Outputs a list of newline-delimited provider Peer IDs.",
128 },
129
131 - Arguments: []cmdkit.Argument{
132 - cmdkit.StringArg("key", true, true, "The key to find providers for."),
130 + Arguments: []cmds.Argument{
131 + cmds.StringArg("key", true, true, "The key to find providers for."),
132 },
134 - Options: []cmdkit.Option{
135 - cmdkit.BoolOption(dhtVerboseOptionName, "v", "Print extra information."),
136 - cmdkit.IntOption(numProvidersOptionName, "n", "The number of providers to find.").WithDefault(20),
133 + Options: []cmds.Option{
134 + cmds.BoolOption(dhtVerboseOptionName, "v", "Print extra information."),
135 + cmds.IntOption(numProvidersOptionName, "n", "The number of providers to find.").WithDefault(20),
136 },
137 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
138 n, err := cmdenv.GetNode(env)
@@ -215,16 +214,16 @@ const (
214 )
215
216 var provideRefDhtCmd = &cmds.Command{
218 - Helptext: cmdkit.HelpText{
217 + Helptext: cmds.HelpText{
218 Tagline: "Announce to the network that you are providing given values.",
219 },
220
222 - Arguments: []cmdkit.Argument{
223 - cmdkit.StringArg("key", true, true, "The key[s] to send provide records for.").EnableStdin(),
221 + Arguments: []cmds.Argument{
222 + cmds.StringArg("key", true, true, "The key[s] to send provide records for.").EnableStdin(),
223 },
225 - Options: []cmdkit.Option{
226 - cmdkit.BoolOption(dhtVerboseOptionName, "v", "Print extra information."),
227 - cmdkit.BoolOption(recursiveOptionName, "r", "Recursively provide entire graph."),
224 + Options: []cmds.Option{
225 + cmds.BoolOption(dhtVerboseOptionName, "v", "Print extra information."),
226 + cmds.BoolOption(recursiveOptionName, "r", "Recursively provide entire graph."),
227 },
228 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
229 nd, err := cmdenv.GetNode(env)
@@ -344,16 +343,16 @@ func provideKeysRec(ctx context.Context, r routing.IpfsRouting, dserv ipld.DAGSe
343 }
344
345 var findPeerDhtCmd = &cmds.Command{
347 - Helptext: cmdkit.HelpText{
346 + Helptext: cmds.HelpText{
347 Tagline: "Find the multiaddresses associated with a Peer ID.",
348 ShortDescription: "Outputs a list of newline-delimited multiaddresses.",
349 },
350
352 - Arguments: []cmdkit.Argument{
353 - cmdkit.StringArg("peerID", true, true, "The ID of the peer to search for."),
351 + Arguments: []cmds.Argument{
352 + cmds.StringArg("peerID", true, true, "The ID of the peer to search for."),
353 },
355 - Options: []cmdkit.Option{
356 - cmdkit.BoolOption(dhtVerboseOptionName, "v", "Print extra information."),
354 + Options: []cmds.Option{
355 + cmds.BoolOption(dhtVerboseOptionName, "v", "Print extra information."),
356 },
357 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
358 nd, err := cmdenv.GetNode(env)
@@ -420,7 +419,7 @@ var findPeerDhtCmd = &cmds.Command{
419 }
420
421 var getValueDhtCmd = &cmds.Command{
423 - Helptext: cmdkit.HelpText{
422 + Helptext: cmds.HelpText{
423 Tagline: "Given a key, query the routing system for its best value.",
424 ShortDescription: `
425 Outputs the best value for the given key.
@@ -433,11 +432,11 @@ Different key types can specify other 'best' rules.
432 `,
433 },
434
436 - Arguments: []cmdkit.Argument{
437 - cmdkit.StringArg("key", true, true, "The key to find a value for."),
435 + Arguments: []cmds.Argument{
436 + cmds.StringArg("key", true, true, "The key to find a value for."),
437 },
439 - Options: []cmdkit.Option{
440 - cmdkit.BoolOption(dhtVerboseOptionName, "v", "Print extra information."),
438 + Options: []cmds.Option{
439 + cmds.BoolOption(dhtVerboseOptionName, "v", "Print extra information."),
440 },
441 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
442 nd, err := cmdenv.GetNode(env)
@@ -505,7 +504,7 @@ Different key types can specify other 'best' rules.
504 }
505
506 var putValueDhtCmd = &cmds.Command{
508 - Helptext: cmdkit.HelpText{
507 + Helptext: cmds.HelpText{
508 Tagline: "Write a key/value pair to the routing system.",
509 ShortDescription: `
510 Given a key of the form /foo/bar and a value of any form, this will write that
@@ -526,12 +525,12 @@ NOTE: A value may not exceed 2048 bytes.
525 `,
526 },
527
529 - Arguments: []cmdkit.Argument{
530 - cmdkit.StringArg("key", true, false, "The key to store the value at."),
531 - cmdkit.StringArg("value", true, false, "The value to store.").EnableStdin(),
528 + Arguments: []cmds.Argument{
529 + cmds.StringArg("key", true, false, "The key to store the value at."),
530 + cmds.StringArg("value", true, false, "The value to store.").EnableStdin(),
531 },
533 - Options: []cmdkit.Option{
534 - cmdkit.BoolOption(dhtVerboseOptionName, "v", "Print extra information."),
532 + Options: []cmds.Option{
533 + cmds.BoolOption(dhtVerboseOptionName, "v", "Print extra information."),
534 },
535 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
536 nd, err := cmdenv.GetNode(env)
core/commands/diag.go
+1 -2
@@ -1,12 +1,11 @@
1 package commands
2
3 import (
4 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
4 cmds "github.com/ipfs/go-ipfs-cmds"
5 )
6
7 var DiagCmd = &cmds.Command{
9 - Helptext: cmdkit.HelpText{
8 + Helptext: cmds.HelpText{
9 Tagline: "Generate diagnostic reports.",
10 },
11
core/commands/dns.go
+5 -6
@@ -8,7 +8,6 @@ import (
8 namesys "github.com/ipfs/go-ipfs/namesys"
9 nsopts "github.com/ipfs/interface-go-ipfs-core/options/namesys"
10
11 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
11 cmds "github.com/ipfs/go-ipfs-cmds"
12 )
13
@@ -17,7 +16,7 @@ const (
16 )
17
18 var DNSCmd = &cmds.Command{
20 - Helptext: cmdkit.HelpText{
19 + Helptext: cmds.HelpText{
20 Tagline: "Resolve DNS links.",
21 ShortDescription: `
22 Multihashes are hard to remember, but domain names are usually easy to
@@ -54,11 +53,11 @@ The resolver can recursively resolve:
53 `,
54 },
55
57 - Arguments: []cmdkit.Argument{
58 - cmdkit.StringArg("domain-name", true, false, "The domain-name name to resolve.").EnableStdin(),
56 + Arguments: []cmds.Argument{
57 + cmds.StringArg("domain-name", true, false, "The domain-name name to resolve.").EnableStdin(),
58 },
60 - Options: []cmdkit.Option{
61 - cmdkit.BoolOption(dnsRecursiveOptionName, "r", "Resolve until the result is not a DNS link.").WithDefault(true),
59 + Options: []cmds.Option{
60 + cmds.BoolOption(dnsRecursiveOptionName, "r", "Resolve until the result is not a DNS link.").WithDefault(true),
61 },
62 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
63 recursive, _ := req.Options[dnsRecursiveOptionName].(bool)
core/commands/external.go
+2 -3
@@ -8,14 +8,13 @@ import (
8 "os/exec"
9 "strings"
10
11 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
11 cmds "github.com/ipfs/go-ipfs-cmds"
12 )
13
14 func ExternalBinary() *cmds.Command {
15 return &cmds.Command{
17 - Arguments: []cmdkit.Argument{
18 - cmdkit.StringArg("args", false, true, "Arguments for subcommand."),
16 + Arguments: []cmds.Argument{
17 + cmds.StringArg("args", false, true, "Arguments for subcommand."),
18 },
19 External: true,
20 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
core/commands/files.go
+63 -64
@@ -17,7 +17,6 @@ import (
17 bservice "github.com/ipfs/go-blockservice"
18 cid "github.com/ipfs/go-cid"
19 cidenc "github.com/ipfs/go-cidutil/cidenc"
20 - "github.com/ipfs/go-ipfs-cmdkit"
20 "github.com/ipfs/go-ipfs-cmds"
21 "github.com/ipfs/go-ipfs-exchange-offline"
22 ipld "github.com/ipfs/go-ipld-format"
@@ -34,7 +33,7 @@ var flog = logging.Logger("cmds/files")
33
34 // FilesCmd is the 'ipfs files' command
35 var FilesCmd = &cmds.Command{
37 - Helptext: cmdkit.HelpText{
36 + Helptext: cmds.HelpText{
37 Tagline: "Interact with unixfs files.",
38 ShortDescription: `
39 Files is an API for manipulating IPFS objects as if they were a unix
@@ -50,8 +49,8 @@ applies to running 'ipfs repo gc' concurrently with '--flush=false'
49 operations.
50 `,
51 },
53 - Options: []cmdkit.Option{
54 - cmdkit.BoolOption(filesFlushOptionName, "f", "Flush target and ancestors after write.").WithDefault(true),
52 + Options: []cmds.Option{
53 + cmds.BoolOption(filesFlushOptionName, "f", "Flush target and ancestors after write.").WithDefault(true),
54 },
55 Subcommands: map[string]*cmds.Command{
56 "read": filesReadCmd,
@@ -72,8 +71,8 @@ const (
71 filesHashOptionName = "hash"
72 )
73
75 -var cidVersionOption = cmdkit.IntOption(filesCidVersionOptionName, "cid-ver", "Cid version to use. (experimental)")
76 -var hashOption = cmdkit.StringOption(filesHashOptionName, "Hash function to use. Will set Cid version to 1 if used. (experimental)")
74 +var cidVersionOption = cmds.IntOption(filesCidVersionOptionName, "cid-ver", "Cid version to use. (experimental)")
75 +var hashOption = cmds.StringOption(filesHashOptionName, "Hash function to use. Will set Cid version to 1 if used. (experimental)")
76
77 var errFormat = errors.New("format was set by multiple options. Only one format option is allowed")
78
@@ -100,25 +99,25 @@ Type: <type>`
99 )
100
101 var filesStatCmd = &cmds.Command{
103 - Helptext: cmdkit.HelpText{
102 + Helptext: cmds.HelpText{
103 Tagline: "Display file status.",
104 },
105
107 - Arguments: []cmdkit.Argument{
108 - cmdkit.StringArg("path", true, false, "Path to node to stat."),
106 + Arguments: []cmds.Argument{
107 + cmds.StringArg("path", true, false, "Path to node to stat."),
108 },
110 - Options: []cmdkit.Option{
111 - cmdkit.StringOption(filesFormatOptionName, "Print statistics in given format. Allowed tokens: "+
109 + Options: []cmds.Option{
110 + cmds.StringOption(filesFormatOptionName, "Print statistics in given format. Allowed tokens: "+
111 "<hash> <size> <cumulsize> <type> <childs>. Conflicts with other format options.").WithDefault(defaultStatFormat),
113 - cmdkit.BoolOption(filesHashOptionName, "Print only hash. Implies '--format=<hash>'. Conflicts with other format options."),
114 - cmdkit.BoolOption(filesSizeOptionName, "Print only size. Implies '--format=<cumulsize>'. Conflicts with other format options."),
115 - cmdkit.BoolOption(filesWithLocalOptionName, "Compute the amount of the dag that is local, and if possible the total size"),
112 + cmds.BoolOption(filesHashOptionName, "Print only hash. Implies '--format=<hash>'. Conflicts with other format options."),
113 + cmds.BoolOption(filesSizeOptionName, "Print only size. Implies '--format=<cumulsize>'. Conflicts with other format options."),
114 + cmds.BoolOption(filesWithLocalOptionName, "Compute the amount of the dag that is local, and if possible the total size"),
115 },
116 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
117
118 _, err := statGetFormatOptions(req)
119 if err != nil {
121 - return cmdkit.Errorf(cmdkit.ErrClient, err.Error())
120 + return cmds.Errorf(cmds.ErrClient, err.Error())
121 }
122
123 node, err := cmdenv.GetNode(env)
@@ -305,12 +304,12 @@ func walkBlock(ctx context.Context, dagserv ipld.DAGService, nd ipld.Node) (bool
304 }
305
306 var filesCpCmd = &cmds.Command{
308 - Helptext: cmdkit.HelpText{
307 + Helptext: cmds.HelpText{
308 Tagline: "Copy files into mfs.",
309 },
311 - Arguments: []cmdkit.Argument{
312 - cmdkit.StringArg("source", true, false, "Source object to copy."),
313 - cmdkit.StringArg("dest", true, false, "Destination to copy object to."),
310 + Arguments: []cmds.Argument{
311 + cmds.StringArg("source", true, false, "Source object to copy."),
312 + cmds.StringArg("dest", true, false, "Destination to copy object to."),
313 },
314 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
315 nd, err := cmdenv.GetNode(env)
@@ -385,7 +384,7 @@ const (
384 )
385
386 var filesLsCmd = &cmds.Command{
388 - Helptext: cmdkit.HelpText{
387 + Helptext: cmds.HelpText{
388 Tagline: "List directories in the local mutable namespace.",
389 ShortDescription: `
390 List directories in the local mutable namespace.
@@ -405,12 +404,12 @@ Examples:
404 bar
405 `,
406 },
408 - Arguments: []cmdkit.Argument{
409 - cmdkit.StringArg("path", false, false, "Path to show listing for. Defaults to '/'."),
407 + Arguments: []cmds.Argument{
408 + cmds.StringArg("path", false, false, "Path to show listing for. Defaults to '/'."),
409 },
411 - Options: []cmdkit.Option{
412 - cmdkit.BoolOption(longOptionName, "Use long listing format."),
413 - cmdkit.BoolOption(dontSortOptionName, "Do not sort; list entries in directory order."),
410 + Options: []cmds.Option{
411 + cmds.BoolOption(longOptionName, "Use long listing format."),
412 + cmds.BoolOption(dontSortOptionName, "Do not sort; list entries in directory order."),
413 },
414 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
415 var arg string
@@ -520,7 +519,7 @@ const (
519 )
520
521 var filesReadCmd = &cmds.Command{
523 - Helptext: cmdkit.HelpText{
522 + Helptext: cmds.HelpText{
523 Tagline: "Read a file in a given mfs.",
524 ShortDescription: `
525 Read a specified number of bytes from a file at a given offset. By default,
@@ -533,12 +532,12 @@ Examples:
532 `,
533 },
534
536 - Arguments: []cmdkit.Argument{
537 - cmdkit.StringArg("path", true, false, "Path to file to be read."),
535 + Arguments: []cmds.Argument{
536 + cmds.StringArg("path", true, false, "Path to file to be read."),
537 },
539 - Options: []cmdkit.Option{
540 - cmdkit.Int64Option(filesOffsetOptionName, "o", "Byte offset to begin reading from."),
541 - cmdkit.Int64Option(filesCountOptionName, "n", "Maximum number of bytes to read."),
538 + Options: []cmds.Option{
539 + cmds.Int64Option(filesOffsetOptionName, "o", "Byte offset to begin reading from."),
540 + cmds.Int64Option(filesCountOptionName, "n", "Maximum number of bytes to read."),
541 },
542 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
543 nd, err := cmdenv.GetNode(env)
@@ -613,7 +612,7 @@ func (crw *contextReaderWrapper) Read(b []byte) (int, error) {
612 }
613
614 var filesMvCmd = &cmds.Command{
616 - Helptext: cmdkit.HelpText{
615 + Helptext: cmds.HelpText{
616 Tagline: "Move files.",
617 ShortDescription: `
618 Move files around. Just like traditional unix mv.
@@ -625,9 +624,9 @@ Example:
624 `,
625 },
626
628 - Arguments: []cmdkit.Argument{
629 - cmdkit.StringArg("source", true, false, "Source file to move."),
630 - cmdkit.StringArg("dest", true, false, "Destination path for file to be moved to."),
627 + Arguments: []cmds.Argument{
628 + cmds.StringArg("source", true, false, "Source file to move."),
629 + cmds.StringArg("dest", true, false, "Destination path for file to be moved to."),
630 },
631 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
632 nd, err := cmdenv.GetNode(env)
@@ -663,7 +662,7 @@ const (
662 )
663
664 var filesWriteCmd = &cmds.Command{
666 - Helptext: cmdkit.HelpText{
665 + Helptext: cmds.HelpText{
666 Tagline: "Write to a mutable file in a given filesystem.",
667 ShortDescription: `
668 Write data to a file in a given filesystem. This command allows you to specify
@@ -696,17 +695,17 @@ the tree has been flushed. This can be accomplished by running 'ipfs files
695 stat' on the file or any of its ancestors.
696 `,
697 },
699 - Arguments: []cmdkit.Argument{
700 - cmdkit.StringArg("path", true, false, "Path to write to."),
701 - cmdkit.FileArg("data", true, false, "Data to write.").EnableStdin(),
698 + Arguments: []cmds.Argument{
699 + cmds.StringArg("path", true, false, "Path to write to."),
700 + cmds.FileArg("data", true, false, "Data to write.").EnableStdin(),
701 },
703 - Options: []cmdkit.Option{
704 - cmdkit.Int64Option(filesOffsetOptionName, "o", "Byte offset to begin writing at."),
705 - cmdkit.BoolOption(filesCreateOptionName, "e", "Create the file if it does not exist."),
706 - cmdkit.BoolOption(filesParentsOptionName, "p", "Make parent directories as needed."),
707 - cmdkit.BoolOption(filesTruncateOptionName, "t", "Truncate the file to size zero before writing."),
708 - cmdkit.Int64Option(filesCountOptionName, "n", "Maximum number of bytes to read."),
709 - cmdkit.BoolOption(filesRawLeavesOptionName, "Use raw blocks for newly created leaf nodes. (experimental)"),
702 + Options: []cmds.Option{
703 + cmds.Int64Option(filesOffsetOptionName, "o", "Byte offset to begin writing at."),
704 + cmds.BoolOption(filesCreateOptionName, "e", "Create the file if it does not exist."),
705 + cmds.BoolOption(filesParentsOptionName, "p", "Make parent directories as needed."),
706 + cmds.BoolOption(filesTruncateOptionName, "t", "Truncate the file to size zero before writing."),
707 + cmds.Int64Option(filesCountOptionName, "n", "Maximum number of bytes to read."),
708 + cmds.BoolOption(filesRawLeavesOptionName, "Use raw blocks for newly created leaf nodes. (experimental)"),
709 cidVersionOption,
710 hashOption,
711 },
@@ -800,7 +799,7 @@ stat' on the file or any of its ancestors.
799 }
800
801 var filesMkdirCmd = &cmds.Command{
803 - Helptext: cmdkit.HelpText{
802 + Helptext: cmds.HelpText{
803 Tagline: "Make directories.",
804 ShortDescription: `
805 Create the directory if it does not already exist.
@@ -817,11 +816,11 @@ Examples:
816 `,
817 },
818
820 - Arguments: []cmdkit.Argument{
821 - cmdkit.StringArg("path", true, false, "Path to dir to make."),
819 + Arguments: []cmds.Argument{
820 + cmds.StringArg("path", true, false, "Path to dir to make."),
821 },
823 - Options: []cmdkit.Option{
824 - cmdkit.BoolOption(filesParentsOptionName, "p", "No error if existing, make parent directories as needed."),
822 + Options: []cmds.Option{
823 + cmds.BoolOption(filesParentsOptionName, "p", "No error if existing, make parent directories as needed."),
824 cidVersionOption,
825 hashOption,
826 },
@@ -860,15 +859,15 @@ type flushRes struct {
859 }
860
861 var filesFlushCmd = &cmds.Command{
863 - Helptext: cmdkit.HelpText{
862 + Helptext: cmds.HelpText{
863 Tagline: "Flush a given path's data to disk.",
864 ShortDescription: `
865 Flush a given path to disk. This is only useful when other commands
866 are run with the '--flush=false'.
867 `,
868 },
870 - Arguments: []cmdkit.Argument{
871 - cmdkit.StringArg("path", false, false, "Path to flush. Default: '/'."),
869 + Arguments: []cmds.Argument{
870 + cmds.StringArg("path", false, false, "Path to flush. Default: '/'."),
871 },
872 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
873 nd, err := cmdenv.GetNode(env)
@@ -897,16 +896,16 @@ are run with the '--flush=false'.
896 }
897
898 var filesChcidCmd = &cmds.Command{
900 - Helptext: cmdkit.HelpText{
899 + Helptext: cmds.HelpText{
900 Tagline: "Change the cid version or hash function of the root node of a given path.",
901 ShortDescription: `
902 Change the cid version or hash function of the root node of a given path.
903 `,
904 },
906 - Arguments: []cmdkit.Argument{
907 - cmdkit.StringArg("path", false, false, "Path to change. Default: '/'."),
905 + Arguments: []cmds.Argument{
906 + cmds.StringArg("path", false, false, "Path to change. Default: '/'."),
907 },
909 - Options: []cmdkit.Option{
908 + Options: []cmds.Option{
909 cidVersionOption,
910 hashOption,
911 },
@@ -957,7 +956,7 @@ func updatePath(rt *mfs.Root, pth string, builder cid.Builder) error {
956 }
957
958 var filesRmCmd = &cmds.Command{
960 - Helptext: cmdkit.HelpText{
959 + Helptext: cmds.HelpText{
960 Tagline: "Remove a file.",
961 ShortDescription: `
962 Remove files or directories.
@@ -971,12 +970,12 @@ Remove files or directories.
970 `,
971 },
972
974 - Arguments: []cmdkit.Argument{
975 - cmdkit.StringArg("path", true, true, "File to remove."),
973 + Arguments: []cmds.Argument{
974 + cmds.StringArg("path", true, true, "File to remove."),
975 },
977 - Options: []cmdkit.Option{
978 - cmdkit.BoolOption(recursiveOptionName, "r", "Recursively remove directories."),
979 - cmdkit.BoolOption(forceOptionName, "Forcibly remove target at path; implies -r for directories"),
976 + Options: []cmds.Option{
977 + cmds.BoolOption(recursiveOptionName, "r", "Recursively remove directories."),
978 + cmds.BoolOption(forceOptionName, "Forcibly remove target at path; implies -r for directories"),
979 },
980 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
981 nd, err := cmdenv.GetNode(env)
core/commands/filestore.go
+14 -15
@@ -10,13 +10,12 @@ import (
10 e "github.com/ipfs/go-ipfs/core/commands/e"
11 filestore "github.com/ipfs/go-ipfs/filestore"
12
13 - cid "github.com/ipfs/go-cid"
14 - "github.com/ipfs/go-ipfs-cmdkit"
15 - cmds "github.com/ipfs/go-ipfs-cmds"
13 + "github.com/ipfs/go-cid"
14 + "github.com/ipfs/go-ipfs-cmds"
15 )
16
17 var FileStoreCmd = &cmds.Command{
19 - Helptext: cmdkit.HelpText{
18 + Helptext: cmds.HelpText{
19 Tagline: "Interact with filestore objects.",
20 },
21 Subcommands: map[string]*cmds.Command{
@@ -31,7 +30,7 @@ const (
30 )
31
32 var lsFileStore = &cmds.Command{
34 - Helptext: cmdkit.HelpText{
33 + Helptext: cmds.HelpText{
34 Tagline: "List objects in filestore.",
35 LongDescription: `
36 List objects in the filestore.
@@ -44,11 +43,11 @@ The output is:
43 <hash> <size> <path> <offset>
44 `,
45 },
47 - Arguments: []cmdkit.Argument{
48 - cmdkit.StringArg("obj", false, true, "Cid of objects to list."),
46 + Arguments: []cmds.Argument{
47 + cmds.StringArg("obj", false, true, "Cid of objects to list."),
48 },
50 - Options: []cmdkit.Option{
51 - cmdkit.BoolOption(fileOrderOptionName, "sort the results based on the path of the backing file"),
49 + Options: []cmds.Option{
50 + cmds.BoolOption(fileOrderOptionName, "sort the results based on the path of the backing file"),
51 },
52 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
53 _, fs, err := getFilestore(env)
@@ -98,7 +97,7 @@ The output is:
97 }
98
99 var verifyFileStore = &cmds.Command{
101 - Helptext: cmdkit.HelpText{
100 + Helptext: cmds.HelpText{
101 Tagline: "Verify objects in filestore.",
102 LongDescription: `
103 Verify objects in the filestore.
@@ -121,11 +120,11 @@ ERROR: internal error, most likely due to a corrupt database
120 For ERROR entries the error will also be printed to stderr.
121 `,
122 },
124 - Arguments: []cmdkit.Argument{
125 - cmdkit.StringArg("obj", false, true, "Cid of objects to verify."),
123 + Arguments: []cmds.Argument{
124 + cmds.StringArg("obj", false, true, "Cid of objects to verify."),
125 },
127 - Options: []cmdkit.Option{
128 - cmdkit.BoolOption(fileOrderOptionName, "verify the objects based on the order of the backing file"),
126 + Options: []cmds.Option{
127 + cmds.BoolOption(fileOrderOptionName, "verify the objects based on the order of the backing file"),
128 },
129 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
130 _, fs, err := getFilestore(env)
@@ -187,7 +186,7 @@ For ERROR entries the error will also be printed to stderr.
186 }
187
188 var dupsFileStore = &cmds.Command{
190 - Helptext: cmdkit.HelpText{
189 + Helptext: cmds.HelpText{
190 Tagline: "List blocks that are both in the filestore and standard block storage.",
191 },
192 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
core/commands/get.go
+8 -9
@@ -14,7 +14,6 @@ import (
14 "github.com/ipfs/go-ipfs/core/commands/cmdenv"
15 "github.com/ipfs/go-ipfs/core/commands/e"
16
17 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
17 cmds "github.com/ipfs/go-ipfs-cmds"
18 files "github.com/ipfs/go-ipfs-files"
19 "github.com/ipfs/interface-go-ipfs-core/path"
@@ -32,7 +31,7 @@ const (
31 )
32
33 var GetCmd = &cmds.Command{
35 - Helptext: cmdkit.HelpText{
34 + Helptext: cmds.HelpText{
35 Tagline: "Download IPFS objects.",
36 ShortDescription: `
37 Stores to disk the data contained an IPFS or IPNS object(s) at the given path.
@@ -47,14 +46,14 @@ may also specify the level of compression by specifying '-l=<1-9>'.
46 `,
47 },
48
50 - Arguments: []cmdkit.Argument{
51 - cmdkit.StringArg("ipfs-path", true, false, "The path to the IPFS object(s) to be outputted.").EnableStdin(),
49 + Arguments: []cmds.Argument{
50 + cmds.StringArg("ipfs-path", true, false, "The path to the IPFS object(s) to be outputted.").EnableStdin(),
51 },
53 - Options: []cmdkit.Option{
54 - cmdkit.StringOption(outputOptionName, "o", "The path where the output should be stored."),
55 - cmdkit.BoolOption(archiveOptionName, "a", "Output a TAR archive."),
56 - cmdkit.BoolOption(compressOptionName, "C", "Compress the output with GZIP compression."),
57 - cmdkit.IntOption(compressionLevelOptionName, "l", "The level of compression (1-9)."),
52 + Options: []cmds.Option{
53 + cmds.StringOption(outputOptionName, "o", "The path where the output should be stored."),
54 + cmds.BoolOption(archiveOptionName, "a", "Output a TAR archive."),
55 + cmds.BoolOption(compressOptionName, "C", "Compress the output with GZIP compression."),
56 + cmds.IntOption(compressionLevelOptionName, "l", "The level of compression (1-9)."),
57 },
58 PreRun: func(req *cmds.Request, env cmds.Environment) error {
59 _, err := getCompressOptions(req)
core/commands/get_test.go
+5 -6
@@ -5,14 +5,13 @@ import (
5 "fmt"
6 "testing"
7
8 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
8 cmds "github.com/ipfs/go-ipfs-cmds"
9 )
10
11 func TestGetOutputPath(t *testing.T) {
12 cases := []struct {
13 args []string
15 - opts cmdkit.OptMap
14 + opts cmds.OptMap
15 outPath string
16 }{
17 {
@@ -24,7 +23,7 @@ func TestGetOutputPath(t *testing.T) {
23 },
24 {
25 args: []string{"/ipns/multiformats.io/", "some-other-arg-to-be-ignored"},
27 - opts: cmdkit.OptMap{
26 + opts: cmds.OptMap{
27 "output": "takes-precedence",
28 },
29 outPath: "takes-precedence",
@@ -32,17 +31,17 @@ func TestGetOutputPath(t *testing.T) {
31 {
32 args: []string{"/ipns/multiformats.io/"},
33 outPath: "multiformats.io",
35 - opts: cmdkit.OptMap{},
34 + opts: cmds.OptMap{},
35 },
36 {
37 args: []string{"/ipns/multiformats.io/logo.svg/"},
38 outPath: "logo.svg",
40 - opts: cmdkit.OptMap{},
39 + opts: cmds.OptMap{},
40 },
41 {
42 args: []string{"/ipns/multiformats.io", "some-other-arg-to-be-ignored"},
43 outPath: "multiformats.io",
45 - opts: cmdkit.OptMap{},
44 + opts: cmds.OptMap{},
45 },
46 }
47
core/commands/id.go
+6 -7
@@ -11,11 +11,10 @@ import (
11 core "github.com/ipfs/go-ipfs/core"
12 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
13
14 - "github.com/ipfs/go-ipfs-cmdkit"
14 cmds "github.com/ipfs/go-ipfs-cmds"
15 ic "github.com/libp2p/go-libp2p-crypto"
16 kb "github.com/libp2p/go-libp2p-kbucket"
18 - "github.com/libp2p/go-libp2p-peer"
17 + peer "github.com/libp2p/go-libp2p-peer"
18 pstore "github.com/libp2p/go-libp2p-peerstore"
19 identify "github.com/libp2p/go-libp2p/p2p/protocol/identify"
20 )
@@ -42,7 +41,7 @@ const (
41 )
42
43 var IDCmd = &cmds.Command{
45 - Helptext: cmdkit.HelpText{
44 + Helptext: cmds.HelpText{
45 Tagline: "Show ipfs node id info.",
46 ShortDescription: `
47 Prints out information about the specified peer.
@@ -60,11 +59,11 @@ EXAMPLE:
59 ipfs id Qmece2RkXhsKe5CRooNisBTh4SK119KrXXGmoK6V3kb8aH -f="<addrs>\n"
60 `,
61 },
63 - Arguments: []cmdkit.Argument{
64 - cmdkit.StringArg("peerid", false, false, "Peer.ID of node to look up."),
62 + Arguments: []cmds.Argument{
63 + cmds.StringArg("peerid", false, false, "Peer.ID of node to look up."),
64 },
66 - Options: []cmdkit.Option{
67 - cmdkit.StringOption(formatOptionName, "f", "Optional output format."),
65 + Options: []cmds.Option{
66 + cmds.StringOption(formatOptionName, "f", "Optional output format."),
67 },
68 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
69 n, err := cmdenv.GetNode(env)
core/commands/keystore.go
+21 -22
@@ -7,13 +7,12 @@ import (
7
8 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
9
10 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
10 cmds "github.com/ipfs/go-ipfs-cmds"
11 options "github.com/ipfs/interface-go-ipfs-core/options"
12 )
13
14 var KeyCmd = &cmds.Command{
16 - Helptext: cmdkit.HelpText{
15 + Helptext: cmds.HelpText{
16 Tagline: "Create and list IPNS name keypairs",
17 ShortDescription: `
18 'ipfs key gen' generates a new keypair for usage with IPNS and 'ipfs name
@@ -60,15 +59,15 @@ const (
59 )
60
61 var keyGenCmd = &cmds.Command{
63 - Helptext: cmdkit.HelpText{
62 + Helptext: cmds.HelpText{
63 Tagline: "Create a new keypair",
64 },
66 - Options: []cmdkit.Option{
67 - cmdkit.StringOption(keyStoreTypeOptionName, "t", "type of the key to create [rsa, ed25519]"),
68 - cmdkit.IntOption(keyStoreSizeOptionName, "s", "size of the key to generate"),
65 + Options: []cmds.Option{
66 + cmds.StringOption(keyStoreTypeOptionName, "t", "type of the key to create [rsa, ed25519]"),
67 + cmds.IntOption(keyStoreSizeOptionName, "s", "size of the key to generate"),
68 },
70 - Arguments: []cmdkit.Argument{
71 - cmdkit.StringArg("name", true, false, "name of key to create"),
69 + Arguments: []cmds.Argument{
70 + cmds.StringArg("name", true, false, "name of key to create"),
71 },
72 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
73 api, err := cmdenv.GetApi(env, req)
@@ -114,11 +113,11 @@ var keyGenCmd = &cmds.Command{
113 }
114
115 var keyListCmd = &cmds.Command{
117 - Helptext: cmdkit.HelpText{
116 + Helptext: cmds.HelpText{
117 Tagline: "List all local keypairs",
118 },
120 - Options: []cmdkit.Option{
121 - cmdkit.BoolOption("l", "Show extra information about keys."),
119 + Options: []cmds.Option{
120 + cmds.BoolOption("l", "Show extra information about keys."),
121 },
122 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
123 api, err := cmdenv.GetApi(env, req)
@@ -150,15 +149,15 @@ const (
149 )
150
151 var keyRenameCmd = &cmds.Command{
153 - Helptext: cmdkit.HelpText{
152 + Helptext: cmds.HelpText{
153 Tagline: "Rename a keypair",
154 },
156 - Arguments: []cmdkit.Argument{
157 - cmdkit.StringArg("name", true, false, "name of key to rename"),
158 - cmdkit.StringArg("newName", true, false, "new name of the key"),
155 + Arguments: []cmds.Argument{
156 + cmds.StringArg("name", true, false, "name of key to rename"),
157 + cmds.StringArg("newName", true, false, "new name of the key"),
158 },
160 - Options: []cmdkit.Option{
161 - cmdkit.BoolOption(keyStoreForceOptionName, "f", "Allow to overwrite an existing key."),
159 + Options: []cmds.Option{
160 + cmds.BoolOption(keyStoreForceOptionName, "f", "Allow to overwrite an existing key."),
161 },
162 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
163 api, err := cmdenv.GetApi(env, req)
@@ -196,14 +195,14 @@ var keyRenameCmd = &cmds.Command{
195 }
196
197 var keyRmCmd = &cmds.Command{
199 - Helptext: cmdkit.HelpText{
198 + Helptext: cmds.HelpText{
199 Tagline: "Remove a keypair",
200 },
202 - Arguments: []cmdkit.Argument{
203 - cmdkit.StringArg("name", true, true, "names of keys to remove").EnableStdin(),
201 + Arguments: []cmds.Argument{
202 + cmds.StringArg("name", true, true, "names of keys to remove").EnableStdin(),
203 },
205 - Options: []cmdkit.Option{
206 - cmdkit.BoolOption("l", "Show extra information about keys."),
204 + Options: []cmds.Option{
205 + cmds.BoolOption("l", "Show extra information about keys."),
206 },
207 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
208 api, err := cmdenv.GetApi(env, req)
core/commands/log.go
+7 -8
@@ -4,7 +4,6 @@ import (
4 "fmt"
5 "io"
6
7 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
7 cmds "github.com/ipfs/go-ipfs-cmds"
8 logging "github.com/ipfs/go-log"
9 lwriter "github.com/ipfs/go-log/writer"
@@ -17,7 +16,7 @@ import (
16 var logAllKeyword = "all"
17
18 var LogCmd = &cmds.Command{
20 - Helptext: cmdkit.HelpText{
19 + Helptext: cmds.HelpText{
20 Tagline: "Interact with the daemon log output.",
21 ShortDescription: `
22 'ipfs log' contains utility commands to affect or read the logging
@@ -38,7 +37,7 @@ system (not just for the daemon logs, but all commands):
37 }
38
39 var logLevelCmd = &cmds.Command{
41 - Helptext: cmdkit.HelpText{
40 + Helptext: cmds.HelpText{
41 Tagline: "Change the logging level.",
42 ShortDescription: `
43 Change the verbosity of one or all subsystems log output. This does not affect
@@ -46,11 +45,11 @@ the event log.
45 `,
46 },
47
49 - Arguments: []cmdkit.Argument{
48 + Arguments: []cmds.Argument{
49 // TODO use a different keyword for 'all' because all can theoretically
50 // clash with a subsystem name
52 - cmdkit.StringArg("subsystem", true, false, fmt.Sprintf("The subsystem logging identifier. Use '%s' for all subsystems.", logAllKeyword)),
53 - cmdkit.StringArg("level", true, false, `The log level, with 'debug' the most verbose and 'critical' the least verbose.
51 + cmds.StringArg("subsystem", true, false, fmt.Sprintf("The subsystem logging identifier. Use '%s' for all subsystems.", logAllKeyword)),
52 + cmds.StringArg("level", true, false, `The log level, with 'debug' the most verbose and 'critical' the least verbose.
53 One of: debug, info, warning, error, critical.
54 `),
55 },
@@ -81,7 +80,7 @@ the event log.
80 }
81
82 var logLsCmd = &cmds.Command{
84 - Helptext: cmdkit.HelpText{
83 + Helptext: cmds.HelpText{
84 Tagline: "List the logging subsystems.",
85 ShortDescription: `
86 'ipfs log ls' is a utility command used to list the logging
@@ -103,7 +102,7 @@ subsystems of a running daemon.
102 }
103
104 var logTailCmd = &cmds.Command{
106 - Helptext: cmdkit.HelpText{
105 + Helptext: cmds.HelpText{
106 Tagline: "Read the event log.",
107 ShortDescription: `
108 Outputs event log messages (not other log messages) as they are generated.
core/commands/ls.go
+8 -9
@@ -9,7 +9,6 @@ import (
9
10 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
11
12 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
12 cmds "github.com/ipfs/go-ipfs-cmds"
13 unixfs "github.com/ipfs/go-unixfs"
14 unixfs_pb "github.com/ipfs/go-unixfs/pb"
@@ -47,7 +46,7 @@ const (
46 )
47
48 var LsCmd = &cmds.Command{
50 - Helptext: cmdkit.HelpText{
49 + Helptext: cmds.HelpText{
50 Tagline: "List directory contents for Unix filesystem objects.",
51 ShortDescription: `
52 Displays the contents of an IPFS or IPNS object(s) at the given path, with
@@ -59,14 +58,14 @@ The JSON output contains type information.
58 `,
59 },
60
62 - Arguments: []cmdkit.Argument{
63 - cmdkit.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to list links from.").EnableStdin(),
61 + Arguments: []cmds.Argument{
62 + cmds.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to list links from.").EnableStdin(),
63 },
65 - Options: []cmdkit.Option{
66 - cmdkit.BoolOption(lsHeadersOptionNameTime, "v", "Print table headers (Hash, Size, Name)."),
67 - cmdkit.BoolOption(lsResolveTypeOptionName, "Resolve linked objects to find out their types.").WithDefault(true),
68 - cmdkit.BoolOption(lsSizeOptionName, "Resolve linked objects to find out their file size.").WithDefault(true),
69 - cmdkit.BoolOption(lsStreamOptionName, "s", "Enable exprimental streaming of directory entries as they are traversed."),
64 + Options: []cmds.Option{
65 + cmds.BoolOption(lsHeadersOptionNameTime, "v", "Print table headers (Hash, Size, Name)."),
66 + cmds.BoolOption(lsResolveTypeOptionName, "Resolve linked objects to find out their types.").WithDefault(true),
67 + cmds.BoolOption(lsSizeOptionName, "Resolve linked objects to find out their file size.").WithDefault(true),
68 + cmds.BoolOption(lsStreamOptionName, "s", "Enable exprimental streaming of directory entries as they are traversed."),
69 },
70 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
71 api, err := cmdenv.GetApi(env, req)
core/commands/mount_nofuse.go
+1 -2
@@ -3,12 +3,11 @@
3 package commands
4
5 import (
6 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
6 cmds "github.com/ipfs/go-ipfs-cmds"
7 )
8
9 var MountCmd = &cmds.Command{
11 - Helptext: cmdkit.HelpText{
10 + Helptext: cmds.HelpText{
11 Tagline: "Mounts ipfs to the filesystem (disabled).",
12 ShortDescription: `
13 This version of ipfs is compiled without fuse support, which is required
core/commands/mount_unix.go
+4 -5
@@ -9,7 +9,6 @@ import (
9 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
10 nodeMount "github.com/ipfs/go-ipfs/fuse/node"
11
12 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
12 cmds "github.com/ipfs/go-ipfs-cmds"
13 config "github.com/ipfs/go-ipfs-config"
14 )
@@ -20,7 +19,7 @@ const (
19 )
20
21 var MountCmd = &cmds.Command{
23 - Helptext: cmdkit.HelpText{
22 + Helptext: cmds.HelpText{
23 Tagline: "Mounts IPFS to the filesystem (read-only).",
24 ShortDescription: `
25 Mount IPFS at a read-only mountpoint on the OS (default: /ipfs and /ipns).
@@ -76,9 +75,9 @@ baz
75 baz
76 `,
77 },
79 - Options: []cmdkit.Option{
80 - cmdkit.StringOption(mountIPFSPathOptionName, "f", "The path where IPFS should be mounted."),
81 - cmdkit.StringOption(mountIPNSPathOptionName, "n", "The path where IPNS should be mounted."),
78 + Options: []cmds.Option{
79 + cmds.StringOption(mountIPFSPathOptionName, "f", "The path where IPFS should be mounted."),
80 + cmds.StringOption(mountIPNSPathOptionName, "n", "The path where IPNS should be mounted."),
81 },
82 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
83 cfg, err := cmdenv.GetConfig(env)
core/commands/mount_windows.go
+1 -2
@@ -3,12 +3,11 @@ package commands
3 import (
4 "errors"
5
6 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
6 cmds "github.com/ipfs/go-ipfs-cmds"
7 )
8
9 var MountCmd = &cmds.Command{
11 - Helptext: cmdkit.HelpText{
10 + Helptext: cmds.HelpText{
11 Tagline: "Not yet implemented on Windows.",
12 ShortDescription: "Not yet implemented on Windows. :(",
13 },
core/commands/name/ipns.go
+9 -10
@@ -10,7 +10,6 @@ import (
10 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
11 namesys "github.com/ipfs/go-ipfs/namesys"
12
13 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
13 cmds "github.com/ipfs/go-ipfs-cmds"
14 logging "github.com/ipfs/go-log"
15 path "github.com/ipfs/go-path"
@@ -33,7 +32,7 @@ const (
32 )
33
34 var IpnsCmd = &cmds.Command{
36 - Helptext: cmdkit.HelpText{
35 + Helptext: cmds.HelpText{
36 Tagline: "Resolve IPNS names.",
37 ShortDescription: `
38 IPNS is a PKI namespace, where names are the hashes of public keys, and
@@ -70,15 +69,15 @@ Resolve the value of a dnslink:
69 `,
70 },
71
73 - Arguments: []cmdkit.Argument{
74 - cmdkit.StringArg("name", false, false, "The IPNS name to resolve. Defaults to your node's peerID."),
72 + Arguments: []cmds.Argument{
73 + cmds.StringArg("name", false, false, "The IPNS name to resolve. Defaults to your node's peerID."),
74 },
76 - Options: []cmdkit.Option{
77 - cmdkit.BoolOption(recursiveOptionName, "r", "Resolve until the result is not an IPNS name.").WithDefault(true),
78 - cmdkit.BoolOption(nocacheOptionName, "n", "Do not use cached entries."),
79 - cmdkit.UintOption(dhtRecordCountOptionName, "dhtrc", "Number of records to request for DHT resolution."),
80 - cmdkit.StringOption(dhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution eg \"30s\". Pass 0 for no timeout."),
81 - cmdkit.BoolOption(streamOptionName, "s", "Stream entries as they are found."),
75 + Options: []cmds.Option{
76 + cmds.BoolOption(recursiveOptionName, "r", "Resolve until the result is not an IPNS name.").WithDefault(true),
77 + cmds.BoolOption(nocacheOptionName, "n", "Do not use cached entries."),
78 + cmds.UintOption(dhtRecordCountOptionName, "dhtrc", "Number of records to request for DHT resolution."),
79 + cmds.StringOption(dhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution eg \"30s\". Pass 0 for no timeout."),
80 + cmds.BoolOption(streamOptionName, "s", "Stream entries as they are found."),
81 },
82 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
83 api, err := cmdenv.GetApi(env, req)
core/commands/name/ipnsps.go
+9 -10
@@ -5,7 +5,6 @@ import (
5 "io"
6 "strings"
7
8 - "github.com/ipfs/go-ipfs-cmdkit"
8 "github.com/ipfs/go-ipfs-cmds"
9 "github.com/ipfs/go-ipfs/core/commands/cmdenv"
10 "github.com/libp2p/go-libp2p-peer"
@@ -26,7 +25,7 @@ type stringList struct {
25
26 // IpnsPubsubCmd is the subcommand that allows us to manage the IPNS pubsub system
27 var IpnsPubsubCmd = &cmds.Command{
29 - Helptext: cmdkit.HelpText{
28 + Helptext: cmds.HelpText{
29 Tagline: "IPNS pubsub management",
30 ShortDescription: `
31 Manage and inspect the state of the IPNS pubsub resolver.
@@ -42,7 +41,7 @@ Note: this command is experimental and subject to change as the system is refine
41 }
42
43 var ipnspsStateCmd = &cmds.Command{
45 - Helptext: cmdkit.HelpText{
44 + Helptext: cmds.HelpText{
45 Tagline: "Query the state of IPNS pubsub",
46 },
47 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
@@ -70,7 +69,7 @@ var ipnspsStateCmd = &cmds.Command{
69 }
70
71 var ipnspsSubsCmd = &cmds.Command{
73 - Helptext: cmdkit.HelpText{
72 + Helptext: cmds.HelpText{
73 Tagline: "Show current name subscriptions",
74 },
75 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
@@ -80,7 +79,7 @@ var ipnspsSubsCmd = &cmds.Command{
79 }
80
81 if n.PSRouter == nil {
83 - return cmdkit.Errorf(cmdkit.ErrClient, "IPNS pubsub subsystem is not enabled")
82 + return cmds.Errorf(cmds.ErrClient, "IPNS pubsub subsystem is not enabled")
83 }
84 var paths []string
85 for _, key := range n.PSRouter.GetSubscriptions() {
@@ -106,7 +105,7 @@ var ipnspsSubsCmd = &cmds.Command{
105 }
106
107 var ipnspsCancelCmd = &cmds.Command{
109 - Helptext: cmdkit.HelpText{
108 + Helptext: cmds.HelpText{
109 Tagline: "Cancel a name subscription",
110 },
111 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
@@ -116,14 +115,14 @@ var ipnspsCancelCmd = &cmds.Command{
115 }
116
117 if n.PSRouter == nil {
119 - return cmdkit.Errorf(cmdkit.ErrClient, "IPNS pubsub subsystem is not enabled")
118 + return cmds.Errorf(cmds.ErrClient, "IPNS pubsub subsystem is not enabled")
119 }
120
121 name := req.Arguments[0]
122 name = strings.TrimPrefix(name, "/ipns/")
123 pid, err := peer.IDB58Decode(name)
124 if err != nil {
126 - return cmdkit.Errorf(cmdkit.ErrClient, err.Error())
125 + return cmds.Errorf(cmds.ErrClient, err.Error())
126 }
127
128 ok, err := n.PSRouter.Cancel("/ipns/" + string(pid))
@@ -132,8 +131,8 @@ var ipnspsCancelCmd = &cmds.Command{
131 }
132 return cmds.EmitOnce(res, &ipnsPubsubCancel{ok})
133 },
135 - Arguments: []cmdkit.Argument{
136 - cmdkit.StringArg("name", true, false, "Name to cancel the subscription for."),
134 + Arguments: []cmds.Argument{
135 + cmds.StringArg("name", true, false, "Name to cancel the subscription for."),
136 },
137 Type: ipnsPubsubCancel{},
138 Encoders: cmds.EncoderMap{
core/commands/name/name.go
+1 -2
@@ -1,7 +1,6 @@
1 package name
2
3 import (
4 - "github.com/ipfs/go-ipfs-cmdkit"
4 "github.com/ipfs/go-ipfs-cmds"
5 )
6
@@ -11,7 +10,7 @@ type IpnsEntry struct {
10 }
11
12 var NameCmd = &cmds.Command{
14 - Helptext: cmdkit.HelpText{
13 + Helptext: cmds.HelpText{
14 Tagline: "Publish and resolve IPNS names.",
15 ShortDescription: `
16 IPNS is a PKI namespace, where names are the hashes of public keys, and
core/commands/name/publish.go
+10 -11
@@ -8,7 +8,6 @@ import (
8
9 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
10
11 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
11 cmds "github.com/ipfs/go-ipfs-cmds"
12 iface "github.com/ipfs/interface-go-ipfs-core"
13 options "github.com/ipfs/interface-go-ipfs-core/options"
@@ -30,7 +29,7 @@ const (
29 )
30
31 var PublishCmd = &cmds.Command{
33 - Helptext: cmdkit.HelpText{
32 + Helptext: cmds.HelpText{
33 Tagline: "Publish IPNS names.",
34 ShortDescription: `
35 IPNS is a PKI namespace, where names are the hashes of public keys, and
@@ -69,19 +68,19 @@ Alternatively, publish an <ipfs-path> using a valid PeerID (as listed by
68 `,
69 },
70
72 - Arguments: []cmdkit.Argument{
73 - cmdkit.StringArg(ipfsPathOptionName, true, false, "ipfs path of the object to be published.").EnableStdin(),
71 + Arguments: []cmds.Argument{
72 + cmds.StringArg(ipfsPathOptionName, true, false, "ipfs path of the object to be published.").EnableStdin(),
73 },
75 - Options: []cmdkit.Option{
76 - cmdkit.BoolOption(resolveOptionName, "Check if the given path can be resolved before publishing.").WithDefault(true),
77 - cmdkit.StringOption(lifeTimeOptionName, "t",
74 + Options: []cmds.Option{
75 + cmds.BoolOption(resolveOptionName, "Check if the given path can be resolved before publishing.").WithDefault(true),
76 + cmds.StringOption(lifeTimeOptionName, "t",
77 `Time duration that the record will be valid for. <<default>>
78 This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are
79 "ns", "us" (or "µs"), "ms", "s", "m", "h".`).WithDefault("24h"),
81 - cmdkit.BoolOption(allowOfflineOptionName, "When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing."),
82 - cmdkit.StringOption(ttlOptionName, "Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental)"),
83 - cmdkit.StringOption(keyOptionName, "k", "Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'.").WithDefault("self"),
84 - cmdkit.BoolOption(quieterOptionName, "Q", "Write only final hash."),
80 + cmds.BoolOption(allowOfflineOptionName, "When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing."),
81 + cmds.StringOption(ttlOptionName, "Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental)"),
82 + cmds.StringOption(keyOptionName, "k", "Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'.").WithDefault("self"),
83 + cmds.BoolOption(quieterOptionName, "Q", "Write only final hash."),
84 },
85 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
86 api, err := cmdenv.GetApi(env, req)
core/commands/object/diff.go
+6 -7
@@ -7,7 +7,6 @@ import (
7 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
8 "github.com/ipfs/go-ipfs/dagutils"
9
10 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
10 cmds "github.com/ipfs/go-ipfs-cmds"
11 path "github.com/ipfs/interface-go-ipfs-core/path"
12 )
@@ -21,7 +20,7 @@ type Changes struct {
20 }
21
22 var ObjectDiffCmd = &cmds.Command{
24 - Helptext: cmdkit.HelpText{
23 + Helptext: cmds.HelpText{
24 Tagline: "Display the diff between two ipfs objects.",
25 ShortDescription: `
26 'ipfs object diff' is a command used to show the differences between
@@ -47,12 +46,12 @@ Example:
46 Changed "bar" from QmNgd5cz2jNftnAHBhcRUGdtiaMzb5Rhjqd4etondHHST8 to QmRfFVsjSXkhFxrfWnLpMae2M4GBVsry6VAuYYcji5MiZb.
47 `,
48 },
50 - Arguments: []cmdkit.Argument{
51 - cmdkit.StringArg("obj_a", true, false, "Object to diff against."),
52 - cmdkit.StringArg("obj_b", true, false, "Object to diff."),
49 + Arguments: []cmds.Argument{
50 + cmds.StringArg("obj_a", true, false, "Object to diff against."),
51 + cmds.StringArg("obj_b", true, false, "Object to diff."),
52 },
54 - Options: []cmdkit.Option{
55 - cmdkit.BoolOption(verboseOptionName, "v", "Print extra information."),
53 + Options: []cmds.Option{
54 + cmds.BoolOption(verboseOptionName, "v", "Print extra information."),
55 },
56 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
57 api, err := cmdenv.GetApi(env, req)
core/commands/object/object.go
+30 -31
@@ -12,7 +12,6 @@ import (
12
13 humanize "github.com/dustin/go-humanize"
14 "github.com/ipfs/go-cid"
15 - "github.com/ipfs/go-ipfs-cmdkit"
15 "github.com/ipfs/go-ipfs-cmds"
16 ipld "github.com/ipfs/go-ipld-format"
17 dag "github.com/ipfs/go-merkledag"
@@ -48,7 +47,7 @@ const (
47 )
48
49 var ObjectCmd = &cmds.Command{
51 - Helptext: cmdkit.HelpText{
50 + Helptext: cmds.HelpText{
51 Tagline: "Interact with IPFS objects.",
52 ShortDescription: `
53 'ipfs object' is a plumbing command used to manipulate DAG objects
@@ -69,7 +68,7 @@ directly.`,
68
69 // ObjectDataCmd object data command
70 var ObjectDataCmd = &cmds.Command{
72 - Helptext: cmdkit.HelpText{
71 + Helptext: cmds.HelpText{
72 Tagline: "Output the raw bytes of an IPFS object.",
73 ShortDescription: `
74 'ipfs object data' is a plumbing command for retrieving the raw bytes stored
@@ -84,8 +83,8 @@ is the raw data of the object.
83 `,
84 },
85
87 - Arguments: []cmdkit.Argument{
88 - cmdkit.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(),
86 + Arguments: []cmds.Argument{
87 + cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(),
88 },
89 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
90 api, err := cmdenv.GetApi(env, req)
@@ -106,7 +105,7 @@ is the raw data of the object.
105
106 // ObjectLinksCmd object links command
107 var ObjectLinksCmd = &cmds.Command{
109 - Helptext: cmdkit.HelpText{
108 + Helptext: cmds.HelpText{
109 Tagline: "Output the links pointed to by the specified object.",
110 ShortDescription: `
111 'ipfs object links' is a plumbing command for retrieving the links from
@@ -115,11 +114,11 @@ multihash.
114 `,
115 },
116
118 - Arguments: []cmdkit.Argument{
119 - cmdkit.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(),
117 + Arguments: []cmds.Argument{
118 + cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(),
119 },
121 - Options: []cmdkit.Option{
122 - cmdkit.BoolOption(headersOptionName, "v", "Print table headers (Hash, Size, Name)."),
120 + Options: []cmds.Option{
121 + cmds.BoolOption(headersOptionName, "v", "Print table headers (Hash, Size, Name)."),
122 },
123 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
124 api, err := cmdenv.GetApi(env, req)
@@ -180,7 +179,7 @@ multihash.
179
180 // ObjectGetCmd object get command
181 var ObjectGetCmd = &cmds.Command{
183 - Helptext: cmdkit.HelpText{
182 + Helptext: cmds.HelpText{
183 Tagline: "Get and serialize the DAG node named by <key>.",
184 ShortDescription: `
185 'ipfs object get' is a plumbing command for retrieving DAG nodes.
@@ -207,11 +206,11 @@ Supported values are:
206 `,
207 },
208
210 - Arguments: []cmdkit.Argument{
211 - cmdkit.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(),
209 + Arguments: []cmds.Argument{
210 + cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(),
211 },
213 - Options: []cmdkit.Option{
214 - cmdkit.StringOption(encodingOptionName, "Encoding type of the data field, either \"text\" or \"base64\".").WithDefault("text"),
212 + Options: []cmds.Option{
213 + cmds.StringOption(encodingOptionName, "Encoding type of the data field, either \"text\" or \"base64\".").WithDefault("text"),
214 },
215 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
216 api, err := cmdenv.GetApi(env, req)
@@ -288,7 +287,7 @@ Supported values are:
287
288 // ObjectStatCmd object stat command
289 var ObjectStatCmd = &cmds.Command{
291 - Helptext: cmdkit.HelpText{
290 + Helptext: cmds.HelpText{
291 Tagline: "Get stats for the DAG node named by <key>.",
292 ShortDescription: `
293 'ipfs object stat' is a plumbing command to print DAG node statistics.
@@ -302,11 +301,11 @@ var ObjectStatCmd = &cmds.Command{
301 `,
302 },
303
305 - Arguments: []cmdkit.Argument{
306 - cmdkit.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(),
304 + Arguments: []cmds.Argument{
305 + cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(),
306 },
308 - Options: []cmdkit.Option{
309 - cmdkit.BoolOption(humanOptionName, "Print sizes in human readable format (e.g., 1K 234M 2G)"),
307 + Options: []cmds.Option{
308 + cmds.BoolOption(humanOptionName, "Print sizes in human readable format (e.g., 1K 234M 2G)"),
309 },
310 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
311 api, err := cmdenv.GetApi(env, req)
@@ -361,7 +360,7 @@ var ObjectStatCmd = &cmds.Command{
360
361 // ObjectPutCmd object put command
362 var ObjectPutCmd = &cmds.Command{
364 - Helptext: cmdkit.HelpText{
363 + Helptext: cmds.HelpText{
364 Tagline: "Store input as a DAG object, print its key.",
365 ShortDescription: `
366 'ipfs object put' is a plumbing command for storing DAG nodes.
@@ -398,14 +397,14 @@ And then run:
397 `,
398 },
399
401 - Arguments: []cmdkit.Argument{
402 - cmdkit.FileArg("data", true, false, "Data to be stored as a DAG object.").EnableStdin(),
400 + Arguments: []cmds.Argument{
401 + cmds.FileArg("data", true, false, "Data to be stored as a DAG object.").EnableStdin(),
402 },
404 - Options: []cmdkit.Option{
405 - cmdkit.StringOption(inputencOptionName, "Encoding type of input data. One of: {\"protobuf\", \"json\"}.").WithDefault("json"),
406 - cmdkit.StringOption(datafieldencOptionName, "Encoding type of the data field, either \"text\" or \"base64\".").WithDefault("text"),
407 - cmdkit.BoolOption(pinOptionName, "Pin this object when adding."),
408 - cmdkit.BoolOption(quietOptionName, "q", "Write minimal output."),
403 + Options: []cmds.Option{
404 + cmds.StringOption(inputencOptionName, "Encoding type of input data. One of: {\"protobuf\", \"json\"}.").WithDefault("json"),
405 + cmds.StringOption(datafieldencOptionName, "Encoding type of the data field, either \"text\" or \"base64\".").WithDefault("text"),
406 + cmds.BoolOption(pinOptionName, "Pin this object when adding."),
407 + cmds.BoolOption(quietOptionName, "q", "Write minimal output."),
408 },
409 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
410 api, err := cmdenv.GetApi(env, req)
@@ -467,7 +466,7 @@ And then run:
466
467 // ObjectNewCmd object new command
468 var ObjectNewCmd = &cmds.Command{
470 - Helptext: cmdkit.HelpText{
469 + Helptext: cmds.HelpText{
470 Tagline: "Create a new object from an ipfs template.",
471 ShortDescription: `
472 'ipfs object new' is a plumbing command for creating new DAG nodes.
@@ -482,8 +481,8 @@ Available templates:
481 * unixfs-dir
482 `,
483 },
485 - Arguments: []cmdkit.Argument{
486 - cmdkit.StringArg("template", false, false, "Template to use. Optional."),
484 + Arguments: []cmds.Argument{
485 + cmds.StringArg("template", false, false, "Template to use. Optional."),
486 },
487 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
488 api, err := cmdenv.GetApi(env, req)
core/commands/object/patch.go
+21 -22
@@ -6,14 +6,13 @@ import (
6
7 "github.com/ipfs/go-ipfs/core/commands/cmdenv"
8
9 - "github.com/ipfs/go-ipfs-cmdkit"
9 "github.com/ipfs/go-ipfs-cmds"
10 "github.com/ipfs/interface-go-ipfs-core/options"
11 "github.com/ipfs/interface-go-ipfs-core/path"
12 )
13
14 var ObjectPatchCmd = &cmds.Command{
16 - Helptext: cmdkit.HelpText{
15 + Helptext: cmds.HelpText{
16 Tagline: "Create a new merkledag object based on an existing one.",
17 ShortDescription: `
18 'ipfs object patch <root> <cmd> <args>' is a plumbing command used to
@@ -21,7 +20,7 @@ build custom DAG objects. It mutates objects, creating new objects as a
20 result. This is the Merkle-DAG version of modifying an object.
21 `,
22 },
24 - Arguments: []cmdkit.Argument{},
23 + Arguments: []cmds.Argument{},
24 Subcommands: map[string]*cmds.Command{
25 "append-data": patchAppendDataCmd,
26 "add-link": patchAddLinkCmd,
@@ -31,7 +30,7 @@ result. This is the Merkle-DAG version of modifying an object.
30 }
31
32 var patchAppendDataCmd = &cmds.Command{
34 - Helptext: cmdkit.HelpText{
33 + Helptext: cmds.HelpText{
34 Tagline: "Append data to the data segment of a dag node.",
35 ShortDescription: `
36 Append data to what already exists in the data segment in the given object.
@@ -45,9 +44,9 @@ data within an object. Objects have a max size of 1MB and objects larger than
44 the limit will not be respected by the network.
45 `,
46 },
48 - Arguments: []cmdkit.Argument{
49 - cmdkit.StringArg("root", true, false, "The hash of the node to modify."),
50 - cmdkit.FileArg("data", true, false, "Data to append.").EnableStdin(),
47 + Arguments: []cmds.Argument{
48 + cmds.StringArg("root", true, false, "The hash of the node to modify."),
49 + cmds.FileArg("data", true, false, "Data to append.").EnableStdin(),
50 },
51 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
52 api, err := cmdenv.GetApi(env, req)
@@ -79,7 +78,7 @@ the limit will not be respected by the network.
78 }
79
80 var patchSetDataCmd = &cmds.Command{
82 - Helptext: cmdkit.HelpText{
81 + Helptext: cmds.HelpText{
82 Tagline: "Set the data field of an IPFS object.",
83 ShortDescription: `
84 Set the data of an IPFS object from stdin or with the contents of a file.
@@ -89,9 +88,9 @@ Example:
88 $ echo "my data" | ipfs object patch $MYHASH set-data
89 `,
90 },
92 - Arguments: []cmdkit.Argument{
93 - cmdkit.StringArg("root", true, false, "The hash of the node to modify."),
94 - cmdkit.FileArg("data", true, false, "The data to set the object to.").EnableStdin(),
91 + Arguments: []cmds.Argument{
92 + cmds.StringArg("root", true, false, "The hash of the node to modify."),
93 + cmds.FileArg("data", true, false, "The data to set the object to.").EnableStdin(),
94 },
95 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
96 api, err := cmdenv.GetApi(env, req)
@@ -123,15 +122,15 @@ Example:
122 }
123
124 var patchRmLinkCmd = &cmds.Command{
126 - Helptext: cmdkit.HelpText{
125 + Helptext: cmds.HelpText{
126 Tagline: "Remove a link from a given object.",
127 ShortDescription: `
128 Remove a Merkle-link from the given object and return the hash of the result.
129 `,
130 },
132 - Arguments: []cmdkit.Argument{
133 - cmdkit.StringArg("root", true, false, "The hash of the node to modify."),
134 - cmdkit.StringArg("name", true, false, "Name of the link to remove."),
131 + Arguments: []cmds.Argument{
132 + cmds.StringArg("root", true, false, "The hash of the node to modify."),
133 + cmds.StringArg("name", true, false, "Name of the link to remove."),
134 },
135 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
136 api, err := cmdenv.GetApi(env, req)
@@ -163,7 +162,7 @@ const (
162 )
163
164 var patchAddLinkCmd = &cmds.Command{
166 - Helptext: cmdkit.HelpText{
165 + Helptext: cmds.HelpText{
166 Tagline: "Add a link to a given object.",
167 ShortDescription: `
168 Add a Merkle-link to the given object and return the hash of the result.
@@ -178,13 +177,13 @@ This takes an empty directory, and adds a link named 'foo' under it, pointing
177 to a file containing 'bar', and returns the hash of the new object.
178 `,
179 },
181 - Arguments: []cmdkit.Argument{
182 - cmdkit.StringArg("root", true, false, "The hash of the node to modify."),
183 - cmdkit.StringArg("name", true, false, "Name of link to create."),
184 - cmdkit.StringArg("ref", true, false, "IPFS object to add link to."),
180 + Arguments: []cmds.Argument{
181 + cmds.StringArg("root", true, false, "The hash of the node to modify."),
182 + cmds.StringArg("name", true, false, "Name of link to create."),
183 + cmds.StringArg("ref", true, false, "IPFS object to add link to."),
184 },
186 - Options: []cmdkit.Option{
187 - cmdkit.BoolOption(createOptionName, "p", "Create intermediary nodes."),
185 + Options: []cmds.Option{
186 + cmds.BoolOption(createOptionName, "p", "Create intermediary nodes."),
187 },
188 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
189 api, err := cmdenv.GetApi(env, req)
core/commands/p2p.go
+33 -34
@@ -15,7 +15,6 @@ import (
15 p2p "github.com/ipfs/go-ipfs/p2p"
16
17 ipfsaddr "github.com/ipfs/go-ipfs-addr"
18 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
18 cmds "github.com/ipfs/go-ipfs-cmds"
19 pstore "github.com/libp2p/go-libp2p-peerstore"
20 protocol "github.com/libp2p/go-libp2p-protocol"
@@ -60,7 +59,7 @@ var resolveTimeout = 10 * time.Second
59
60 // P2PCmd is the 'ipfs p2p' command
61 var P2PCmd = &cmds.Command{
63 - Helptext: cmdkit.HelpText{
62 + Helptext: cmds.HelpText{
63 Tagline: "Libp2p stream mounting.",
64 ShortDescription: `
65 Create and use tunnels to remote peers over libp2p
@@ -79,7 +78,7 @@ are refined`,
78 }
79
80 var p2pForwardCmd = &cmds.Command{
82 - Helptext: cmdkit.HelpText{
81 + Helptext: cmds.HelpText{
82 Tagline: "Forward connections to libp2p service",
83 ShortDescription: `
84 Forward connections made to <listen-address> to <target-address>.
@@ -93,13 +92,13 @@ Example:
92
93 `,
94 },
96 - Arguments: []cmdkit.Argument{
97 - cmdkit.StringArg("protocol", true, false, "Protocol name."),
98 - cmdkit.StringArg("listen-address", true, false, "Listening endpoint."),
99 - cmdkit.StringArg("target-address", true, false, "Target endpoint."),
95 + Arguments: []cmds.Argument{
96 + cmds.StringArg("protocol", true, false, "Protocol name."),
97 + cmds.StringArg("listen-address", true, false, "Listening endpoint."),
98 + cmds.StringArg("target-address", true, false, "Target endpoint."),
99 },
101 - Options: []cmdkit.Option{
102 - cmdkit.BoolOption(allowCustomProtocolOptionName, "Don't require /x/ prefix"),
100 + Options: []cmds.Option{
101 + cmds.BoolOption(allowCustomProtocolOptionName, "Don't require /x/ prefix"),
102 },
103 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
104 n, err := p2pGetNode(env)
@@ -168,7 +167,7 @@ func parseIpfsAddr(addr string) ([]ipfsaddr.IPFSAddr, error) {
167 }
168
169 var p2pListenCmd = &cmds.Command{
171 - Helptext: cmdkit.HelpText{
170 + Helptext: cmds.HelpText{
171 Tagline: "Create libp2p service",
172 ShortDescription: `
173 Create libp2p service and forward connections made to <target-address>.
@@ -181,13 +180,13 @@ Example:
180
181 `,
182 },
184 - Arguments: []cmdkit.Argument{
185 - cmdkit.StringArg("protocol", true, false, "Protocol name."),
186 - cmdkit.StringArg("target-address", true, false, "Target endpoint."),
183 + Arguments: []cmds.Argument{
184 + cmds.StringArg("protocol", true, false, "Protocol name."),
185 + cmds.StringArg("target-address", true, false, "Target endpoint."),
186 },
188 - Options: []cmdkit.Option{
189 - cmdkit.BoolOption(allowCustomProtocolOptionName, "Don't require /x/ prefix"),
190 - cmdkit.BoolOption(reportPeerIDOptionName, "r", "Send remote base58 peerid to target when a new connection is established"),
187 + Options: []cmds.Option{
188 + cmds.BoolOption(allowCustomProtocolOptionName, "Don't require /x/ prefix"),
189 + cmds.BoolOption(reportPeerIDOptionName, "r", "Send remote base58 peerid to target when a new connection is established"),
190 },
191 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
192 n, err := p2pGetNode(env)
@@ -273,11 +272,11 @@ const (
272 )
273
274 var p2pLsCmd = &cmds.Command{
276 - Helptext: cmdkit.HelpText{
275 + Helptext: cmds.HelpText{
276 Tagline: "List active p2p listeners.",
277 },
279 - Options: []cmdkit.Option{
280 - cmdkit.BoolOption(p2pHeadersOptionName, "v", "Print table headers (Protocol, Listen, Target)."),
278 + Options: []cmds.Option{
279 + cmds.BoolOption(p2pHeadersOptionName, "v", "Print table headers (Protocol, Listen, Target)."),
280 },
281 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
282 n, err := p2pGetNode(env)
@@ -336,14 +335,14 @@ const (
335 )
336
337 var p2pCloseCmd = &cmds.Command{
339 - Helptext: cmdkit.HelpText{
338 + Helptext: cmds.HelpText{
339 Tagline: "Stop listening for new connections to forward.",
340 },
342 - Options: []cmdkit.Option{
343 - cmdkit.BoolOption(p2pAllOptionName, "a", "Close all listeners."),
344 - cmdkit.StringOption(p2pProtocolOptionName, "p", "Match protocol name"),
345 - cmdkit.StringOption(p2pListenAddressOptionName, "l", "Match listen address"),
346 - cmdkit.StringOption(p2pTargetAddressOptionName, "t", "Match target address"),
341 + Options: []cmds.Option{
342 + cmds.BoolOption(p2pAllOptionName, "a", "Close all listeners."),
343 + cmds.StringOption(p2pProtocolOptionName, "p", "Match protocol name"),
344 + cmds.StringOption(p2pListenAddressOptionName, "l", "Match listen address"),
345 + cmds.StringOption(p2pTargetAddressOptionName, "t", "Match target address"),
346 },
347 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
348 n, err := p2pGetNode(env)
@@ -412,7 +411,7 @@ var p2pCloseCmd = &cmds.Command{
411
412 // p2pStreamCmd is the 'ipfs p2p stream' command
413 var p2pStreamCmd = &cmds.Command{
415 - Helptext: cmdkit.HelpText{
414 + Helptext: cmds.HelpText{
415 Tagline: "P2P stream management.",
416 ShortDescription: "Create and manage p2p streams",
417 },
@@ -424,11 +423,11 @@ var p2pStreamCmd = &cmds.Command{
423 }
424
425 var p2pStreamLsCmd = &cmds.Command{
427 - Helptext: cmdkit.HelpText{
426 + Helptext: cmds.HelpText{
427 Tagline: "List active p2p streams.",
428 },
430 - Options: []cmdkit.Option{
431 - cmdkit.BoolOption(p2pHeadersOptionName, "v", "Print table headers (ID, Protocol, Local, Remote)."),
429 + Options: []cmds.Option{
430 + cmds.BoolOption(p2pHeadersOptionName, "v", "Print table headers (ID, Protocol, Local, Remote)."),
431 },
432 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
433 n, err := p2pGetNode(env)
@@ -473,14 +472,14 @@ var p2pStreamLsCmd = &cmds.Command{
472 }
473
474 var p2pStreamCloseCmd = &cmds.Command{
476 - Helptext: cmdkit.HelpText{
475 + Helptext: cmds.HelpText{
476 Tagline: "Close active p2p stream.",
477 },
479 - Arguments: []cmdkit.Argument{
480 - cmdkit.StringArg("id", false, false, "Stream identifier"),
478 + Arguments: []cmds.Argument{
479 + cmds.StringArg("id", false, false, "Stream identifier"),
480 },
482 - Options: []cmdkit.Option{
483 - cmdkit.BoolOption(p2pAllOptionName, "a", "Close all streams."),
481 + Options: []cmds.Option{
482 + cmds.BoolOption(p2pAllOptionName, "a", "Close all streams."),
483 },
484 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
485 n, err := p2pGetNode(env)
core/commands/pin.go
+28 -29
@@ -15,7 +15,6 @@ import (
15 bserv "github.com/ipfs/go-blockservice"
16 cid "github.com/ipfs/go-cid"
17 cidenc "github.com/ipfs/go-cidutil/cidenc"
18 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
18 cmds "github.com/ipfs/go-ipfs-cmds"
19 offline "github.com/ipfs/go-ipfs-exchange-offline"
20 dag "github.com/ipfs/go-merkledag"
@@ -26,7 +25,7 @@ import (
25 )
26
27 var PinCmd = &cmds.Command{
29 - Helptext: cmdkit.HelpText{
28 + Helptext: cmds.HelpText{
29 Tagline: "Pin (and unpin) objects to local storage.",
30 },
31
@@ -54,17 +53,17 @@ const (
53 )
54
55 var addPinCmd = &cmds.Command{
57 - Helptext: cmdkit.HelpText{
56 + Helptext: cmds.HelpText{
57 Tagline: "Pin objects to local storage.",
58 ShortDescription: "Stores an IPFS object(s) from a given path locally to disk.",
59 },
60
62 - Arguments: []cmdkit.Argument{
63 - cmdkit.StringArg("ipfs-path", true, true, "Path to object(s) to be pinned.").EnableStdin(),
61 + Arguments: []cmds.Argument{
62 + cmds.StringArg("ipfs-path", true, true, "Path to object(s) to be pinned.").EnableStdin(),
63 },
65 - Options: []cmdkit.Option{
66 - cmdkit.BoolOption(pinRecursiveOptionName, "r", "Recursively pin the object linked to by the specified object(s).").WithDefault(true),
67 - cmdkit.BoolOption(pinProgressOptionName, "Show progress"),
64 + Options: []cmds.Option{
65 + cmds.BoolOption(pinRecursiveOptionName, "r", "Recursively pin the object linked to by the specified object(s).").WithDefault(true),
66 + cmds.BoolOption(pinProgressOptionName, "Show progress"),
67 },
68 Type: AddPinOutput{},
69 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
@@ -199,7 +198,7 @@ func pinAddMany(ctx context.Context, api coreiface.CoreAPI, enc cidenc.Encoder,
198 }
199
200 var rmPinCmd = &cmds.Command{
202 - Helptext: cmdkit.HelpText{
201 + Helptext: cmds.HelpText{
202 Tagline: "Remove pinned objects from local storage.",
203 ShortDescription: `
204 Removes the pin from the given object allowing it to be garbage
@@ -207,11 +206,11 @@ collected if needed. (By default, recursively. Use -r=false for direct pins.)
206 `,
207 },
208
210 - Arguments: []cmdkit.Argument{
211 - cmdkit.StringArg("ipfs-path", true, true, "Path to object(s) to be unpinned.").EnableStdin(),
209 + Arguments: []cmds.Argument{
210 + cmds.StringArg("ipfs-path", true, true, "Path to object(s) to be unpinned.").EnableStdin(),
211 },
213 - Options: []cmdkit.Option{
214 - cmdkit.BoolOption(pinRecursiveOptionName, "r", "Recursively unpin the object linked to by the specified object(s).").WithDefault(true),
212 + Options: []cmds.Option{
213 + cmds.BoolOption(pinRecursiveOptionName, "r", "Recursively unpin the object linked to by the specified object(s).").WithDefault(true),
214 },
215 Type: PinOutput{},
216 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
@@ -265,7 +264,7 @@ const (
264 )
265
266 var listPinCmd = &cmds.Command{
268 - Helptext: cmdkit.HelpText{
267 + Helptext: cmds.HelpText{
268 Tagline: "List objects pinned to local storage.",
269 ShortDescription: `
270 Returns a list of objects that are pinned locally.
@@ -308,12 +307,12 @@ Example:
307 `,
308 },
309
311 - Arguments: []cmdkit.Argument{
312 - cmdkit.StringArg("ipfs-path", false, true, "Path to object(s) to be listed."),
310 + Arguments: []cmds.Argument{
311 + cmds.StringArg("ipfs-path", false, true, "Path to object(s) to be listed."),
312 },
314 - Options: []cmdkit.Option{
315 - cmdkit.StringOption(pinTypeOptionName, "t", "The type of pinned keys to list. Can be \"direct\", \"indirect\", \"recursive\", or \"all\".").WithDefault("all"),
316 - cmdkit.BoolOption(pinQuietOptionName, "q", "Write just hashes of objects."),
313 + Options: []cmds.Option{
314 + cmds.StringOption(pinTypeOptionName, "t", "The type of pinned keys to list. Can be \"direct\", \"indirect\", \"recursive\", or \"all\".").WithDefault("all"),
315 + cmds.BoolOption(pinQuietOptionName, "q", "Write just hashes of objects."),
316 },
317 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
318 n, err := cmdenv.GetNode(env)
@@ -383,7 +382,7 @@ const (
382 )
383
384 var updatePinCmd = &cmds.Command{
386 - Helptext: cmdkit.HelpText{
385 + Helptext: cmds.HelpText{
386 Tagline: "Update a recursive pin",
387 ShortDescription: `
388 Updates one pin to another, making sure that all objects in the new pin are
@@ -392,12 +391,12 @@ new pin and removing the old one.
391 `,
392 },
393
395 - Arguments: []cmdkit.Argument{
396 - cmdkit.StringArg("from-path", true, false, "Path to old object."),
397 - cmdkit.StringArg("to-path", true, false, "Path to new object to be pinned."),
394 + Arguments: []cmds.Argument{
395 + cmds.StringArg("from-path", true, false, "Path to old object."),
396 + cmds.StringArg("to-path", true, false, "Path to new object to be pinned."),
397 },
399 - Options: []cmdkit.Option{
400 - cmdkit.BoolOption(pinUnpinOptionName, "Remove the old pin.").WithDefault(true),
398 + Options: []cmds.Option{
399 + cmds.BoolOption(pinUnpinOptionName, "Remove the old pin.").WithDefault(true),
400 },
401 Type: PinOutput{},
402 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
@@ -443,12 +442,12 @@ const (
442 )
443
444 var verifyPinCmd = &cmds.Command{
446 - Helptext: cmdkit.HelpText{
445 + Helptext: cmds.HelpText{
446 Tagline: "Verify that recursive pins are complete.",
447 },
449 - Options: []cmdkit.Option{
450 - cmdkit.BoolOption(pinVerboseOptionName, "Also write the hashes of non-broken pins."),
451 - cmdkit.BoolOption(pinQuietOptionName, "q", "Write just hashes of broken pins."),
448 + Options: []cmds.Option{
449 + cmds.BoolOption(pinVerboseOptionName, "Also write the hashes of non-broken pins."),
450 + cmds.BoolOption(pinQuietOptionName, "q", "Write just hashes of broken pins."),
451 },
452 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
453 n, err := cmdenv.GetNode(env)
core/commands/ping.go
+5 -6
@@ -11,7 +11,6 @@ import (
11 "github.com/ipfs/go-ipfs/core/commands/cmdenv"
12
13 iaddr "github.com/ipfs/go-ipfs-addr"
14 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
14 cmds "github.com/ipfs/go-ipfs-cmds"
15 "github.com/libp2p/go-libp2p-peer"
16 pstore "github.com/libp2p/go-libp2p-peerstore"
@@ -35,7 +34,7 @@ const (
34 var ErrPingSelf = errors.New("error: can't ping self")
35
36 var PingCmd = &cmds.Command{
38 - Helptext: cmdkit.HelpText{
37 + Helptext: cmds.HelpText{
38 Tagline: "Send echo request packets to IPFS hosts.",
39 ShortDescription: `
40 'ipfs ping' is a tool to test sending data to other nodes. It finds nodes
@@ -43,11 +42,11 @@ via the routing system, sends pings, waits for pongs, and prints out round-
42 trip latency information.
43 `,
44 },
46 - Arguments: []cmdkit.Argument{
47 - cmdkit.StringArg("peer ID", true, true, "ID of peer to be pinged.").EnableStdin(),
45 + Arguments: []cmds.Argument{
46 + cmds.StringArg("peer ID", true, true, "ID of peer to be pinged.").EnableStdin(),
47 },
49 - Options: []cmdkit.Option{
50 - cmdkit.IntOption(pingCountOptionName, "n", "Number of ping messages to send.").WithDefault(10),
48 + Options: []cmds.Option{
49 + cmds.IntOption(pingCountOptionName, "n", "Number of ping messages to send.").WithDefault(10),
50 },
51 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
52 n, err := cmdenv.GetNode(env)
core/commands/pubsub.go
+14 -15
@@ -10,13 +10,12 @@ import (
10
11 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
12
13 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
13 cmds "github.com/ipfs/go-ipfs-cmds"
14 options "github.com/ipfs/interface-go-ipfs-core/options"
15 )
16
17 var PubsubCmd = &cmds.Command{
19 - Helptext: cmdkit.HelpText{
18 + Helptext: cmds.HelpText{
19 Tagline: "An experimental publish-subscribe system on ipfs.",
20 ShortDescription: `
21 ipfs pubsub allows you to publish messages to a given topic, and also to
@@ -48,7 +47,7 @@ type pubsubMessage struct {
47 }
48
49 var PubsubSubCmd = &cmds.Command{
51 - Helptext: cmdkit.HelpText{
50 + Helptext: cmds.HelpText{
51 Tagline: "Subscribe to messages on a given topic.",
52 ShortDescription: `
53 ipfs pubsub sub subscribes to messages on a given topic.
@@ -71,11 +70,11 @@ This command outputs data in the following encodings:
70 (Specified by the "--encoding" or "--enc" flag)
71 `,
72 },
74 - Arguments: []cmdkit.Argument{
75 - cmdkit.StringArg("topic", true, false, "String name of topic to subscribe to."),
73 + Arguments: []cmds.Argument{
74 + cmds.StringArg("topic", true, false, "String name of topic to subscribe to."),
75 },
77 - Options: []cmdkit.Option{
78 - cmdkit.BoolOption(pubsubDiscoverOptionName, "try to discover other peers subscribed to the same topic"),
76 + Options: []cmds.Option{
77 + cmds.BoolOption(pubsubDiscoverOptionName, "try to discover other peers subscribed to the same topic"),
78 },
79 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
80 api, err := cmdenv.GetApi(env, req)
@@ -137,7 +136,7 @@ This command outputs data in the following encodings:
136 }
137
138 var PubsubPubCmd = &cmds.Command{
140 - Helptext: cmdkit.HelpText{
139 + Helptext: cmds.HelpText{
140 Tagline: "Publish a message to a given pubsub topic.",
141 ShortDescription: `
142 ipfs pubsub pub publishes a message to a specified topic.
@@ -148,9 +147,9 @@ to be used in a production environment.
147 To use, the daemon must be run with '--enable-pubsub-experiment'.
148 `,
149 },
151 - Arguments: []cmdkit.Argument{
152 - cmdkit.StringArg("topic", true, false, "Topic to publish to."),
153 - cmdkit.StringArg("data", true, true, "Payload of message to publish.").EnableStdin(),
150 + Arguments: []cmds.Argument{
151 + cmds.StringArg("topic", true, false, "Topic to publish to."),
152 + cmds.StringArg("data", true, true, "Payload of message to publish.").EnableStdin(),
153 },
154 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
155 api, err := cmdenv.GetApi(env, req)
@@ -176,7 +175,7 @@ To use, the daemon must be run with '--enable-pubsub-experiment'.
175 }
176
177 var PubsubLsCmd = &cmds.Command{
179 - Helptext: cmdkit.HelpText{
178 + Helptext: cmds.HelpText{
179 Tagline: "List subscribed topics by name.",
180 ShortDescription: `
181 ipfs pubsub ls lists out the names of topics you are currently subscribed to.
@@ -217,7 +216,7 @@ func stringListEncoder(req *cmds.Request, w io.Writer, list *stringList) error {
216 }
217
218 var PubsubPeersCmd = &cmds.Command{
220 - Helptext: cmdkit.HelpText{
219 + Helptext: cmds.HelpText{
220 Tagline: "List peers we are currently pubsubbing with.",
221 ShortDescription: `
222 ipfs pubsub peers with no arguments lists out the pubsub peers you are
@@ -230,8 +229,8 @@ to be used in a production environment.
229 To use, the daemon must be run with '--enable-pubsub-experiment'.
230 `,
231 },
233 - Arguments: []cmdkit.Argument{
234 - cmdkit.StringArg("topic", false, false, "topic to list connected peers of"),
232 + Arguments: []cmds.Argument{
233 + cmds.StringArg("topic", false, false, "topic to list connected peers of"),
234 },
235 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
236 api, err := cmdenv.GetApi(env, req)
core/commands/refs.go
+10 -11
@@ -13,7 +13,6 @@ import (
13
14 cid "github.com/ipfs/go-cid"
15 cidenc "github.com/ipfs/go-cidutil/cidenc"
16 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
16 cmds "github.com/ipfs/go-ipfs-cmds"
17 ipld "github.com/ipfs/go-ipld-format"
18 path "github.com/ipfs/go-path"
@@ -45,7 +44,7 @@ const (
44
45 // RefsCmd is the `ipfs refs` command
46 var RefsCmd = &cmds.Command{
48 - Helptext: cmdkit.HelpText{
47 + Helptext: cmds.HelpText{
48 Tagline: "List links (references) from an object.",
49 ShortDescription: `
50 Lists the hashes of all the links an IPFS or IPNS object(s) contains,
@@ -59,15 +58,15 @@ NOTE: List all references recursively by using the flag '-r'.
58 Subcommands: map[string]*cmds.Command{
59 "local": RefsLocalCmd,
60 },
62 - Arguments: []cmdkit.Argument{
63 - cmdkit.StringArg("ipfs-path", true, true, "Path to the object(s) to list refs from.").EnableStdin(),
61 + Arguments: []cmds.Argument{
62 + cmds.StringArg("ipfs-path", true, true, "Path to the object(s) to list refs from.").EnableStdin(),
63 },
65 - Options: []cmdkit.Option{
66 - cmdkit.StringOption(refsFormatOptionName, "Emit edges with given format. Available tokens: <src> <dst> <linkname>.").WithDefault("<dst>"),
67 - cmdkit.BoolOption(refsEdgesOptionName, "e", "Emit edge format: `<from> -> <to>`."),
68 - cmdkit.BoolOption(refsUniqueOptionName, "u", "Omit duplicate refs from output."),
69 - cmdkit.BoolOption(refsRecursiveOptionName, "r", "Recursively list links of child nodes."),
70 - cmdkit.IntOption(refsMaxDepthOptionName, "Only for recursive refs, limits fetch and listing to the given depth").WithDefault(-1),
64 + Options: []cmds.Option{
65 + cmds.StringOption(refsFormatOptionName, "Emit edges with given format. Available tokens: <src> <dst> <linkname>.").WithDefault("<dst>"),
66 + cmds.BoolOption(refsEdgesOptionName, "e", "Emit edge format: `<from> -> <to>`."),
67 + cmds.BoolOption(refsUniqueOptionName, "u", "Omit duplicate refs from output."),
68 + cmds.BoolOption(refsRecursiveOptionName, "r", "Recursively list links of child nodes."),
69 + cmds.IntOption(refsMaxDepthOptionName, "Only for recursive refs, limits fetch and listing to the given depth").WithDefault(-1),
70 },
71 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
72 err := req.ParseBodyArgs()
@@ -133,7 +132,7 @@ NOTE: List all references recursively by using the flag '-r'.
132 }
133
134 var RefsLocalCmd = &cmds.Command{
136 - Helptext: cmdkit.HelpText{
135 + Helptext: cmds.HelpText{
136 Tagline: "List all local references.",
137 ShortDescription: `
138 Displays the hashes of all local objects.
core/commands/repo.go
+14 -15
@@ -19,7 +19,6 @@ import (
19
20 cid "github.com/ipfs/go-cid"
21 bstore "github.com/ipfs/go-ipfs-blockstore"
22 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
22 cmds "github.com/ipfs/go-ipfs-cmds"
23 config "github.com/ipfs/go-ipfs-config"
24 )
@@ -29,7 +28,7 @@ type RepoVersion struct {
28 }
29
30 var RepoCmd = &cmds.Command{
32 - Helptext: cmdkit.HelpText{
31 + Helptext: cmds.HelpText{
32 Tagline: "Manipulate the IPFS repo.",
33 ShortDescription: `
34 'ipfs repo' is a plumbing command used to manipulate the repo.
@@ -57,7 +56,7 @@ const (
56 )
57
58 var repoGcCmd = &cmds.Command{
60 - Helptext: cmdkit.HelpText{
59 + Helptext: cmds.HelpText{
60 Tagline: "Perform a garbage collection sweep on the repo.",
61 ShortDescription: `
62 'ipfs repo gc' is a plumbing command that will sweep the local
@@ -65,9 +64,9 @@ set of stored objects and remove ones that are not pinned in
64 order to reclaim hard disk space.
65 `,
66 },
68 - Options: []cmdkit.Option{
69 - cmdkit.BoolOption(repoStreamErrorsOptionName, "Stream errors."),
70 - cmdkit.BoolOption(repoQuietOptionName, "q", "Write minimal output."),
67 + Options: []cmds.Option{
68 + cmds.BoolOption(repoStreamErrorsOptionName, "Stream errors."),
69 + cmds.BoolOption(repoQuietOptionName, "q", "Write minimal output."),
70 },
71 Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
72 n, err := cmdenv.GetNode(env)
@@ -137,7 +136,7 @@ const (
136 )
137
138 var repoStatCmd = &cmds.Command{
140 - Helptext: cmdkit.HelpText{
139 + Helptext: cmds.HelpText{
140 Tagline: "Get stats for the currently used repo.",
141 ShortDescription: `
142 'ipfs repo stat' provides information about the local set of
@@ -150,9 +149,9 @@ RepoPath string The path to the repo being currently used.
149 Version string The repo version.
150 `,
151 },
153 - Options: []cmdkit.Option{
154 - cmdkit.BoolOption(repoSizeOnlyOptionName, "Only report RepoSize and StorageMax."),
155 - cmdkit.BoolOption(repoHumanOptionName, "Print sizes in human readable format (e.g., 1K 234M 2G)"),
152 + Options: []cmds.Option{
153 + cmds.BoolOption(repoSizeOnlyOptionName, "Only report RepoSize and StorageMax."),
154 + cmds.BoolOption(repoHumanOptionName, "Print sizes in human readable format (e.g., 1K 234M 2G)"),
155 },
156 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
157 n, err := cmdenv.GetNode(env)
@@ -214,7 +213,7 @@ Version string The repo version.
213 }
214
215 var repoFsckCmd = &cmds.Command{
217 - Helptext: cmdkit.HelpText{
216 + Helptext: cmds.HelpText{
217 Tagline: "Remove repo lockfiles.",
218 ShortDescription: `
219 'ipfs repo fsck' is a plumbing command that will remove repo and level db
@@ -313,7 +312,7 @@ func verifyResultChan(ctx context.Context, keys <-chan cid.Cid, bs bstore.Blocks
312 }
313
314 var repoVerifyCmd = &cmds.Command{
316 - Helptext: cmdkit.HelpText{
315 + Helptext: cmds.HelpText{
316 Tagline: "Verify all blocks in repo are not corrupted.",
317 },
318 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
@@ -377,15 +376,15 @@ var repoVerifyCmd = &cmds.Command{
376 }
377
378 var repoVersionCmd = &cmds.Command{
380 - Helptext: cmdkit.HelpText{
379 + Helptext: cmds.HelpText{
380 Tagline: "Show the repo version.",
381 ShortDescription: `
382 'ipfs repo version' returns the current repo version.
383 `,
384 },
385
387 - Options: []cmdkit.Option{
388 - cmdkit.BoolOption(repoQuietOptionName, "q", "Write minimal output."),
386 + Options: []cmds.Option{
387 + cmds.BoolOption(repoQuietOptionName, "q", "Write minimal output."),
388 },
389 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
390 return cmds.EmitOnce(res, &RepoVersion{
core/commands/resolve.go
+7 -8
@@ -12,7 +12,6 @@ import (
12 ns "github.com/ipfs/go-ipfs/namesys"
13
14 cidenc "github.com/ipfs/go-cidutil/cidenc"
15 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
15 cmds "github.com/ipfs/go-ipfs-cmds"
16 ipfspath "github.com/ipfs/go-path"
17 options "github.com/ipfs/interface-go-ipfs-core/options"
@@ -27,7 +26,7 @@ const (
26 )
27
28 var ResolveCmd = &cmds.Command{
30 - Helptext: cmdkit.HelpText{
29 + Helptext: cmds.HelpText{
30 Tagline: "Resolve the value of names to IPFS.",
31 ShortDescription: `
32 There are a number of mutable name protocols that can link among
@@ -66,13 +65,13 @@ Resolve the value of an IPFS DAG path:
65 `,
66 },
67
69 - Arguments: []cmdkit.Argument{
70 - cmdkit.StringArg("name", true, false, "The name to resolve.").EnableStdin(),
68 + Arguments: []cmds.Argument{
69 + cmds.StringArg("name", true, false, "The name to resolve.").EnableStdin(),
70 },
72 - Options: []cmdkit.Option{
73 - cmdkit.BoolOption(resolveRecursiveOptionName, "r", "Resolve until the result is an IPFS name.").WithDefault(true),
74 - cmdkit.IntOption(resolveDhtRecordCountOptionName, "dhtrc", "Number of records to request for DHT resolution."),
75 - cmdkit.StringOption(resolveDhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution eg \"30s\". Pass 0 for no timeout."),
71 + Options: []cmds.Option{
72 + cmds.BoolOption(resolveRecursiveOptionName, "r", "Resolve until the result is an IPFS name.").WithDefault(true),
73 + cmds.IntOption(resolveDhtRecordCountOptionName, "dhtrc", "Number of records to request for DHT resolution."),
74 + cmds.StringOption(resolveDhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution eg \"30s\". Pass 0 for no timeout."),
75 },
76 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
77 api, err := cmdenv.GetApi(env, req)
core/commands/root.go
+9 -10
@@ -9,7 +9,6 @@ import (
9 ocmd "github.com/ipfs/go-ipfs/core/commands/object"
10 unixfs "github.com/ipfs/go-ipfs/core/commands/unixfs"
11
12 - "github.com/ipfs/go-ipfs-cmdkit"
12 cmds "github.com/ipfs/go-ipfs-cmds"
13 logging "github.com/ipfs/go-log"
14 )
@@ -27,7 +26,7 @@ const (
26 )
27
28 var Root = &cmds.Command{
30 - Helptext: cmdkit.HelpText{
29 + Helptext: cmds.HelpText{
30 Tagline: "Global p2p merkle-dag filesystem.",
31 Synopsis: "ipfs [--config=<config> | -c] [--debug | -D] [--help] [-h] [--api=<api>] [--offline] [--cid-base=<base>] [--upgrade-cidv0-in-output] [--encoding=<encoding> | --enc] [--timeout=<timeout>] <command> ...",
32 Subcommands: `
@@ -90,14 +89,14 @@ The CLI will exit with one of the following values:
89 1 Failed executions.
90 `,
91 },
93 - Options: []cmdkit.Option{
94 - cmdkit.StringOption(ConfigOption, "c", "Path to the configuration file to use."),
95 - cmdkit.BoolOption(DebugOption, "D", "Operate in debug mode."),
96 - cmdkit.BoolOption(cmds.OptLongHelp, "Show the full command help text."),
97 - cmdkit.BoolOption(cmds.OptShortHelp, "Show a short version of the command help text."),
98 - cmdkit.BoolOption(LocalOption, "L", "Run the command locally, instead of using the daemon. DEPRECATED: use --offline."),
99 - cmdkit.BoolOption(OfflineOption, "Run the command offline."),
100 - cmdkit.StringOption(ApiOption, "Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001)"),
92 + Options: []cmds.Option{
93 + cmds.StringOption(ConfigOption, "c", "Path to the configuration file to use."),
94 + cmds.BoolOption(DebugOption, "D", "Operate in debug mode."),
95 + cmds.BoolOption(cmds.OptLongHelp, "Show the full command help text."),
96 + cmds.BoolOption(cmds.OptShortHelp, "Show a short version of the command help text."),
97 + cmds.BoolOption(LocalOption, "L", "Run the command locally, instead of using the daemon. DEPRECATED: use --offline."),
98 + cmds.BoolOption(OfflineOption, "Run the command offline."),
99 + cmds.StringOption(ApiOption, "Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001)"),
100
101 // global options, added to every command
102 cmdenv.OptionCidBase,
core/commands/shutdown.go
+3 -4
@@ -3,12 +3,11 @@ package commands
3 import (
4 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
5
6 - "github.com/ipfs/go-ipfs-cmdkit"
7 - cmds "github.com/ipfs/go-ipfs-cmds"
6 + "github.com/ipfs/go-ipfs-cmds"
7 )
8
9 var daemonShutdownCmd = &cmds.Command{
11 - Helptext: cmdkit.HelpText{
10 + Helptext: cmds.HelpText{
11 Tagline: "Shut down the ipfs daemon",
12 },
13 Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
@@ -18,7 +17,7 @@ var daemonShutdownCmd = &cmds.Command{
17 }
18
19 if !nd.IsDaemon {
21 - return cmdkit.Errorf(cmdkit.ErrClient, "daemon not running")
20 + return cmds.Errorf(cmds.ErrClient, "daemon not running")
21 }
22
23 if err := nd.Close(); err != nil {
core/commands/stat.go
+9 -10
@@ -9,7 +9,6 @@ import (
9 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
10
11 humanize "github.com/dustin/go-humanize"
12 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
12 cmds "github.com/ipfs/go-ipfs-cmds"
13 metrics "github.com/libp2p/go-libp2p-metrics"
14 peer "github.com/libp2p/go-libp2p-peer"
@@ -17,7 +16,7 @@ import (
16 )
17
18 var StatsCmd = &cmds.Command{
20 - Helptext: cmdkit.HelpText{
19 + Helptext: cmds.HelpText{
20 Tagline: "Query IPFS statistics.",
21 ShortDescription: `'ipfs stats' is a set of commands to help look at statistics
22 for your IPFS node.
@@ -41,7 +40,7 @@ const (
40 )
41
42 var statBwCmd = &cmds.Command{
44 - Helptext: cmdkit.HelpText{
43 + Helptext: cmds.HelpText{
44 Tagline: "Print ipfs bandwidth information.",
45 ShortDescription: `'ipfs stats bw' prints bandwidth information for the ipfs daemon.
46 It displays: TotalIn, TotalOut, RateIn, RateOut.
@@ -77,11 +76,11 @@ Example:
76 RateOut: 0B/s
77 `,
78 },
80 - Options: []cmdkit.Option{
81 - cmdkit.StringOption(statPeerOptionName, "p", "Specify a peer to print bandwidth for."),
82 - cmdkit.StringOption(statProtoOptionName, "t", "Specify a protocol to print bandwidth for."),
83 - cmdkit.BoolOption(statPollOptionName, "Print bandwidth at an interval."),
84 - cmdkit.StringOption(statIntervalOptionName, "i", `Time interval to wait between updating output, if 'poll' is true.
79 + Options: []cmds.Option{
80 + cmds.StringOption(statPeerOptionName, "p", "Specify a peer to print bandwidth for."),
81 + cmds.StringOption(statProtoOptionName, "t", "Specify a protocol to print bandwidth for."),
82 + cmds.BoolOption(statPollOptionName, "Print bandwidth at an interval."),
83 + cmds.StringOption(statIntervalOptionName, "i", `Time interval to wait between updating output, if 'poll' is true.
84
85 This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are:
86 "ns", "us" (or "µs"), "ms", "s", "m", "h".`).WithDefault("1s"),
@@ -95,7 +94,7 @@ Example:
94
95 // Must be online!
96 if !nd.IsOnline {
98 - return cmdkit.Errorf(cmdkit.ErrClient, ErrNotOnline.Error())
97 + return cmds.Errorf(cmds.ErrClient, ErrNotOnline.Error())
98 }
99
100 if nd.Reporter == nil {
@@ -105,7 +104,7 @@ Example:
104 pstr, pfound := req.Options[statPeerOptionName].(string)
105 tstr, tfound := req.Options["proto"].(string)
106 if pfound && tfound {
108 - return cmdkit.Errorf(cmdkit.ErrClient, "please only specify peer OR protocol")
107 + return cmds.Errorf(cmds.ErrClient, "please only specify peer OR protocol")
108 }
109
110 var pid peer.ID
core/commands/swarm.go
+25 -26
@@ -16,7 +16,6 @@ import (
16 fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"
17
18 iaddr "github.com/ipfs/go-ipfs-addr"
19 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
19 cmds "github.com/ipfs/go-ipfs-cmds"
20 config "github.com/ipfs/go-ipfs-config"
21 inet "github.com/libp2p/go-libp2p-net"
@@ -41,7 +40,7 @@ type addrMap struct {
40 }
41
42 var SwarmCmd = &cmds.Command{
44 - Helptext: cmdkit.HelpText{
43 + Helptext: cmds.HelpText{
44 Tagline: "Interact with the swarm.",
45 ShortDescription: `
46 'ipfs swarm' is a tool to manipulate the network swarm. The swarm is the
@@ -66,17 +65,17 @@ const (
65 )
66
67 var swarmPeersCmd = &cmds.Command{
69 - Helptext: cmdkit.HelpText{
68 + Helptext: cmds.HelpText{
69 Tagline: "List peers with open connections.",
70 ShortDescription: `
71 'ipfs swarm peers' lists the set of peers this node is connected to.
72 `,
73 },
75 - Options: []cmdkit.Option{
76 - cmdkit.BoolOption(swarmVerboseOptionName, "v", "display all extra information"),
77 - cmdkit.BoolOption(swarmStreamsOptionName, "Also list information about open streams for each peer"),
78 - cmdkit.BoolOption(swarmLatencyOptionName, "Also list information about latency to each peer"),
79 - cmdkit.BoolOption(swarmDirectionOptionName, "Also list information about the direction of connection"),
74 + Options: []cmds.Option{
75 + cmds.BoolOption(swarmVerboseOptionName, "v", "display all extra information"),
76 + cmds.BoolOption(swarmStreamsOptionName, "Also list information about open streams for each peer"),
77 + cmds.BoolOption(swarmLatencyOptionName, "Also list information about latency to each peer"),
78 + cmds.BoolOption(swarmDirectionOptionName, "Also list information about the direction of connection"),
79 },
80 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
81 api, err := cmdenv.GetApi(env, req)
@@ -218,7 +217,7 @@ func directionString(d inet.Direction) string {
217 }
218
219 var swarmAddrsCmd = &cmds.Command{
221 - Helptext: cmdkit.HelpText{
220 + Helptext: cmds.HelpText{
221 Tagline: "List known addresses. Useful for debugging.",
222 ShortDescription: `
223 'ipfs swarm addrs' lists all addresses this node is aware of.
@@ -273,14 +272,14 @@ var swarmAddrsCmd = &cmds.Command{
272 }
273
274 var swarmAddrsLocalCmd = &cmds.Command{
276 - Helptext: cmdkit.HelpText{
275 + Helptext: cmds.HelpText{
276 Tagline: "List local addresses.",
277 ShortDescription: `
278 'ipfs swarm addrs local' lists all local listening addresses announced to the network.
279 `,
280 },
282 - Options: []cmdkit.Option{
283 - cmdkit.BoolOption("id", "Show peer ID in addresses."),
281 + Options: []cmds.Option{
282 + cmds.BoolOption("id", "Show peer ID in addresses."),
283 },
284 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
285 api, err := cmdenv.GetApi(env, req)
@@ -317,7 +316,7 @@ var swarmAddrsLocalCmd = &cmds.Command{
316 }
317
318 var swarmAddrsListenCmd = &cmds.Command{
320 - Helptext: cmdkit.HelpText{
319 + Helptext: cmds.HelpText{
320 Tagline: "List interface listening addresses.",
321 ShortDescription: `
322 'ipfs swarm addrs listen' lists all interface addresses the node is listening on.
@@ -349,7 +348,7 @@ var swarmAddrsListenCmd = &cmds.Command{
348 }
349
350 var swarmConnectCmd = &cmds.Command{
352 - Helptext: cmdkit.HelpText{
351 + Helptext: cmds.HelpText{
352 Tagline: "Open connection to a given address.",
353 ShortDescription: `
354 'ipfs swarm connect' opens a new direct connection to a peer address.
@@ -359,8 +358,8 @@ The address format is an IPFS multiaddr:
358 ipfs swarm connect /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
359 `,
360 },
362 - Arguments: []cmdkit.Argument{
363 - cmdkit.StringArg("address", true, true, "Address of peer to connect to.").EnableStdin(),
361 + Arguments: []cmds.Argument{
362 + cmds.StringArg("address", true, true, "Address of peer to connect to.").EnableStdin(),
363 },
364 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
365 api, err := cmdenv.GetApi(env, req)
@@ -395,7 +394,7 @@ ipfs swarm connect /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3
394 }
395
396 var swarmDisconnectCmd = &cmds.Command{
398 - Helptext: cmdkit.HelpText{
397 + Helptext: cmds.HelpText{
398 Tagline: "Close connection to a given address.",
399 ShortDescription: `
400 'ipfs swarm disconnect' closes a connection to a peer address. The address
@@ -407,8 +406,8 @@ The disconnect is not permanent; if ipfs needs to talk to that address later,
406 it will reconnect.
407 `,
408 },
410 - Arguments: []cmdkit.Argument{
411 - cmdkit.StringArg("address", true, true, "Address of peer to disconnect from.").EnableStdin(),
409 + Arguments: []cmds.Argument{
410 + cmds.StringArg("address", true, true, "Address of peer to disconnect from.").EnableStdin(),
411 },
412 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
413 api, err := cmdenv.GetApi(env, req)
@@ -561,7 +560,7 @@ func resolveAddresses(ctx context.Context, addrs []string) ([]ma.Multiaddr, erro
560 }
561
562 var swarmFiltersCmd = &cmds.Command{
564 - Helptext: cmdkit.HelpText{
563 + Helptext: cmds.HelpText{
564 Tagline: "Manipulate address filters.",
565 ShortDescription: `
566 'ipfs swarm filters' will list out currently applied filters. Its subcommands
@@ -616,7 +615,7 @@ Filters default to those specified under the "Swarm.AddrFilters" config key.
615 }
616
617 var swarmFiltersAddCmd = &cmds.Command{
619 - Helptext: cmdkit.HelpText{
618 + Helptext: cmds.HelpText{
619 Tagline: "Add an address filter.",
620 ShortDescription: `
621 'ipfs swarm filters add' will add an address filter to the daemons swarm.
@@ -624,8 +623,8 @@ Filters applied this way will not persist daemon reboots, to achieve that,
623 add your filters to the ipfs config file.
624 `,
625 },
627 - Arguments: []cmdkit.Argument{
628 - cmdkit.StringArg("address", true, true, "Multiaddr to filter.").EnableStdin(),
626 + Arguments: []cmds.Argument{
627 + cmds.StringArg("address", true, true, "Multiaddr to filter.").EnableStdin(),
628 },
629 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
630 n, err := cmdenv.GetNode(env)
@@ -680,7 +679,7 @@ add your filters to the ipfs config file.
679 }
680
681 var swarmFiltersRmCmd = &cmds.Command{
683 - Helptext: cmdkit.HelpText{
682 + Helptext: cmds.HelpText{
683 Tagline: "Remove an address filter.",
684 ShortDescription: `
685 'ipfs swarm filters rm' will remove an address filter from the daemons swarm.
@@ -688,8 +687,8 @@ Filters removed this way will not persist daemon reboots, to achieve that,
687 remove your filters from the ipfs config file.
688 `,
689 },
691 - Arguments: []cmdkit.Argument{
692 - cmdkit.StringArg("address", true, true, "Multiaddr filter to remove.").EnableStdin(),
690 + Arguments: []cmds.Argument{
691 + cmds.StringArg("address", true, true, "Multiaddr filter to remove.").EnableStdin(),
692 },
693 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
694 n, err := cmdenv.GetNode(env)
core/commands/sysdiag.go
+1 -2
@@ -8,14 +8,13 @@ import (
8 version "github.com/ipfs/go-ipfs"
9 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
10
11 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
11 cmds "github.com/ipfs/go-ipfs-cmds"
12 manet "github.com/multiformats/go-multiaddr-net"
13 sysi "github.com/whyrusleeping/go-sysinfo"
14 )
15
16 var sysDiagCmd = &cmds.Command{
18 - Helptext: cmdkit.HelpText{
17 + Helptext: cmds.HelpText{
18 Tagline: "Print system diagnostic information.",
19 ShortDescription: `
20 Prints out information about your computer to aid in easier debugging.
core/commands/tar.go
+7 -8
@@ -8,14 +8,13 @@ import (
8 "github.com/ipfs/go-ipfs/namesys/resolve"
9 tar "github.com/ipfs/go-ipfs/tar"
10
11 - "github.com/ipfs/go-ipfs-cmdkit"
11 "github.com/ipfs/go-ipfs-cmds"
12 dag "github.com/ipfs/go-merkledag"
13 "github.com/ipfs/go-path"
14 )
15
16 var TarCmd = &cmds.Command{
18 - Helptext: cmdkit.HelpText{
17 + Helptext: cmds.HelpText{
18 Tagline: "Utility functions for tar files in ipfs.",
19 },
20
@@ -26,7 +25,7 @@ var TarCmd = &cmds.Command{
25 }
26
27 var tarAddCmd = &cmds.Command{
29 - Helptext: cmdkit.HelpText{
28 + Helptext: cmds.HelpText{
29 Tagline: "Import a tar file into ipfs.",
30 ShortDescription: `
31 'ipfs tar add' will parse a tar file and create a merkledag structure to
@@ -34,8 +33,8 @@ represent it.
33 `,
34 },
35
37 - Arguments: []cmdkit.Argument{
38 - cmdkit.FileArg("file", true, false, "Tar file to add.").EnableStdin(),
36 + Arguments: []cmds.Argument{
37 + cmds.FileArg("file", true, false, "Tar file to add.").EnableStdin(),
38 },
39 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
40 nd, err := cmdenv.GetNode(env)
@@ -76,15 +75,15 @@ represent it.
75 }
76
77 var tarCatCmd = &cmds.Command{
79 - Helptext: cmdkit.HelpText{
78 + Helptext: cmds.HelpText{
79 Tagline: "Export a tar file from IPFS.",
80 ShortDescription: `
81 'ipfs tar cat' will export a tar file from a previously imported one in IPFS.
82 `,
83 },
84
86 - Arguments: []cmdkit.Argument{
87 - cmdkit.StringArg("path", true, false, "ipfs path of archive to export.").EnableStdin(),
85 + Arguments: []cmds.Argument{
86 + cmds.StringArg("path", true, false, "ipfs path of archive to export.").EnableStdin(),
87 },
88 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
89 nd, err := cmdenv.GetNode(env)
core/commands/unixfs/ls.go
+3 -4
@@ -8,7 +8,6 @@ import (
8
9 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
10
11 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
11 cmds "github.com/ipfs/go-ipfs-cmds"
12 merkledag "github.com/ipfs/go-merkledag"
13 unixfs "github.com/ipfs/go-unixfs"
@@ -34,7 +33,7 @@ type LsOutput struct {
33 }
34
35 var LsCmd = &cmds.Command{
37 - Helptext: cmdkit.HelpText{
36 + Helptext: cmds.HelpText{
37 Tagline: "List directory contents for Unix filesystem objects.",
38 ShortDescription: `
39 Displays the contents of an IPFS or IPNS object(s) at the given path.
@@ -68,8 +67,8 @@ possible, please use 'ipfs ls' instead.
67 `,
68 },
69
71 - Arguments: []cmdkit.Argument{
72 - cmdkit.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to list links from.").EnableStdin(),
70 + Arguments: []cmds.Argument{
71 + cmds.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to list links from.").EnableStdin(),
72 },
73 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
74 nd, err := cmdenv.GetNode(env)
core/commands/unixfs/unixfs.go
+1 -2
@@ -1,12 +1,11 @@
1 package unixfs
2
3 import (
4 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
4 cmds "github.com/ipfs/go-ipfs-cmds"
5 )
6
7 var UnixFSCmd = &cmds.Command{
9 - Helptext: cmdkit.HelpText{
8 + Helptext: cmds.HelpText{
9 Tagline: "Interact with IPFS objects representing Unix filesystems.",
10 ShortDescription: `
11 'ipfs file' provides a familiar interface to file systems represented
core/commands/urlstore.go
+7 -8
@@ -8,14 +8,13 @@ import (
8 cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
9 filestore "github.com/ipfs/go-ipfs/filestore"
10
11 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
11 cmds "github.com/ipfs/go-ipfs-cmds"
12 files "github.com/ipfs/go-ipfs-files"
13 "github.com/ipfs/interface-go-ipfs-core/options"
14 )
15
16 var urlStoreCmd = &cmds.Command{
18 - Helptext: cmdkit.HelpText{
17 + Helptext: cmds.HelpText{
18 Tagline: "Interact with urlstore.",
19 },
20 Subcommands: map[string]*cmds.Command{
@@ -24,7 +23,7 @@ var urlStoreCmd = &cmds.Command{
23 }
24
25 var urlAdd = &cmds.Command{
27 - Helptext: cmdkit.HelpText{
26 + Helptext: cmds.HelpText{
27 Tagline: "Add URL via urlstore.",
28 LongDescription: `
29 DEPRECATED: Use 'ipfs add --nocopy --cid-version=1 URL'.
@@ -38,12 +37,12 @@ The file is added using raw-leaves but otherwise using the default
37 settings for 'ipfs add'.
38 `,
39 },
41 - Options: []cmdkit.Option{
42 - cmdkit.BoolOption(trickleOptionName, "t", "Use trickle-dag format for dag generation."),
43 - cmdkit.BoolOption(pinOptionName, "Pin this object when adding.").WithDefault(true),
40 + Options: []cmds.Option{
41 + cmds.BoolOption(trickleOptionName, "t", "Use trickle-dag format for dag generation."),
42 + cmds.BoolOption(pinOptionName, "Pin this object when adding.").WithDefault(true),
43 },
45 - Arguments: []cmdkit.Argument{
46 - cmdkit.StringArg("url", true, false, "URL to add to IPFS"),
44 + Arguments: []cmds.Argument{
45 + cmds.StringArg("url", true, false, "URL to add to IPFS"),
46 },
47 Type: &BlockStat{},
48
core/commands/version.go
+7 -8
@@ -10,7 +10,6 @@ import (
10 version "github.com/ipfs/go-ipfs"
11 fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"
12
13 - cmdkit "github.com/ipfs/go-ipfs-cmdkit"
13 cmds "github.com/ipfs/go-ipfs-cmds"
14 )
15
@@ -30,7 +29,7 @@ const (
29 )
30
31 var VersionCmd = &cmds.Command{
33 - Helptext: cmdkit.HelpText{
32 + Helptext: cmds.HelpText{
33 Tagline: "Show ipfs version information.",
34 ShortDescription: "Returns the current version of ipfs and exits.",
35 },
@@ -38,11 +37,11 @@ var VersionCmd = &cmds.Command{
37 "deps": depsVersionCommand,
38 },
39
41 - Options: []cmdkit.Option{
42 - cmdkit.BoolOption(versionNumberOptionName, "n", "Only show the version number."),
43 - cmdkit.BoolOption(versionCommitOptionName, "Show the commit hash."),
44 - cmdkit.BoolOption(versionRepoOptionName, "Show repo version."),
45 - cmdkit.BoolOption(versionAllOptionName, "Show all version information"),
40 + Options: []cmds.Option{
41 + cmds.BoolOption(versionNumberOptionName, "n", "Only show the version number."),
42 + cmds.BoolOption(versionCommitOptionName, "Show the commit hash."),
43 + cmds.BoolOption(versionRepoOptionName, "Show repo version."),
44 + cmds.BoolOption(versionAllOptionName, "Show all version information"),
45 },
46 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
47 return cmds.EmitOnce(res, &VersionOutput{
@@ -99,7 +98,7 @@ type Dependency struct {
98 const pkgVersionFmt = "%s@%s"
99
100 var depsVersionCommand = &cmds.Command{
102 - Helptext: cmdkit.HelpText{
101 + Helptext: cmds.HelpText{
102 Tagline: "Shows information about dependencies used for build",
103 ShortDescription: `
104 Print out all dependencies and their versions.`,
core/coreapi/unixfs.go
+1 -1
@@ -45,7 +45,7 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
45 // TODO: this doesn't handle the case if the hashed file is already in blocks (deduplicated)
46 // TODO: conditional GC is disabled due to it is somehow not possible to pass the size to the daemon
47 //if err := corerepo.ConditionalGC(req.Context(), n, uint64(size)); err != nil {
48 - // res.SetError(err, cmdkit.ErrNormal)
48 + // res.SetError(err, cmds.ErrNormal)
49 // return
50 //}
51
go.mod
+1 -2
@@ -32,8 +32,7 @@ require (
32 github.com/ipfs/go-ipfs-blockstore v0.0.1
33 github.com/ipfs/go-ipfs-blocksutil v0.0.1
34 github.com/ipfs/go-ipfs-chunker v0.0.1
35 - github.com/ipfs/go-ipfs-cmdkit v0.0.1
36 - github.com/ipfs/go-ipfs-cmds v0.0.6
35 + github.com/ipfs/go-ipfs-cmds v0.0.7
36 github.com/ipfs/go-ipfs-config v0.0.3
37 github.com/ipfs/go-ipfs-ds-help v0.0.1
38 github.com/ipfs/go-ipfs-exchange-interface v0.0.1
go.sum
+2 -4
@@ -178,10 +178,8 @@ github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IW
178 github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk=
179 github.com/ipfs/go-ipfs-chunker v0.0.1 h1:cHUUxKFQ99pozdahi+uSC/3Y6HeRpi9oTeUHbE27SEw=
180 github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw=
181 -github.com/ipfs/go-ipfs-cmdkit v0.0.1 h1:X6YXEAjUljTzevE6DPUKXSqcgf+4FXzcn5B957F5MXo=
182 -github.com/ipfs/go-ipfs-cmdkit v0.0.1/go.mod h1:9FtbMdUabcSqv/G4/8WCxSLxkZxn/aZEFrxxqnVcRbg=
183 -github.com/ipfs/go-ipfs-cmds v0.0.6 h1:qyitSZoV/oLHrl9NvQHOtJNUQLA42IaPoAb5iWWOo4g=
184 -github.com/ipfs/go-ipfs-cmds v0.0.6/go.mod h1:1QVgxSgenZvOMGVC/XUTC7tJxRBGPLxYvpgPpCi3DUk=
181 +github.com/ipfs/go-ipfs-cmds v0.0.7 h1:0N2NXxYAZn1kHpHrZMHZYRcVGJSxQogDD89oKc0GZMg=
182 +github.com/ipfs/go-ipfs-cmds v0.0.7/go.mod h1:E5ou2OpwkAtR8LdneNdq4w1vPcrTWvh/6WPhjxGaX/Y=
183 github.com/ipfs/go-ipfs-config v0.0.1 h1:6ED08emzI1imdsAjixFi2pEyZxTVD5ECKtCOxLBx+Uc=
184 github.com/ipfs/go-ipfs-config v0.0.1/go.mod h1:KDbHjNyg4e6LLQSQpkgQMBz6Jf4LXiWAcmnkcwmH0DU=
185 github.com/ipfs/go-ipfs-config v0.0.3 h1:Ep4tRdP1iVK76BgOprD9B/qtOEdpno+1Xb57BqydgGk=
package-list.json
-1
@@ -40,7 +40,6 @@
40
41 "Commands",
42 ["ipfs/go-ipfs-cmds", "go-ipfs-cmds", "CLI & HTTP commands library"],
43 - ["ipfs/go-ipfs-cmdkit", "go-ipfs-cmdkit", "helper types for the commands library"],
43 ["ipfs/go-ipfs-api", "go-ipfs-api", "a shell for the IPFS HTTP API"],
44
45 "Metrics & Logging",