diff --git a/README.md b/README.md index ab6251b70c4..e7706770173 100644 --- a/README.md +++ b/README.md @@ -353,7 +353,6 @@ Listing of the main packages used in the IPFS ecosystem. There are also three sp | [`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 | | **Commands** | | [`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 | -| [`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 | | [`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 | | **Metrics & Logging** | | [`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 | diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index 83cf719d75b..ec5a979e16d 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -26,8 +26,7 @@ import ( migrate "github.com/ipfs/go-ipfs/repo/fsrepo/migrations" "github.com/hashicorp/go-multierror" - "github.com/ipfs/go-ipfs-cmdkit" - cmds "github.com/ipfs/go-ipfs-cmds" + "github.com/ipfs/go-ipfs-cmds" mprome "github.com/ipfs/go-metrics-prometheus" goprocess "github.com/jbenet/goprocess" ma "github.com/multiformats/go-multiaddr" @@ -62,7 +61,7 @@ const ( ) var daemonCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Run a network-connected IPFS node.", ShortDescription: ` 'ipfs daemon' runs a persistent ipfs daemon that can serve commands @@ -153,26 +152,26 @@ Headers. `, }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(initOptionKwd, "Initialize ipfs with default settings if not already initialized"), - cmdkit.StringOption(initProfileOptionKwd, "Configuration profiles to apply for --init. See ipfs init --help for more"), - cmdkit.StringOption(routingOptionKwd, "Overrides the routing option").WithDefault(routingOptionDefaultKwd), - cmdkit.BoolOption(mountKwd, "Mounts IPFS to the filesystem"), - cmdkit.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)"), - cmdkit.StringOption(ipfsMountKwd, "Path to the mountpoint for IPFS (if using --mount). Defaults to config setting."), - cmdkit.StringOption(ipnsMountKwd, "Path to the mountpoint for IPNS (if using --mount). Defaults to config setting."), - cmdkit.BoolOption(unrestrictedApiAccessKwd, "Allow API access to unlisted hashes"), - cmdkit.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)"), - cmdkit.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection"), - cmdkit.BoolOption(adjustFDLimitKwd, "Check and raise file descriptor limits if needed").WithDefault(true), - cmdkit.BoolOption(migrateKwd, "If true, assume yes at the migrate prompt. If false, assume no."), - cmdkit.BoolOption(enablePubSubKwd, "Instantiate the ipfs daemon with the experimental pubsub feature enabled."), - cmdkit.BoolOption(enableIPNSPubSubKwd, "Enable IPNS record distribution through pubsub; enables pubsub."), - cmdkit.BoolOption(enableMultiplexKwd, "Add the experimental 'go-multiplex' stream muxer to libp2p on construction.").WithDefault(true), + Options: []cmds.Option{ + cmds.BoolOption(initOptionKwd, "Initialize ipfs with default settings if not already initialized"), + cmds.StringOption(initProfileOptionKwd, "Configuration profiles to apply for --init. See ipfs init --help for more"), + cmds.StringOption(routingOptionKwd, "Overrides the routing option").WithDefault(routingOptionDefaultKwd), + cmds.BoolOption(mountKwd, "Mounts IPFS to the filesystem"), + cmds.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)"), + cmds.StringOption(ipfsMountKwd, "Path to the mountpoint for IPFS (if using --mount). Defaults to config setting."), + cmds.StringOption(ipnsMountKwd, "Path to the mountpoint for IPNS (if using --mount). Defaults to config setting."), + cmds.BoolOption(unrestrictedApiAccessKwd, "Allow API access to unlisted hashes"), + cmds.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)"), + cmds.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection"), + cmds.BoolOption(adjustFDLimitKwd, "Check and raise file descriptor limits if needed").WithDefault(true), + cmds.BoolOption(migrateKwd, "If true, assume yes at the migrate prompt. If false, assume no."), + cmds.BoolOption(enablePubSubKwd, "Instantiate the ipfs daemon with the experimental pubsub feature enabled."), + cmds.BoolOption(enableIPNSPubSubKwd, "Enable IPNS record distribution through pubsub; enables pubsub."), + cmds.BoolOption(enableMultiplexKwd, "Add the experimental 'go-multiplex' stream muxer to libp2p on construction.").WithDefault(true), // TODO: add way to override addresses. tricky part: updating the config if also --init. - // cmdkit.StringOption(apiAddrKwd, "Address for the daemon rpc API (overrides config)"), - // cmdkit.StringOption(swarmAddrKwd, "Address for the swarm socket (overrides config)"), + // cmds.StringOption(apiAddrKwd, "Address for the daemon rpc API (overrides config)"), + // cmds.StringOption(swarmAddrKwd, "Address for the swarm socket (overrides config)"), }, Subcommands: map[string]*cmds.Command{}, Run: daemonFunc, @@ -384,7 +383,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment // construct fuse mountpoints - if the user provided the --mount flag mount, _ := req.Options[mountKwd].(bool) if mount && offline { - return cmdkit.Errorf(cmdkit.ErrClient, "mount is not currently supported in offline mode") + return cmds.Errorf(cmds.ErrClient, "mount is not currently supported in offline mode") } if mount { if err := mountFuse(req, cctx); err != nil { diff --git a/cmd/ipfs/init.go b/cmd/ipfs/init.go index 58ed82895de..4fa5087fa6e 100644 --- a/cmd/ipfs/init.go +++ b/cmd/ipfs/init.go @@ -16,7 +16,6 @@ import ( namesys "github.com/ipfs/go-ipfs/namesys" fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo" - "github.com/ipfs/go-ipfs-cmdkit" "github.com/ipfs/go-ipfs-cmds" "github.com/ipfs/go-ipfs-config" "github.com/ipfs/go-ipfs-files" @@ -30,7 +29,7 @@ const ( ) var initCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Initializes ipfs config file.", ShortDescription: ` Initializes ipfs configuration files and generates a new keypair. @@ -47,18 +46,18 @@ environment variable: export IPFS_PATH=/path/to/ipfsrepo `, }, - Arguments: []cmdkit.Argument{ - cmdkit.FileArg("default-config", false, false, "Initialize with the given configuration.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.FileArg("default-config", false, false, "Initialize with the given configuration.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.IntOption(bitsOptionName, "b", "Number of bits to use in the generated RSA private key.").WithDefault(nBitsForKeypairDefault), - cmdkit.BoolOption(emptyRepoOptionName, "e", "Don't add and pin help files to the local storage."), - cmdkit.StringOption(profileOptionName, "p", "Apply profile settings to config. Multiple profiles can be separated by ','"), + Options: []cmds.Option{ + cmds.IntOption(bitsOptionName, "b", "Number of bits to use in the generated RSA private key.").WithDefault(nBitsForKeypairDefault), + cmds.BoolOption(emptyRepoOptionName, "e", "Don't add and pin help files to the local storage."), + cmds.StringOption(profileOptionName, "p", "Apply profile settings to config. Multiple profiles can be separated by ','"), // TODO need to decide whether to expose the override as a file or a // directory. That is: should we allow the user to also specify the // name of the file? - // TODO cmdkit.StringOption("event-logs", "l", "Location for machine-readable event logs."), + // TODO cmds.StringOption("event-logs", "l", "Location for machine-readable event logs."), }, PreRun: func(req *cmds.Request, env cmds.Environment) error { cctx := env.(*oldcmds.Context) diff --git a/core/commands/active.go b/core/commands/active.go index 11508d445ee..9f924e9a908 100644 --- a/core/commands/active.go +++ b/core/commands/active.go @@ -9,7 +9,6 @@ import ( oldcmds "github.com/ipfs/go-ipfs/commands" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ) @@ -18,7 +17,7 @@ const ( ) var ActiveReqsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List commands run on this IPFS node.", ShortDescription: ` Lists running and recently run commands. @@ -28,8 +27,8 @@ Lists running and recently run commands. ctx := env.(*oldcmds.Context) return cmds.EmitOnce(res, ctx.ReqLog.Report()) }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(verboseOptionName, "v", "Print extra information."), + Options: []cmds.Option{ + cmds.BoolOption(verboseOptionName, "v", "Print extra information."), }, Subcommands: map[string]*cmds.Command{ "clear": clearInactiveCmd, @@ -86,7 +85,7 @@ Lists running and recently run commands. } var clearInactiveCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Clear inactive requests from the log.", }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { @@ -97,11 +96,11 @@ var clearInactiveCmd = &cmds.Command{ } var setRequestClearCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Set how long to keep inactive requests in the log.", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("time", true, false, "Time to keep inactive requests in log."), + Arguments: []cmds.Argument{ + cmds.StringArg("time", true, false, "Time to keep inactive requests in log."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { tval, err := time.ParseDuration(req.Arguments[0]) diff --git a/core/commands/add.go b/core/commands/add.go index 15b707dc761..0ad74ac95b1 100644 --- a/core/commands/add.go +++ b/core/commands/add.go @@ -10,7 +10,6 @@ import ( "github.com/ipfs/go-ipfs/core/commands/cmdenv" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" "github.com/ipfs/go-ipfs-files" coreiface "github.com/ipfs/interface-go-ipfs-core" @@ -51,7 +50,7 @@ const ( const adderOutChanSize = 8 var AddCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Add a file or directory to ipfs.", ShortDescription: ` Adds contents of to ipfs. Use -r to add directories (recursively). @@ -106,30 +105,30 @@ You can now check what blocks have been created by: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.FileArg("path", true, true, "The path to a file to be added to ipfs.").EnableRecursive().EnableStdin(), + Arguments: []cmds.Argument{ + cmds.FileArg("path", true, true, "The path to a file to be added to ipfs.").EnableRecursive().EnableStdin(), }, - Options: []cmdkit.Option{ + Options: []cmds.Option{ cmds.OptionRecursivePath, // a builtin option that allows recursive paths (-r, --recursive) cmds.OptionDerefArgs, // a builtin option that resolves passed in filesystem links (--dereference-args) cmds.OptionStdinName, // a builtin option that optionally allows wrapping stdin into a named file cmds.OptionHidden, - cmdkit.BoolOption(quietOptionName, "q", "Write minimal output."), - cmdkit.BoolOption(quieterOptionName, "Q", "Write only final hash."), - cmdkit.BoolOption(silentOptionName, "Write no output."), - cmdkit.BoolOption(progressOptionName, "p", "Stream progress data."), - cmdkit.BoolOption(trickleOptionName, "t", "Use trickle-dag format for dag generation."), - cmdkit.BoolOption(onlyHashOptionName, "n", "Only chunk and hash - do not write to disk."), - cmdkit.BoolOption(wrapOptionName, "w", "Wrap files with a directory object."), - cmdkit.StringOption(chunkerOptionName, "s", "Chunking algorithm, size-[bytes] or rabin-[min]-[avg]-[max]").WithDefault("size-262144"), - cmdkit.BoolOption(pinOptionName, "Pin this object when adding.").WithDefault(true), - cmdkit.BoolOption(rawLeavesOptionName, "Use raw blocks for leaf nodes. (experimental)"), - cmdkit.BoolOption(noCopyOptionName, "Add the file using filestore. Implies raw-leaves. (experimental)"), - cmdkit.BoolOption(fstoreCacheOptionName, "Check the filestore for pre-existing blocks. (experimental)"), - cmdkit.IntOption(cidVersionOptionName, "CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. (experimental)"), - cmdkit.StringOption(hashOptionName, "Hash function to use. Implies CIDv1 if not sha2-256. (experimental)").WithDefault("sha2-256"), - cmdkit.BoolOption(inlineOptionName, "Inline small blocks into CIDs. (experimental)"), - cmdkit.IntOption(inlineLimitOptionName, "Maximum block size to inline. (experimental)").WithDefault(32), + cmds.BoolOption(quietOptionName, "q", "Write minimal output."), + cmds.BoolOption(quieterOptionName, "Q", "Write only final hash."), + cmds.BoolOption(silentOptionName, "Write no output."), + cmds.BoolOption(progressOptionName, "p", "Stream progress data."), + cmds.BoolOption(trickleOptionName, "t", "Use trickle-dag format for dag generation."), + cmds.BoolOption(onlyHashOptionName, "n", "Only chunk and hash - do not write to disk."), + cmds.BoolOption(wrapOptionName, "w", "Wrap files with a directory object."), + cmds.StringOption(chunkerOptionName, "s", "Chunking algorithm, size-[bytes] or rabin-[min]-[avg]-[max]").WithDefault("size-262144"), + cmds.BoolOption(pinOptionName, "Pin this object when adding.").WithDefault(true), + cmds.BoolOption(rawLeavesOptionName, "Use raw blocks for leaf nodes. (experimental)"), + cmds.BoolOption(noCopyOptionName, "Add the file using filestore. Implies raw-leaves. (experimental)"), + cmds.BoolOption(fstoreCacheOptionName, "Check the filestore for pre-existing blocks. (experimental)"), + cmds.IntOption(cidVersionOptionName, "CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. (experimental)"), + cmds.StringOption(hashOptionName, "Hash function to use. Implies CIDv1 if not sha2-256. (experimental)").WithDefault("sha2-256"), + cmds.BoolOption(inlineOptionName, "Inline small blocks into CIDs. (experimental)"), + cmds.IntOption(inlineLimitOptionName, "Maximum block size to inline. (experimental)").WithDefault(32), }, PreRun: func(req *cmds.Request, env cmds.Environment) error { quiet, _ := req.Options[quietOptionName].(bool) diff --git a/core/commands/bitswap.go b/core/commands/bitswap.go index f322f4d90f1..1307414dbab 100644 --- a/core/commands/bitswap.go +++ b/core/commands/bitswap.go @@ -11,13 +11,12 @@ import ( bitswap "github.com/ipfs/go-bitswap" decision "github.com/ipfs/go-bitswap/decision" cidutil "github.com/ipfs/go-cidutil" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" peer "github.com/libp2p/go-libp2p-peer" ) var BitswapCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Interact with the bitswap agent.", ShortDescription: ``, }, @@ -35,13 +34,13 @@ const ( ) var showWantlistCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Show blocks currently on the wantlist.", ShortDescription: ` Print out all blocks currently on the bitswap wantlist for the local peer.`, }, - Options: []cmdkit.Option{ - cmdkit.StringOption(peerOptionName, "p", "Specify which peer to show wantlist for. Default: self."), + Options: []cmds.Option{ + cmds.StringOption(peerOptionName, "p", "Specify which peer to show wantlist for. Default: self."), }, Type: KeyList{}, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { @@ -94,13 +93,13 @@ const ( ) var bitswapStatCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Show some diagnostic information on the bitswap agent.", ShortDescription: ``, }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(bitswapVerboseOptionName, "v", "Print extra information"), - cmdkit.BoolOption(bitswapHumanOptionName, "Print sizes in human readable format (e.g., 1K 234M 2G)"), + Options: []cmds.Option{ + cmds.BoolOption(bitswapVerboseOptionName, "v", "Print extra information"), + cmds.BoolOption(bitswapHumanOptionName, "Print sizes in human readable format (e.g., 1K 234M 2G)"), }, Type: bitswap.Stat{}, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { @@ -110,7 +109,7 @@ var bitswapStatCmd = &cmds.Command{ } if !nd.IsOnline { - return cmdkit.Errorf(cmdkit.ErrClient, ErrNotOnline.Error()) + return cmds.Errorf(cmds.ErrClient, ErrNotOnline.Error()) } bs, ok := nd.Exchange.(*bitswap.Bitswap) @@ -169,7 +168,7 @@ var bitswapStatCmd = &cmds.Command{ } var ledgerCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Show the current ledger for a peer.", ShortDescription: ` 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 prints the ledger associated with a given peer. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("peer", true, false, "The PeerID (B58) of the ledger to inspect."), + Arguments: []cmds.Argument{ + cmds.StringArg("peer", true, false, "The PeerID (B58) of the ledger to inspect."), }, Type: decision.Receipt{}, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { @@ -218,7 +217,7 @@ prints the ledger associated with a given peer. } var reprovideCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Trigger reprovider.", ShortDescription: ` Trigger reprovider to announce our data to network. diff --git a/core/commands/block.go b/core/commands/block.go index 796ce72e841..46d18ff8e48 100644 --- a/core/commands/block.go +++ b/core/commands/block.go @@ -9,7 +9,6 @@ import ( util "github.com/ipfs/go-ipfs/blocks/blockstoreutil" cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" options "github.com/ipfs/interface-go-ipfs-core/options" path "github.com/ipfs/interface-go-ipfs-core/path" @@ -26,7 +25,7 @@ func (bs BlockStat) String() string { } var BlockCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Interact with raw IPFS blocks.", ShortDescription: ` 'ipfs block' is a plumbing command used to manipulate raw IPFS blocks. @@ -44,7 +43,7 @@ multihash. } var blockStatCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Print information of a raw IPFS block.", ShortDescription: ` 'ipfs block stat' is a plumbing command for retrieving information @@ -56,8 +55,8 @@ on raw IPFS blocks. It outputs the following to stdout: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("key", true, false, "The base58 multihash of an existing block to stat.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("key", true, false, "The base58 multihash of an existing block to stat.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -85,7 +84,7 @@ on raw IPFS blocks. It outputs the following to stdout: } var blockGetCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Get a raw IPFS block.", ShortDescription: ` 'ipfs block get' is a plumbing command for retrieving raw IPFS blocks. @@ -93,8 +92,8 @@ It outputs to stdout, and is a base58 encoded multihash. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("key", true, false, "The base58 multihash of an existing block to get.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("key", true, false, "The base58 multihash of an existing block to get.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -118,7 +117,7 @@ const ( ) var blockPutCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Store input as an IPFS block.", ShortDescription: ` '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. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.FileArg("data", true, false, "The data to be stored as an IPFS block.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.FileArg("data", true, false, "The data to be stored as an IPFS block.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.StringOption(blockFormatOptionName, "f", "cid format for blocks to be created with."), - cmdkit.StringOption(mhtypeOptionName, "multihash hash function").WithDefault("sha2-256"), - cmdkit.IntOption(mhlenOptionName, "multihash hash length").WithDefault(-1), - cmdkit.BoolOption(pinOptionName, "pin added blocks recursively").WithDefault(false), + Options: []cmds.Option{ + cmds.StringOption(blockFormatOptionName, "f", "cid format for blocks to be created with."), + cmds.StringOption(mhtypeOptionName, "multihash hash function").WithDefault("sha2-256"), + cmds.IntOption(mhlenOptionName, "multihash hash length").WithDefault(-1), + cmds.BoolOption(pinOptionName, "pin added blocks recursively").WithDefault(false), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -199,19 +198,19 @@ const ( ) var blockRmCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Remove IPFS block(s).", ShortDescription: ` 'ipfs block rm' is a plumbing command for removing raw ipfs blocks. It takes a list of base58 encoded multihashes to remove. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("hash", true, true, "Bash58 encoded multihash of block(s) to remove."), + Arguments: []cmds.Argument{ + cmds.StringArg("hash", true, true, "Bash58 encoded multihash of block(s) to remove."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(forceOptionName, "f", "Ignore nonexistent blocks."), - cmdkit.BoolOption(blockQuietOptionName, "q", "Write minimal output."), + Options: []cmds.Option{ + cmds.BoolOption(forceOptionName, "f", "Ignore nonexistent blocks."), + cmds.BoolOption(blockQuietOptionName, "q", "Write minimal output."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) diff --git a/core/commands/bootstrap.go b/core/commands/bootstrap.go index d9efce3512a..1b21fbd0053 100644 --- a/core/commands/bootstrap.go +++ b/core/commands/bootstrap.go @@ -9,7 +9,6 @@ import ( repo "github.com/ipfs/go-ipfs/repo" fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" config "github.com/ipfs/go-ipfs-config" ) @@ -21,7 +20,7 @@ type BootstrapOutput struct { var peerOptionDesc = "A peer to add to the bootstrap list (in the format '/')" var BootstrapCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Show or edit the list of bootstrap peers.", ShortDescription: ` Running 'ipfs bootstrap' with no arguments will run 'ipfs bootstrap list'. @@ -44,19 +43,19 @@ const ( ) var bootstrapAddCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Add peers to the bootstrap list.", ShortDescription: `Outputs a list of peers that were added (that weren't already in the bootstrap list). ` + bootstrapSecurityWarning, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("peer", false, true, peerOptionDesc).EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("peer", false, true, peerOptionDesc).EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(defaultOptionName, "Add default bootstrap nodes. (Deprecated, use 'default' subcommand instead)"), + Options: []cmds.Option{ + cmds.BoolOption(defaultOptionName, "Add default bootstrap nodes. (Deprecated, use 'default' subcommand instead)"), }, Subcommands: map[string]*cmds.Command{ "default": bootstrapAddDefaultCmd, @@ -122,7 +121,7 @@ in the bootstrap list). } var bootstrapAddDefaultCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Add default peers to the bootstrap list.", ShortDescription: `Outputs a list of peers that were added (that weren't already in the bootstrap list).`, @@ -169,17 +168,17 @@ const ( ) var bootstrapRemoveCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Remove peers from the bootstrap list.", ShortDescription: `Outputs the list of peers that were removed. ` + bootstrapSecurityWarning, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("peer", false, true, peerOptionDesc).EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("peer", false, true, peerOptionDesc).EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(bootstrapAllOptionName, "Remove all bootstrap peers. (Deprecated, use 'all' subcommand)"), + Options: []cmds.Option{ + cmds.BoolOption(bootstrapAllOptionName, "Remove all bootstrap peers. (Deprecated, use 'all' subcommand)"), }, Subcommands: map[string]*cmds.Command{ "all": bootstrapRemoveAllCmd, @@ -232,7 +231,7 @@ var bootstrapRemoveCmd = &cmds.Command{ } var bootstrapRemoveAllCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Remove all peers from the bootstrap list.", ShortDescription: `Outputs the list of peers that were removed.`, }, @@ -269,7 +268,7 @@ var bootstrapRemoveAllCmd = &cmds.Command{ } var bootstrapListCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Show peers in the bootstrap list.", ShortDescription: "Peers are output in the format '/'.", }, diff --git a/core/commands/cat.go b/core/commands/cat.go index 1032523b549..0fab3c577da 100644 --- a/core/commands/cat.go +++ b/core/commands/cat.go @@ -8,8 +8,7 @@ import ( "github.com/ipfs/go-ipfs/core/commands/cmdenv" - "github.com/ipfs/go-ipfs-cmdkit" - cmds "github.com/ipfs/go-ipfs-cmds" + "github.com/ipfs/go-ipfs-cmds" "github.com/ipfs/go-ipfs-files" "github.com/ipfs/interface-go-ipfs-core" "github.com/ipfs/interface-go-ipfs-core/path" @@ -22,17 +21,17 @@ const ( ) var CatCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Show IPFS object data.", ShortDescription: "Displays the data contained by an IPFS or IPNS object(s) at the given path.", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to be outputted.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to be outputted.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.Int64Option(offsetOptionName, "o", "Byte offset to begin reading from."), - cmdkit.Int64Option(lengthOptionName, "l", "Maximum number of bytes to read."), + Options: []cmds.Option{ + cmds.Int64Option(offsetOptionName, "o", "Byte offset to begin reading from."), + cmds.Int64Option(lengthOptionName, "l", "Maximum number of bytes to read."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -66,7 +65,7 @@ var CatCmd = &cmds.Command{ /* if err := corerepo.ConditionalGC(req.Context, node, length); err != nil { - re.SetError(err, cmdkit.ErrNormal) + re.SetError(err, cmds.ErrNormal) return } */ diff --git a/core/commands/cid.go b/core/commands/cid.go index d24873f6bd1..d670312a19b 100644 --- a/core/commands/cid.go +++ b/core/commands/cid.go @@ -9,7 +9,6 @@ import ( cid "github.com/ipfs/go-cid" cidutil "github.com/ipfs/go-cidutil" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" verifcid "github.com/ipfs/go-verifcid" mbase "github.com/multiformats/go-multibase" @@ -17,7 +16,7 @@ import ( ) var CidCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Convert and discover properties of CIDs", }, Subcommands: map[string]*cmds.Command{ @@ -36,7 +35,7 @@ const ( ) var cidFmtCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Format and convert a CID in various useful ways.", LongDescription: ` Format and converts 's in various useful ways. @@ -44,13 +43,13 @@ Format and converts 's in various useful ways. The optional format string is a printf style format string: ` + cidutil.FormatRef, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("cid", true, true, "Cids to format.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("cid", true, true, "Cids to format.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.StringOption(cidFormatOptionName, "Printf style format string.").WithDefault("%s"), - cmdkit.StringOption(cidVerisonOptionName, "CID version to convert to."), - cmdkit.StringOption(cidMultibaseOptionName, "Multibase to display CID in."), + Options: []cmds.Option{ + cmds.StringOption(cidFormatOptionName, "Printf style format string.").WithDefault("%s"), + cmds.StringOption(cidVerisonOptionName, "CID version to convert to."), + cmds.StringOption(cidMultibaseOptionName, "Multibase to display CID in."), }, Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error { fmtStr, _ := req.Options[cidFormatOptionName].(string) @@ -107,11 +106,11 @@ type CidFormatRes struct { } var base32Cmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Convert CIDs to Base32 CID version 1.", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("cid", true, true, "Cids to convert.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("cid", true, true, "Cids to convert.").EnableStdin(), }, Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error { opts := cidFormatOpts{ @@ -226,12 +225,12 @@ const ( ) var basesCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List available multibase encodings.", }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(prefixOptionName, "also include the single leter prefixes in addition to the code"), - cmdkit.BoolOption(numericOptionName, "also include numeric codes"), + Options: []cmds.Option{ + cmds.BoolOption(prefixOptionName, "also include the single leter prefixes in addition to the code"), + cmds.BoolOption(numericOptionName, "also include numeric codes"), }, Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error { var res []CodeAndName @@ -274,11 +273,11 @@ const ( ) var codecsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List available CID codecs.", }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(codecsNumericOptionName, "also include numeric codes"), + Options: []cmds.Option{ + cmds.BoolOption(codecsNumericOptionName, "also include numeric codes"), }, Run: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error { var res []CodeAndName @@ -306,7 +305,7 @@ var codecsCmd = &cmds.Command{ } var hashesCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List available multihashes.", }, Options: codecsCmd.Options, diff --git a/core/commands/cmdenv/cidbase.go b/core/commands/cmdenv/cidbase.go index fc1680965b5..32f2c2157de 100644 --- a/core/commands/cmdenv/cidbase.go +++ b/core/commands/cmdenv/cidbase.go @@ -6,13 +6,12 @@ import ( cid "github.com/ipfs/go-cid" cidenc "github.com/ipfs/go-cidutil/cidenc" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" mbase "github.com/multiformats/go-multibase" ) -var OptionCidBase = cmdkit.StringOption("cid-base", "Multibase encoding used for version 1 CIDs in output.") -var OptionUpgradeCidV0InOutput = cmdkit.BoolOption("upgrade-cidv0-in-output", "Upgrade version 0 to version 1 CIDs in output.") +var OptionCidBase = cmds.StringOption("cid-base", "Multibase encoding used for version 1 CIDs in output.") +var OptionUpgradeCidV0InOutput = cmds.BoolOption("upgrade-cidv0-in-output", "Upgrade version 0 to version 1 CIDs in output.") // GetCidEncoder processes the `cid-base` and `output-cidv1` options and // returns a encoder to use based on those parameters. diff --git a/core/commands/commands.go b/core/commands/commands.go index 3c5a58da96b..8f0f6fe1095 100644 --- a/core/commands/commands.go +++ b/core/commands/commands.go @@ -12,8 +12,7 @@ import ( "sort" "strings" - "github.com/ipfs/go-ipfs-cmdkit" - cmds "github.com/ipfs/go-ipfs-cmds" + "github.com/ipfs/go-ipfs-cmds" ) type commandEncoder struct { @@ -60,12 +59,12 @@ const ( // and returns a command that lists the subcommands in that root func CommandsCmd(root *cmds.Command) *cmds.Command { return &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List all available commands.", ShortDescription: `Lists all available commands (and subcommands) and exits.`, }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(flagsOptionName, "f", "Show command flags"), + Options: []cmds.Option{ + cmds.BoolOption(flagsOptionName, "f", "Show command flags"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { rootCmd := cmd2outputCmd("ipfs", root) diff --git a/core/commands/config.go b/core/commands/config.go index 8c7869e9138..90f5eca826d 100644 --- a/core/commands/config.go +++ b/core/commands/config.go @@ -15,7 +15,6 @@ import ( "github.com/ipfs/go-ipfs/repo/fsrepo" "github.com/elgris/jsondiff" - "github.com/ipfs/go-ipfs-cmdkit" "github.com/ipfs/go-ipfs-cmds" "github.com/ipfs/go-ipfs-config" ) @@ -38,7 +37,7 @@ const ( ) var ConfigCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Get and set ipfs config values.", ShortDescription: ` 'ipfs config' controls configuration variables. It works like 'git config'. @@ -66,13 +65,13 @@ Set the value of the 'Datastore.Path' key: "replace": configReplaceCmd, "profile": configProfileCmd, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("key", true, false, "The key of the config entry (e.g. \"Addresses.API\")."), - cmdkit.StringArg("value", false, false, "The value to set the config entry to."), + Arguments: []cmds.Argument{ + cmds.StringArg("key", true, false, "The key of the config entry (e.g. \"Addresses.API\")."), + cmds.StringArg("value", false, false, "The value to set the config entry to."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(configBoolOptionName, "Set a boolean value."), - cmdkit.BoolOption(configJSONOptionName, "Parse stringified JSON."), + Options: []cmds.Option{ + cmds.BoolOption(configBoolOptionName, "Set a boolean value."), + cmds.BoolOption(configJSONOptionName, "Parse stringified JSON."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { args := req.Arguments @@ -142,7 +141,7 @@ Set the value of the 'Datastore.Path' key: } var configShowCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Output config file contents.", ShortDescription: ` 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 { } var configEditCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Open the config file for editing in $EDITOR.", ShortDescription: ` To use 'ipfs config edit', you must have the $EDITOR environment @@ -257,7 +256,7 @@ variable set to your preferred text editor. } var configReplaceCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Replace the config with .", ShortDescription: ` Make sure to back up the config file first if necessary, as this operation @@ -265,8 +264,8 @@ can't be undone. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.FileArg("file", true, false, "The file to use as the new config."), + Arguments: []cmds.Argument{ + cmds.FileArg("file", true, false, "The file to use as the new config."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { cfgRoot, err := cmdenv.GetConfigRoot(env) @@ -291,7 +290,7 @@ can't be undone. } var configProfileCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Apply profiles to config.", ShortDescription: fmt.Sprintf(` Available profiles: @@ -305,14 +304,14 @@ Available profiles: } var configProfileApplyCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Apply profile to config.", }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(configDryRunOptionName, "print difference between the current config and the config that would be generated"), + Options: []cmds.Option{ + cmds.BoolOption(configDryRunOptionName, "print difference between the current config and the config that would be generated"), }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("profile", true, false, "The profile to apply to the config."), + Arguments: []cmds.Argument{ + cmds.StringArg("profile", true, false, "The profile to apply to the config."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { profile, ok := config.Profiles[req.Arguments[0]] diff --git a/core/commands/dag/dag.go b/core/commands/dag/dag.go index 66b6dde35c6..66d50feb1f5 100644 --- a/core/commands/dag/dag.go +++ b/core/commands/dag/dag.go @@ -11,7 +11,6 @@ import ( cid "github.com/ipfs/go-cid" cidenc "github.com/ipfs/go-cidutil/cidenc" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" files "github.com/ipfs/go-ipfs-files" ipld "github.com/ipfs/go-ipld-format" @@ -21,7 +20,7 @@ import ( ) var DagCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Interact with ipld dag objects.", ShortDescription: ` 'ipfs dag' is used for creating and manipulating dag objects. @@ -49,21 +48,21 @@ type ResolveOutput struct { } var DagPutCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Add a dag node to ipfs.", ShortDescription: ` 'ipfs dag put' accepts input from a file or stdin and parses it into an object of the specified format. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.FileArg("object data", true, true, "The object to put").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.FileArg("object data", true, true, "The object to put").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.StringOption("format", "f", "Format that the object will be added as.").WithDefault("cbor"), - cmdkit.StringOption("input-enc", "Format that the input object will be.").WithDefault("json"), - cmdkit.BoolOption("pin", "Pin this object when adding."), - cmdkit.StringOption("hash", "Hash function to use").WithDefault(""), + Options: []cmds.Option{ + cmds.StringOption("format", "f", "Format that the object will be added as.").WithDefault("cbor"), + cmds.StringOption("input-enc", "Format that the input object will be.").WithDefault("json"), + cmds.BoolOption("pin", "Pin this object when adding."), + cmds.StringOption("hash", "Hash function to use").WithDefault(""), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -144,15 +143,15 @@ into an object of the specified format. } var DagGetCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Get a dag node from ipfs.", ShortDescription: ` 'ipfs dag get' fetches a dag node from ipfs and prints it out in the specified format. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("ref", true, false, "The object to get").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("ref", true, false, "The object to get").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -185,14 +184,14 @@ format. // DagResolveCmd returns address of highest block within a path and a path remainder var DagResolveCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Resolve ipld block", ShortDescription: ` 'ipfs dag resolve' fetches a dag node from ipfs, prints it's address and remaining path. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("ref", true, false, "The path to resolve").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("ref", true, false, "The path to resolve").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) diff --git a/core/commands/dht.go b/core/commands/dht.go index c5011abcd48..8684a4f6aff 100644 --- a/core/commands/dht.go +++ b/core/commands/dht.go @@ -10,7 +10,6 @@ import ( cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" cid "github.com/ipfs/go-cid" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ipld "github.com/ipfs/go-ipld-format" dag "github.com/ipfs/go-merkledag" @@ -28,7 +27,7 @@ var ErrNotDHT = errors.New("routing service is not a DHT") // Everything *except `query` goes into `ipfs routing`. var DhtCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Issue commands directly through the DHT.", ShortDescription: ``, }, @@ -48,16 +47,16 @@ const ( ) var queryDhtCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Find the closest Peer IDs to a given Peer ID by querying the DHT.", ShortDescription: "Outputs a list of newline-delimited Peer IDs.", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("peerID", true, true, "The peerID to run the query against."), + Arguments: []cmds.Argument{ + cmds.StringArg("peerID", true, true, "The peerID to run the query against."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(dhtVerboseOptionName, "v", "Print extra information."), + Options: []cmds.Option{ + cmds.BoolOption(dhtVerboseOptionName, "v", "Print extra information."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) @@ -123,17 +122,17 @@ const ( ) var findProvidersDhtCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Find peers that can provide a specific value, given a key.", ShortDescription: "Outputs a list of newline-delimited provider Peer IDs.", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("key", true, true, "The key to find providers for."), + Arguments: []cmds.Argument{ + cmds.StringArg("key", true, true, "The key to find providers for."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(dhtVerboseOptionName, "v", "Print extra information."), - cmdkit.IntOption(numProvidersOptionName, "n", "The number of providers to find.").WithDefault(20), + Options: []cmds.Option{ + cmds.BoolOption(dhtVerboseOptionName, "v", "Print extra information."), + cmds.IntOption(numProvidersOptionName, "n", "The number of providers to find.").WithDefault(20), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := cmdenv.GetNode(env) @@ -215,16 +214,16 @@ const ( ) var provideRefDhtCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Announce to the network that you are providing given values.", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("key", true, true, "The key[s] to send provide records for.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("key", true, true, "The key[s] to send provide records for.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(dhtVerboseOptionName, "v", "Print extra information."), - cmdkit.BoolOption(recursiveOptionName, "r", "Recursively provide entire graph."), + Options: []cmds.Option{ + cmds.BoolOption(dhtVerboseOptionName, "v", "Print extra information."), + cmds.BoolOption(recursiveOptionName, "r", "Recursively provide entire graph."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) @@ -344,16 +343,16 @@ func provideKeysRec(ctx context.Context, r routing.IpfsRouting, dserv ipld.DAGSe } var findPeerDhtCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Find the multiaddresses associated with a Peer ID.", ShortDescription: "Outputs a list of newline-delimited multiaddresses.", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("peerID", true, true, "The ID of the peer to search for."), + Arguments: []cmds.Argument{ + cmds.StringArg("peerID", true, true, "The ID of the peer to search for."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(dhtVerboseOptionName, "v", "Print extra information."), + Options: []cmds.Option{ + cmds.BoolOption(dhtVerboseOptionName, "v", "Print extra information."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) @@ -420,7 +419,7 @@ var findPeerDhtCmd = &cmds.Command{ } var getValueDhtCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Given a key, query the routing system for its best value.", ShortDescription: ` Outputs the best value for the given key. @@ -433,11 +432,11 @@ Different key types can specify other 'best' rules. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("key", true, true, "The key to find a value for."), + Arguments: []cmds.Argument{ + cmds.StringArg("key", true, true, "The key to find a value for."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(dhtVerboseOptionName, "v", "Print extra information."), + Options: []cmds.Option{ + cmds.BoolOption(dhtVerboseOptionName, "v", "Print extra information."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) @@ -505,7 +504,7 @@ Different key types can specify other 'best' rules. } var putValueDhtCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Write a key/value pair to the routing system.", ShortDescription: ` 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. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("key", true, false, "The key to store the value at."), - cmdkit.StringArg("value", true, false, "The value to store.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("key", true, false, "The key to store the value at."), + cmds.StringArg("value", true, false, "The value to store.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(dhtVerboseOptionName, "v", "Print extra information."), + Options: []cmds.Option{ + cmds.BoolOption(dhtVerboseOptionName, "v", "Print extra information."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) diff --git a/core/commands/diag.go b/core/commands/diag.go index bfd75caac54..d7ddb6dfd13 100644 --- a/core/commands/diag.go +++ b/core/commands/diag.go @@ -1,12 +1,11 @@ package commands import ( - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ) var DiagCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Generate diagnostic reports.", }, diff --git a/core/commands/dns.go b/core/commands/dns.go index f1f309cd848..3db12ab95d8 100644 --- a/core/commands/dns.go +++ b/core/commands/dns.go @@ -8,7 +8,6 @@ import ( namesys "github.com/ipfs/go-ipfs/namesys" nsopts "github.com/ipfs/interface-go-ipfs-core/options/namesys" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ) @@ -17,7 +16,7 @@ const ( ) var DNSCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Resolve DNS links.", ShortDescription: ` Multihashes are hard to remember, but domain names are usually easy to @@ -54,11 +53,11 @@ The resolver can recursively resolve: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("domain-name", true, false, "The domain-name name to resolve.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("domain-name", true, false, "The domain-name name to resolve.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(dnsRecursiveOptionName, "r", "Resolve until the result is not a DNS link.").WithDefault(true), + Options: []cmds.Option{ + cmds.BoolOption(dnsRecursiveOptionName, "r", "Resolve until the result is not a DNS link.").WithDefault(true), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { recursive, _ := req.Options[dnsRecursiveOptionName].(bool) diff --git a/core/commands/external.go b/core/commands/external.go index 926ccccba68..b2fde2fe1c9 100644 --- a/core/commands/external.go +++ b/core/commands/external.go @@ -8,14 +8,13 @@ import ( "os/exec" "strings" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ) func ExternalBinary() *cmds.Command { return &cmds.Command{ - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("args", false, true, "Arguments for subcommand."), + Arguments: []cmds.Argument{ + cmds.StringArg("args", false, true, "Arguments for subcommand."), }, External: true, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { diff --git a/core/commands/files.go b/core/commands/files.go index 700a78bc790..cb429d922ee 100644 --- a/core/commands/files.go +++ b/core/commands/files.go @@ -17,7 +17,6 @@ import ( bservice "github.com/ipfs/go-blockservice" cid "github.com/ipfs/go-cid" cidenc "github.com/ipfs/go-cidutil/cidenc" - "github.com/ipfs/go-ipfs-cmdkit" "github.com/ipfs/go-ipfs-cmds" "github.com/ipfs/go-ipfs-exchange-offline" ipld "github.com/ipfs/go-ipld-format" @@ -34,7 +33,7 @@ var flog = logging.Logger("cmds/files") // FilesCmd is the 'ipfs files' command var FilesCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Interact with unixfs files.", ShortDescription: ` 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' operations. `, }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(filesFlushOptionName, "f", "Flush target and ancestors after write.").WithDefault(true), + Options: []cmds.Option{ + cmds.BoolOption(filesFlushOptionName, "f", "Flush target and ancestors after write.").WithDefault(true), }, Subcommands: map[string]*cmds.Command{ "read": filesReadCmd, @@ -72,8 +71,8 @@ const ( filesHashOptionName = "hash" ) -var cidVersionOption = cmdkit.IntOption(filesCidVersionOptionName, "cid-ver", "Cid version to use. (experimental)") -var hashOption = cmdkit.StringOption(filesHashOptionName, "Hash function to use. Will set Cid version to 1 if used. (experimental)") +var cidVersionOption = cmds.IntOption(filesCidVersionOptionName, "cid-ver", "Cid version to use. (experimental)") +var hashOption = cmds.StringOption(filesHashOptionName, "Hash function to use. Will set Cid version to 1 if used. (experimental)") var errFormat = errors.New("format was set by multiple options. Only one format option is allowed") @@ -100,25 +99,25 @@ Type: ` ) var filesStatCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Display file status.", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("path", true, false, "Path to node to stat."), + Arguments: []cmds.Argument{ + cmds.StringArg("path", true, false, "Path to node to stat."), }, - Options: []cmdkit.Option{ - cmdkit.StringOption(filesFormatOptionName, "Print statistics in given format. Allowed tokens: "+ + Options: []cmds.Option{ + cmds.StringOption(filesFormatOptionName, "Print statistics in given format. Allowed tokens: "+ " . Conflicts with other format options.").WithDefault(defaultStatFormat), - cmdkit.BoolOption(filesHashOptionName, "Print only hash. Implies '--format='. Conflicts with other format options."), - cmdkit.BoolOption(filesSizeOptionName, "Print only size. Implies '--format='. Conflicts with other format options."), - cmdkit.BoolOption(filesWithLocalOptionName, "Compute the amount of the dag that is local, and if possible the total size"), + cmds.BoolOption(filesHashOptionName, "Print only hash. Implies '--format='. Conflicts with other format options."), + cmds.BoolOption(filesSizeOptionName, "Print only size. Implies '--format='. Conflicts with other format options."), + cmds.BoolOption(filesWithLocalOptionName, "Compute the amount of the dag that is local, and if possible the total size"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { _, err := statGetFormatOptions(req) if err != nil { - return cmdkit.Errorf(cmdkit.ErrClient, err.Error()) + return cmds.Errorf(cmds.ErrClient, err.Error()) } node, err := cmdenv.GetNode(env) @@ -305,12 +304,12 @@ func walkBlock(ctx context.Context, dagserv ipld.DAGService, nd ipld.Node) (bool } var filesCpCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Copy files into mfs.", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("source", true, false, "Source object to copy."), - cmdkit.StringArg("dest", true, false, "Destination to copy object to."), + Arguments: []cmds.Argument{ + cmds.StringArg("source", true, false, "Source object to copy."), + cmds.StringArg("dest", true, false, "Destination to copy object to."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) @@ -385,7 +384,7 @@ const ( ) var filesLsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List directories in the local mutable namespace.", ShortDescription: ` List directories in the local mutable namespace. @@ -405,12 +404,12 @@ Examples: bar `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("path", false, false, "Path to show listing for. Defaults to '/'."), + Arguments: []cmds.Argument{ + cmds.StringArg("path", false, false, "Path to show listing for. Defaults to '/'."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(longOptionName, "Use long listing format."), - cmdkit.BoolOption(dontSortOptionName, "Do not sort; list entries in directory order."), + Options: []cmds.Option{ + cmds.BoolOption(longOptionName, "Use long listing format."), + cmds.BoolOption(dontSortOptionName, "Do not sort; list entries in directory order."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { var arg string @@ -520,7 +519,7 @@ const ( ) var filesReadCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Read a file in a given mfs.", ShortDescription: ` Read a specified number of bytes from a file at a given offset. By default, @@ -533,12 +532,12 @@ Examples: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("path", true, false, "Path to file to be read."), + Arguments: []cmds.Argument{ + cmds.StringArg("path", true, false, "Path to file to be read."), }, - Options: []cmdkit.Option{ - cmdkit.Int64Option(filesOffsetOptionName, "o", "Byte offset to begin reading from."), - cmdkit.Int64Option(filesCountOptionName, "n", "Maximum number of bytes to read."), + Options: []cmds.Option{ + cmds.Int64Option(filesOffsetOptionName, "o", "Byte offset to begin reading from."), + cmds.Int64Option(filesCountOptionName, "n", "Maximum number of bytes to read."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) @@ -613,7 +612,7 @@ func (crw *contextReaderWrapper) Read(b []byte) (int, error) { } var filesMvCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Move files.", ShortDescription: ` Move files around. Just like traditional unix mv. @@ -625,9 +624,9 @@ Example: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("source", true, false, "Source file to move."), - cmdkit.StringArg("dest", true, false, "Destination path for file to be moved to."), + Arguments: []cmds.Argument{ + cmds.StringArg("source", true, false, "Source file to move."), + cmds.StringArg("dest", true, false, "Destination path for file to be moved to."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) @@ -663,7 +662,7 @@ const ( ) var filesWriteCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Write to a mutable file in a given filesystem.", ShortDescription: ` 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 stat' on the file or any of its ancestors. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("path", true, false, "Path to write to."), - cmdkit.FileArg("data", true, false, "Data to write.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("path", true, false, "Path to write to."), + cmds.FileArg("data", true, false, "Data to write.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.Int64Option(filesOffsetOptionName, "o", "Byte offset to begin writing at."), - cmdkit.BoolOption(filesCreateOptionName, "e", "Create the file if it does not exist."), - cmdkit.BoolOption(filesParentsOptionName, "p", "Make parent directories as needed."), - cmdkit.BoolOption(filesTruncateOptionName, "t", "Truncate the file to size zero before writing."), - cmdkit.Int64Option(filesCountOptionName, "n", "Maximum number of bytes to read."), - cmdkit.BoolOption(filesRawLeavesOptionName, "Use raw blocks for newly created leaf nodes. (experimental)"), + Options: []cmds.Option{ + cmds.Int64Option(filesOffsetOptionName, "o", "Byte offset to begin writing at."), + cmds.BoolOption(filesCreateOptionName, "e", "Create the file if it does not exist."), + cmds.BoolOption(filesParentsOptionName, "p", "Make parent directories as needed."), + cmds.BoolOption(filesTruncateOptionName, "t", "Truncate the file to size zero before writing."), + cmds.Int64Option(filesCountOptionName, "n", "Maximum number of bytes to read."), + cmds.BoolOption(filesRawLeavesOptionName, "Use raw blocks for newly created leaf nodes. (experimental)"), cidVersionOption, hashOption, }, @@ -800,7 +799,7 @@ stat' on the file or any of its ancestors. } var filesMkdirCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Make directories.", ShortDescription: ` Create the directory if it does not already exist. @@ -817,11 +816,11 @@ Examples: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("path", true, false, "Path to dir to make."), + Arguments: []cmds.Argument{ + cmds.StringArg("path", true, false, "Path to dir to make."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(filesParentsOptionName, "p", "No error if existing, make parent directories as needed."), + Options: []cmds.Option{ + cmds.BoolOption(filesParentsOptionName, "p", "No error if existing, make parent directories as needed."), cidVersionOption, hashOption, }, @@ -860,15 +859,15 @@ type flushRes struct { } var filesFlushCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Flush a given path's data to disk.", ShortDescription: ` Flush a given path to disk. This is only useful when other commands are run with the '--flush=false'. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("path", false, false, "Path to flush. Default: '/'."), + Arguments: []cmds.Argument{ + cmds.StringArg("path", false, false, "Path to flush. Default: '/'."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) @@ -897,16 +896,16 @@ are run with the '--flush=false'. } var filesChcidCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Change the cid version or hash function of the root node of a given path.", ShortDescription: ` Change the cid version or hash function of the root node of a given path. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("path", false, false, "Path to change. Default: '/'."), + Arguments: []cmds.Argument{ + cmds.StringArg("path", false, false, "Path to change. Default: '/'."), }, - Options: []cmdkit.Option{ + Options: []cmds.Option{ cidVersionOption, hashOption, }, @@ -957,7 +956,7 @@ func updatePath(rt *mfs.Root, pth string, builder cid.Builder) error { } var filesRmCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Remove a file.", ShortDescription: ` Remove files or directories. @@ -971,12 +970,12 @@ Remove files or directories. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("path", true, true, "File to remove."), + Arguments: []cmds.Argument{ + cmds.StringArg("path", true, true, "File to remove."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(recursiveOptionName, "r", "Recursively remove directories."), - cmdkit.BoolOption(forceOptionName, "Forcibly remove target at path; implies -r for directories"), + Options: []cmds.Option{ + cmds.BoolOption(recursiveOptionName, "r", "Recursively remove directories."), + cmds.BoolOption(forceOptionName, "Forcibly remove target at path; implies -r for directories"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) diff --git a/core/commands/filestore.go b/core/commands/filestore.go index 9d616822084..bf0f6981f0f 100644 --- a/core/commands/filestore.go +++ b/core/commands/filestore.go @@ -10,13 +10,12 @@ import ( e "github.com/ipfs/go-ipfs/core/commands/e" filestore "github.com/ipfs/go-ipfs/filestore" - cid "github.com/ipfs/go-cid" - "github.com/ipfs/go-ipfs-cmdkit" - cmds "github.com/ipfs/go-ipfs-cmds" + "github.com/ipfs/go-cid" + "github.com/ipfs/go-ipfs-cmds" ) var FileStoreCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Interact with filestore objects.", }, Subcommands: map[string]*cmds.Command{ @@ -31,7 +30,7 @@ const ( ) var lsFileStore = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List objects in filestore.", LongDescription: ` List objects in the filestore. @@ -44,11 +43,11 @@ The output is: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("obj", false, true, "Cid of objects to list."), + Arguments: []cmds.Argument{ + cmds.StringArg("obj", false, true, "Cid of objects to list."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(fileOrderOptionName, "sort the results based on the path of the backing file"), + Options: []cmds.Option{ + cmds.BoolOption(fileOrderOptionName, "sort the results based on the path of the backing file"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { _, fs, err := getFilestore(env) @@ -98,7 +97,7 @@ The output is: } var verifyFileStore = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Verify objects in filestore.", LongDescription: ` Verify objects in the filestore. @@ -121,11 +120,11 @@ ERROR: internal error, most likely due to a corrupt database For ERROR entries the error will also be printed to stderr. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("obj", false, true, "Cid of objects to verify."), + Arguments: []cmds.Argument{ + cmds.StringArg("obj", false, true, "Cid of objects to verify."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(fileOrderOptionName, "verify the objects based on the order of the backing file"), + Options: []cmds.Option{ + cmds.BoolOption(fileOrderOptionName, "verify the objects based on the order of the backing file"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { _, fs, err := getFilestore(env) @@ -187,7 +186,7 @@ For ERROR entries the error will also be printed to stderr. } var dupsFileStore = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List blocks that are both in the filestore and standard block storage.", }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { diff --git a/core/commands/get.go b/core/commands/get.go index 8dfc7359ebd..41dab875605 100644 --- a/core/commands/get.go +++ b/core/commands/get.go @@ -14,7 +14,6 @@ import ( "github.com/ipfs/go-ipfs/core/commands/cmdenv" "github.com/ipfs/go-ipfs/core/commands/e" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" files "github.com/ipfs/go-ipfs-files" "github.com/ipfs/interface-go-ipfs-core/path" @@ -32,7 +31,7 @@ const ( ) var GetCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Download IPFS objects.", ShortDescription: ` 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>'. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("ipfs-path", true, false, "The path to the IPFS object(s) to be outputted.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("ipfs-path", true, false, "The path to the IPFS object(s) to be outputted.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.StringOption(outputOptionName, "o", "The path where the output should be stored."), - cmdkit.BoolOption(archiveOptionName, "a", "Output a TAR archive."), - cmdkit.BoolOption(compressOptionName, "C", "Compress the output with GZIP compression."), - cmdkit.IntOption(compressionLevelOptionName, "l", "The level of compression (1-9)."), + Options: []cmds.Option{ + cmds.StringOption(outputOptionName, "o", "The path where the output should be stored."), + cmds.BoolOption(archiveOptionName, "a", "Output a TAR archive."), + cmds.BoolOption(compressOptionName, "C", "Compress the output with GZIP compression."), + cmds.IntOption(compressionLevelOptionName, "l", "The level of compression (1-9)."), }, PreRun: func(req *cmds.Request, env cmds.Environment) error { _, err := getCompressOptions(req) diff --git a/core/commands/get_test.go b/core/commands/get_test.go index a869a5087c5..0a17d884245 100644 --- a/core/commands/get_test.go +++ b/core/commands/get_test.go @@ -5,14 +5,13 @@ import ( "fmt" "testing" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ) func TestGetOutputPath(t *testing.T) { cases := []struct { args []string - opts cmdkit.OptMap + opts cmds.OptMap outPath string }{ { @@ -24,7 +23,7 @@ func TestGetOutputPath(t *testing.T) { }, { args: []string{"/ipns/multiformats.io/", "some-other-arg-to-be-ignored"}, - opts: cmdkit.OptMap{ + opts: cmds.OptMap{ "output": "takes-precedence", }, outPath: "takes-precedence", @@ -32,17 +31,17 @@ func TestGetOutputPath(t *testing.T) { { args: []string{"/ipns/multiformats.io/"}, outPath: "multiformats.io", - opts: cmdkit.OptMap{}, + opts: cmds.OptMap{}, }, { args: []string{"/ipns/multiformats.io/logo.svg/"}, outPath: "logo.svg", - opts: cmdkit.OptMap{}, + opts: cmds.OptMap{}, }, { args: []string{"/ipns/multiformats.io", "some-other-arg-to-be-ignored"}, outPath: "multiformats.io", - opts: cmdkit.OptMap{}, + opts: cmds.OptMap{}, }, } diff --git a/core/commands/id.go b/core/commands/id.go index ad63a641ed1..f7607970cb1 100644 --- a/core/commands/id.go +++ b/core/commands/id.go @@ -11,11 +11,10 @@ import ( core "github.com/ipfs/go-ipfs/core" cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" - "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ic "github.com/libp2p/go-libp2p-crypto" kb "github.com/libp2p/go-libp2p-kbucket" - "github.com/libp2p/go-libp2p-peer" + peer "github.com/libp2p/go-libp2p-peer" pstore "github.com/libp2p/go-libp2p-peerstore" identify "github.com/libp2p/go-libp2p/p2p/protocol/identify" ) @@ -42,7 +41,7 @@ const ( ) var IDCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Show ipfs node id info.", ShortDescription: ` Prints out information about the specified peer. @@ -60,11 +59,11 @@ EXAMPLE: ipfs id Qmece2RkXhsKe5CRooNisBTh4SK119KrXXGmoK6V3kb8aH -f="\n" `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("peerid", false, false, "Peer.ID of node to look up."), + Arguments: []cmds.Argument{ + cmds.StringArg("peerid", false, false, "Peer.ID of node to look up."), }, - Options: []cmdkit.Option{ - cmdkit.StringOption(formatOptionName, "f", "Optional output format."), + Options: []cmds.Option{ + cmds.StringOption(formatOptionName, "f", "Optional output format."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := cmdenv.GetNode(env) diff --git a/core/commands/keystore.go b/core/commands/keystore.go index 1935314aa86..5cf6d5c03d2 100644 --- a/core/commands/keystore.go +++ b/core/commands/keystore.go @@ -7,13 +7,12 @@ import ( cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" options "github.com/ipfs/interface-go-ipfs-core/options" ) var KeyCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Create and list IPNS name keypairs", ShortDescription: ` 'ipfs key gen' generates a new keypair for usage with IPNS and 'ipfs name @@ -60,15 +59,15 @@ const ( ) var keyGenCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Create a new keypair", }, - Options: []cmdkit.Option{ - cmdkit.StringOption(keyStoreTypeOptionName, "t", "type of the key to create [rsa, ed25519]"), - cmdkit.IntOption(keyStoreSizeOptionName, "s", "size of the key to generate"), + Options: []cmds.Option{ + cmds.StringOption(keyStoreTypeOptionName, "t", "type of the key to create [rsa, ed25519]"), + cmds.IntOption(keyStoreSizeOptionName, "s", "size of the key to generate"), }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("name", true, false, "name of key to create"), + Arguments: []cmds.Argument{ + cmds.StringArg("name", true, false, "name of key to create"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -114,11 +113,11 @@ var keyGenCmd = &cmds.Command{ } var keyListCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List all local keypairs", }, - Options: []cmdkit.Option{ - cmdkit.BoolOption("l", "Show extra information about keys."), + Options: []cmds.Option{ + cmds.BoolOption("l", "Show extra information about keys."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -150,15 +149,15 @@ const ( ) var keyRenameCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Rename a keypair", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("name", true, false, "name of key to rename"), - cmdkit.StringArg("newName", true, false, "new name of the key"), + Arguments: []cmds.Argument{ + cmds.StringArg("name", true, false, "name of key to rename"), + cmds.StringArg("newName", true, false, "new name of the key"), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(keyStoreForceOptionName, "f", "Allow to overwrite an existing key."), + Options: []cmds.Option{ + cmds.BoolOption(keyStoreForceOptionName, "f", "Allow to overwrite an existing key."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -196,14 +195,14 @@ var keyRenameCmd = &cmds.Command{ } var keyRmCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Remove a keypair", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("name", true, true, "names of keys to remove").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("name", true, true, "names of keys to remove").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption("l", "Show extra information about keys."), + Options: []cmds.Option{ + cmds.BoolOption("l", "Show extra information about keys."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) diff --git a/core/commands/log.go b/core/commands/log.go index 93f35bf974c..7d9fb48db18 100644 --- a/core/commands/log.go +++ b/core/commands/log.go @@ -4,7 +4,6 @@ import ( "fmt" "io" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" logging "github.com/ipfs/go-log" lwriter "github.com/ipfs/go-log/writer" @@ -17,7 +16,7 @@ import ( var logAllKeyword = "all" var LogCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Interact with the daemon log output.", ShortDescription: ` '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): } var logLevelCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Change the logging level.", ShortDescription: ` Change the verbosity of one or all subsystems log output. This does not affect @@ -46,11 +45,11 @@ the event log. `, }, - Arguments: []cmdkit.Argument{ + Arguments: []cmds.Argument{ // TODO use a different keyword for 'all' because all can theoretically // clash with a subsystem name - cmdkit.StringArg("subsystem", true, false, fmt.Sprintf("The subsystem logging identifier. Use '%s' for all subsystems.", logAllKeyword)), - cmdkit.StringArg("level", true, false, `The log level, with 'debug' the most verbose and 'critical' the least verbose. + cmds.StringArg("subsystem", true, false, fmt.Sprintf("The subsystem logging identifier. Use '%s' for all subsystems.", logAllKeyword)), + cmds.StringArg("level", true, false, `The log level, with 'debug' the most verbose and 'critical' the least verbose. One of: debug, info, warning, error, critical. `), }, @@ -81,7 +80,7 @@ the event log. } var logLsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List the logging subsystems.", ShortDescription: ` 'ipfs log ls' is a utility command used to list the logging @@ -103,7 +102,7 @@ subsystems of a running daemon. } var logTailCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Read the event log.", ShortDescription: ` Outputs event log messages (not other log messages) as they are generated. diff --git a/core/commands/ls.go b/core/commands/ls.go index c755e25d54f..23c0ebc05ad 100644 --- a/core/commands/ls.go +++ b/core/commands/ls.go @@ -9,7 +9,6 @@ import ( cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" unixfs "github.com/ipfs/go-unixfs" unixfs_pb "github.com/ipfs/go-unixfs/pb" @@ -47,7 +46,7 @@ const ( ) var LsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List directory contents for Unix filesystem objects.", ShortDescription: ` 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. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to list links from.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to list links from.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(lsHeadersOptionNameTime, "v", "Print table headers (Hash, Size, Name)."), - cmdkit.BoolOption(lsResolveTypeOptionName, "Resolve linked objects to find out their types.").WithDefault(true), - cmdkit.BoolOption(lsSizeOptionName, "Resolve linked objects to find out their file size.").WithDefault(true), - cmdkit.BoolOption(lsStreamOptionName, "s", "Enable exprimental streaming of directory entries as they are traversed."), + Options: []cmds.Option{ + cmds.BoolOption(lsHeadersOptionNameTime, "v", "Print table headers (Hash, Size, Name)."), + cmds.BoolOption(lsResolveTypeOptionName, "Resolve linked objects to find out their types.").WithDefault(true), + cmds.BoolOption(lsSizeOptionName, "Resolve linked objects to find out their file size.").WithDefault(true), + cmds.BoolOption(lsStreamOptionName, "s", "Enable exprimental streaming of directory entries as they are traversed."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) diff --git a/core/commands/mount_nofuse.go b/core/commands/mount_nofuse.go index 33f07c5bb0b..ea535068808 100644 --- a/core/commands/mount_nofuse.go +++ b/core/commands/mount_nofuse.go @@ -3,12 +3,11 @@ package commands import ( - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ) var MountCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Mounts ipfs to the filesystem (disabled).", ShortDescription: ` This version of ipfs is compiled without fuse support, which is required diff --git a/core/commands/mount_unix.go b/core/commands/mount_unix.go index 07a4c08237b..91b98ef3c5a 100644 --- a/core/commands/mount_unix.go +++ b/core/commands/mount_unix.go @@ -9,7 +9,6 @@ import ( cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" nodeMount "github.com/ipfs/go-ipfs/fuse/node" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" config "github.com/ipfs/go-ipfs-config" ) @@ -20,7 +19,7 @@ const ( ) var MountCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Mounts IPFS to the filesystem (read-only).", ShortDescription: ` Mount IPFS at a read-only mountpoint on the OS (default: /ipfs and /ipns). @@ -76,9 +75,9 @@ baz baz `, }, - Options: []cmdkit.Option{ - cmdkit.StringOption(mountIPFSPathOptionName, "f", "The path where IPFS should be mounted."), - cmdkit.StringOption(mountIPNSPathOptionName, "n", "The path where IPNS should be mounted."), + Options: []cmds.Option{ + cmds.StringOption(mountIPFSPathOptionName, "f", "The path where IPFS should be mounted."), + cmds.StringOption(mountIPNSPathOptionName, "n", "The path where IPNS should be mounted."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { cfg, err := cmdenv.GetConfig(env) diff --git a/core/commands/mount_windows.go b/core/commands/mount_windows.go index c86aecb1e6c..8f5d50ecfb3 100644 --- a/core/commands/mount_windows.go +++ b/core/commands/mount_windows.go @@ -3,12 +3,11 @@ package commands import ( "errors" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ) var MountCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Not yet implemented on Windows.", ShortDescription: "Not yet implemented on Windows. :(", }, diff --git a/core/commands/name/ipns.go b/core/commands/name/ipns.go index 6557ca09e8e..7f97b174f9d 100644 --- a/core/commands/name/ipns.go +++ b/core/commands/name/ipns.go @@ -10,7 +10,6 @@ import ( cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" namesys "github.com/ipfs/go-ipfs/namesys" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" logging "github.com/ipfs/go-log" path "github.com/ipfs/go-path" @@ -33,7 +32,7 @@ const ( ) var IpnsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Resolve IPNS names.", ShortDescription: ` IPNS is a PKI namespace, where names are the hashes of public keys, and @@ -70,15 +69,15 @@ Resolve the value of a dnslink: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("name", false, false, "The IPNS name to resolve. Defaults to your node's peerID."), + Arguments: []cmds.Argument{ + cmds.StringArg("name", false, false, "The IPNS name to resolve. Defaults to your node's peerID."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(recursiveOptionName, "r", "Resolve until the result is not an IPNS name.").WithDefault(true), - cmdkit.BoolOption(nocacheOptionName, "n", "Do not use cached entries."), - cmdkit.UintOption(dhtRecordCountOptionName, "dhtrc", "Number of records to request for DHT resolution."), - cmdkit.StringOption(dhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution eg \"30s\". Pass 0 for no timeout."), - cmdkit.BoolOption(streamOptionName, "s", "Stream entries as they are found."), + Options: []cmds.Option{ + cmds.BoolOption(recursiveOptionName, "r", "Resolve until the result is not an IPNS name.").WithDefault(true), + cmds.BoolOption(nocacheOptionName, "n", "Do not use cached entries."), + cmds.UintOption(dhtRecordCountOptionName, "dhtrc", "Number of records to request for DHT resolution."), + cmds.StringOption(dhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution eg \"30s\". Pass 0 for no timeout."), + cmds.BoolOption(streamOptionName, "s", "Stream entries as they are found."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) diff --git a/core/commands/name/ipnsps.go b/core/commands/name/ipnsps.go index 1f3e1c53240..c3a422327b7 100644 --- a/core/commands/name/ipnsps.go +++ b/core/commands/name/ipnsps.go @@ -5,7 +5,6 @@ import ( "io" "strings" - "github.com/ipfs/go-ipfs-cmdkit" "github.com/ipfs/go-ipfs-cmds" "github.com/ipfs/go-ipfs/core/commands/cmdenv" "github.com/libp2p/go-libp2p-peer" @@ -26,7 +25,7 @@ type stringList struct { // IpnsPubsubCmd is the subcommand that allows us to manage the IPNS pubsub system var IpnsPubsubCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "IPNS pubsub management", ShortDescription: ` 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 } var ipnspsStateCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Query the state of IPNS pubsub", }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { @@ -70,7 +69,7 @@ var ipnspsStateCmd = &cmds.Command{ } var ipnspsSubsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Show current name subscriptions", }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { @@ -80,7 +79,7 @@ var ipnspsSubsCmd = &cmds.Command{ } if n.PSRouter == nil { - return cmdkit.Errorf(cmdkit.ErrClient, "IPNS pubsub subsystem is not enabled") + return cmds.Errorf(cmds.ErrClient, "IPNS pubsub subsystem is not enabled") } var paths []string for _, key := range n.PSRouter.GetSubscriptions() { @@ -106,7 +105,7 @@ var ipnspsSubsCmd = &cmds.Command{ } var ipnspsCancelCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Cancel a name subscription", }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { @@ -116,14 +115,14 @@ var ipnspsCancelCmd = &cmds.Command{ } if n.PSRouter == nil { - return cmdkit.Errorf(cmdkit.ErrClient, "IPNS pubsub subsystem is not enabled") + return cmds.Errorf(cmds.ErrClient, "IPNS pubsub subsystem is not enabled") } name := req.Arguments[0] name = strings.TrimPrefix(name, "/ipns/") pid, err := peer.IDB58Decode(name) if err != nil { - return cmdkit.Errorf(cmdkit.ErrClient, err.Error()) + return cmds.Errorf(cmds.ErrClient, err.Error()) } ok, err := n.PSRouter.Cancel("/ipns/" + string(pid)) @@ -132,8 +131,8 @@ var ipnspsCancelCmd = &cmds.Command{ } return cmds.EmitOnce(res, &ipnsPubsubCancel{ok}) }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("name", true, false, "Name to cancel the subscription for."), + Arguments: []cmds.Argument{ + cmds.StringArg("name", true, false, "Name to cancel the subscription for."), }, Type: ipnsPubsubCancel{}, Encoders: cmds.EncoderMap{ diff --git a/core/commands/name/name.go b/core/commands/name/name.go index 32aa0efcbc9..d9e3de57fab 100644 --- a/core/commands/name/name.go +++ b/core/commands/name/name.go @@ -1,7 +1,6 @@ package name import ( - "github.com/ipfs/go-ipfs-cmdkit" "github.com/ipfs/go-ipfs-cmds" ) @@ -11,7 +10,7 @@ type IpnsEntry struct { } var NameCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Publish and resolve IPNS names.", ShortDescription: ` IPNS is a PKI namespace, where names are the hashes of public keys, and diff --git a/core/commands/name/publish.go b/core/commands/name/publish.go index b2643dcf400..6e8cf19c2bd 100644 --- a/core/commands/name/publish.go +++ b/core/commands/name/publish.go @@ -8,7 +8,6 @@ import ( cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" iface "github.com/ipfs/interface-go-ipfs-core" options "github.com/ipfs/interface-go-ipfs-core/options" @@ -30,7 +29,7 @@ const ( ) var PublishCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Publish IPNS names.", ShortDescription: ` IPNS is a PKI namespace, where names are the hashes of public keys, and @@ -69,19 +68,19 @@ Alternatively, publish an using a valid PeerID (as listed by `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg(ipfsPathOptionName, true, false, "ipfs path of the object to be published.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg(ipfsPathOptionName, true, false, "ipfs path of the object to be published.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(resolveOptionName, "Check if the given path can be resolved before publishing.").WithDefault(true), - cmdkit.StringOption(lifeTimeOptionName, "t", + Options: []cmds.Option{ + cmds.BoolOption(resolveOptionName, "Check if the given path can be resolved before publishing.").WithDefault(true), + cmds.StringOption(lifeTimeOptionName, "t", `Time duration that the record will be valid for. <> This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`).WithDefault("24h"), - cmdkit.BoolOption(allowOfflineOptionName, "When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing."), - cmdkit.StringOption(ttlOptionName, "Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental)"), - cmdkit.StringOption(keyOptionName, "k", "Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'.").WithDefault("self"), - cmdkit.BoolOption(quieterOptionName, "Q", "Write only final hash."), + cmds.BoolOption(allowOfflineOptionName, "When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing."), + cmds.StringOption(ttlOptionName, "Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental)"), + cmds.StringOption(keyOptionName, "k", "Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'.").WithDefault("self"), + cmds.BoolOption(quieterOptionName, "Q", "Write only final hash."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) diff --git a/core/commands/object/diff.go b/core/commands/object/diff.go index 166035ff4d8..25b98925d59 100644 --- a/core/commands/object/diff.go +++ b/core/commands/object/diff.go @@ -7,7 +7,6 @@ import ( cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" "github.com/ipfs/go-ipfs/dagutils" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" path "github.com/ipfs/interface-go-ipfs-core/path" ) @@ -21,7 +20,7 @@ type Changes struct { } var ObjectDiffCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Display the diff between two ipfs objects.", ShortDescription: ` 'ipfs object diff' is a command used to show the differences between @@ -47,12 +46,12 @@ Example: Changed "bar" from QmNgd5cz2jNftnAHBhcRUGdtiaMzb5Rhjqd4etondHHST8 to QmRfFVsjSXkhFxrfWnLpMae2M4GBVsry6VAuYYcji5MiZb. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("obj_a", true, false, "Object to diff against."), - cmdkit.StringArg("obj_b", true, false, "Object to diff."), + Arguments: []cmds.Argument{ + cmds.StringArg("obj_a", true, false, "Object to diff against."), + cmds.StringArg("obj_b", true, false, "Object to diff."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(verboseOptionName, "v", "Print extra information."), + Options: []cmds.Option{ + cmds.BoolOption(verboseOptionName, "v", "Print extra information."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) diff --git a/core/commands/object/object.go b/core/commands/object/object.go index 60a39db0168..c56396a2898 100644 --- a/core/commands/object/object.go +++ b/core/commands/object/object.go @@ -12,7 +12,6 @@ import ( humanize "github.com/dustin/go-humanize" "github.com/ipfs/go-cid" - "github.com/ipfs/go-ipfs-cmdkit" "github.com/ipfs/go-ipfs-cmds" ipld "github.com/ipfs/go-ipld-format" dag "github.com/ipfs/go-merkledag" @@ -48,7 +47,7 @@ const ( ) var ObjectCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Interact with IPFS objects.", ShortDescription: ` 'ipfs object' is a plumbing command used to manipulate DAG objects @@ -69,7 +68,7 @@ directly.`, // ObjectDataCmd object data command var ObjectDataCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Output the raw bytes of an IPFS object.", ShortDescription: ` 'ipfs object data' is a plumbing command for retrieving the raw bytes stored @@ -84,8 +83,8 @@ is the raw data of the object. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -106,7 +105,7 @@ is the raw data of the object. // ObjectLinksCmd object links command var ObjectLinksCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Output the links pointed to by the specified object.", ShortDescription: ` 'ipfs object links' is a plumbing command for retrieving the links from @@ -115,11 +114,11 @@ multihash. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(headersOptionName, "v", "Print table headers (Hash, Size, Name)."), + Options: []cmds.Option{ + cmds.BoolOption(headersOptionName, "v", "Print table headers (Hash, Size, Name)."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -180,7 +179,7 @@ multihash. // ObjectGetCmd object get command var ObjectGetCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Get and serialize the DAG node named by .", ShortDescription: ` 'ipfs object get' is a plumbing command for retrieving DAG nodes. @@ -207,11 +206,11 @@ Supported values are: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.StringOption(encodingOptionName, "Encoding type of the data field, either \"text\" or \"base64\".").WithDefault("text"), + Options: []cmds.Option{ + cmds.StringOption(encodingOptionName, "Encoding type of the data field, either \"text\" or \"base64\".").WithDefault("text"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -288,7 +287,7 @@ Supported values are: // ObjectStatCmd object stat command var ObjectStatCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Get stats for the DAG node named by .", ShortDescription: ` 'ipfs object stat' is a plumbing command to print DAG node statistics. @@ -302,11 +301,11 @@ var ObjectStatCmd = &cmds.Command{ `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(humanOptionName, "Print sizes in human readable format (e.g., 1K 234M 2G)"), + Options: []cmds.Option{ + cmds.BoolOption(humanOptionName, "Print sizes in human readable format (e.g., 1K 234M 2G)"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -361,7 +360,7 @@ var ObjectStatCmd = &cmds.Command{ // ObjectPutCmd object put command var ObjectPutCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Store input as a DAG object, print its key.", ShortDescription: ` 'ipfs object put' is a plumbing command for storing DAG nodes. @@ -398,14 +397,14 @@ And then run: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.FileArg("data", true, false, "Data to be stored as a DAG object.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.FileArg("data", true, false, "Data to be stored as a DAG object.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.StringOption(inputencOptionName, "Encoding type of input data. One of: {\"protobuf\", \"json\"}.").WithDefault("json"), - cmdkit.StringOption(datafieldencOptionName, "Encoding type of the data field, either \"text\" or \"base64\".").WithDefault("text"), - cmdkit.BoolOption(pinOptionName, "Pin this object when adding."), - cmdkit.BoolOption(quietOptionName, "q", "Write minimal output."), + Options: []cmds.Option{ + cmds.StringOption(inputencOptionName, "Encoding type of input data. One of: {\"protobuf\", \"json\"}.").WithDefault("json"), + cmds.StringOption(datafieldencOptionName, "Encoding type of the data field, either \"text\" or \"base64\".").WithDefault("text"), + cmds.BoolOption(pinOptionName, "Pin this object when adding."), + cmds.BoolOption(quietOptionName, "q", "Write minimal output."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -467,7 +466,7 @@ And then run: // ObjectNewCmd object new command var ObjectNewCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Create a new object from an ipfs template.", ShortDescription: ` 'ipfs object new' is a plumbing command for creating new DAG nodes. @@ -482,8 +481,8 @@ Available templates: * unixfs-dir `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("template", false, false, "Template to use. Optional."), + Arguments: []cmds.Argument{ + cmds.StringArg("template", false, false, "Template to use. Optional."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) diff --git a/core/commands/object/patch.go b/core/commands/object/patch.go index 8b55a70ea82..dfbb7f94f25 100644 --- a/core/commands/object/patch.go +++ b/core/commands/object/patch.go @@ -6,14 +6,13 @@ import ( "github.com/ipfs/go-ipfs/core/commands/cmdenv" - "github.com/ipfs/go-ipfs-cmdkit" "github.com/ipfs/go-ipfs-cmds" "github.com/ipfs/interface-go-ipfs-core/options" "github.com/ipfs/interface-go-ipfs-core/path" ) var ObjectPatchCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Create a new merkledag object based on an existing one.", ShortDescription: ` 'ipfs object patch ' is a plumbing command used to @@ -21,7 +20,7 @@ build custom DAG objects. It mutates objects, creating new objects as a result. This is the Merkle-DAG version of modifying an object. `, }, - Arguments: []cmdkit.Argument{}, + Arguments: []cmds.Argument{}, Subcommands: map[string]*cmds.Command{ "append-data": patchAppendDataCmd, "add-link": patchAddLinkCmd, @@ -31,7 +30,7 @@ result. This is the Merkle-DAG version of modifying an object. } var patchAppendDataCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Append data to the data segment of a dag node.", ShortDescription: ` 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 the limit will not be respected by the network. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("root", true, false, "The hash of the node to modify."), - cmdkit.FileArg("data", true, false, "Data to append.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("root", true, false, "The hash of the node to modify."), + cmds.FileArg("data", true, false, "Data to append.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -79,7 +78,7 @@ the limit will not be respected by the network. } var patchSetDataCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Set the data field of an IPFS object.", ShortDescription: ` Set the data of an IPFS object from stdin or with the contents of a file. @@ -89,9 +88,9 @@ Example: $ echo "my data" | ipfs object patch $MYHASH set-data `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("root", true, false, "The hash of the node to modify."), - cmdkit.FileArg("data", true, false, "The data to set the object to.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("root", true, false, "The hash of the node to modify."), + cmds.FileArg("data", true, false, "The data to set the object to.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -123,15 +122,15 @@ Example: } var patchRmLinkCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Remove a link from a given object.", ShortDescription: ` Remove a Merkle-link from the given object and return the hash of the result. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("root", true, false, "The hash of the node to modify."), - cmdkit.StringArg("name", true, false, "Name of the link to remove."), + Arguments: []cmds.Argument{ + cmds.StringArg("root", true, false, "The hash of the node to modify."), + cmds.StringArg("name", true, false, "Name of the link to remove."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -163,7 +162,7 @@ const ( ) var patchAddLinkCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Add a link to a given object.", ShortDescription: ` 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 to a file containing 'bar', and returns the hash of the new object. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("root", true, false, "The hash of the node to modify."), - cmdkit.StringArg("name", true, false, "Name of link to create."), - cmdkit.StringArg("ref", true, false, "IPFS object to add link to."), + Arguments: []cmds.Argument{ + cmds.StringArg("root", true, false, "The hash of the node to modify."), + cmds.StringArg("name", true, false, "Name of link to create."), + cmds.StringArg("ref", true, false, "IPFS object to add link to."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(createOptionName, "p", "Create intermediary nodes."), + Options: []cmds.Option{ + cmds.BoolOption(createOptionName, "p", "Create intermediary nodes."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) diff --git a/core/commands/p2p.go b/core/commands/p2p.go index 7c21606887f..78aa2cf3211 100644 --- a/core/commands/p2p.go +++ b/core/commands/p2p.go @@ -15,7 +15,6 @@ import ( p2p "github.com/ipfs/go-ipfs/p2p" ipfsaddr "github.com/ipfs/go-ipfs-addr" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" pstore "github.com/libp2p/go-libp2p-peerstore" protocol "github.com/libp2p/go-libp2p-protocol" @@ -60,7 +59,7 @@ var resolveTimeout = 10 * time.Second // P2PCmd is the 'ipfs p2p' command var P2PCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Libp2p stream mounting.", ShortDescription: ` Create and use tunnels to remote peers over libp2p @@ -79,7 +78,7 @@ are refined`, } var p2pForwardCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Forward connections to libp2p service", ShortDescription: ` Forward connections made to to . @@ -93,13 +92,13 @@ Example: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("protocol", true, false, "Protocol name."), - cmdkit.StringArg("listen-address", true, false, "Listening endpoint."), - cmdkit.StringArg("target-address", true, false, "Target endpoint."), + Arguments: []cmds.Argument{ + cmds.StringArg("protocol", true, false, "Protocol name."), + cmds.StringArg("listen-address", true, false, "Listening endpoint."), + cmds.StringArg("target-address", true, false, "Target endpoint."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(allowCustomProtocolOptionName, "Don't require /x/ prefix"), + Options: []cmds.Option{ + cmds.BoolOption(allowCustomProtocolOptionName, "Don't require /x/ prefix"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := p2pGetNode(env) @@ -168,7 +167,7 @@ func parseIpfsAddr(addr string) ([]ipfsaddr.IPFSAddr, error) { } var p2pListenCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Create libp2p service", ShortDescription: ` Create libp2p service and forward connections made to . @@ -181,13 +180,13 @@ Example: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("protocol", true, false, "Protocol name."), - cmdkit.StringArg("target-address", true, false, "Target endpoint."), + Arguments: []cmds.Argument{ + cmds.StringArg("protocol", true, false, "Protocol name."), + cmds.StringArg("target-address", true, false, "Target endpoint."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(allowCustomProtocolOptionName, "Don't require /x/ prefix"), - cmdkit.BoolOption(reportPeerIDOptionName, "r", "Send remote base58 peerid to target when a new connection is established"), + Options: []cmds.Option{ + cmds.BoolOption(allowCustomProtocolOptionName, "Don't require /x/ prefix"), + cmds.BoolOption(reportPeerIDOptionName, "r", "Send remote base58 peerid to target when a new connection is established"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := p2pGetNode(env) @@ -273,11 +272,11 @@ const ( ) var p2pLsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List active p2p listeners.", }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(p2pHeadersOptionName, "v", "Print table headers (Protocol, Listen, Target)."), + Options: []cmds.Option{ + cmds.BoolOption(p2pHeadersOptionName, "v", "Print table headers (Protocol, Listen, Target)."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := p2pGetNode(env) @@ -336,14 +335,14 @@ const ( ) var p2pCloseCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Stop listening for new connections to forward.", }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(p2pAllOptionName, "a", "Close all listeners."), - cmdkit.StringOption(p2pProtocolOptionName, "p", "Match protocol name"), - cmdkit.StringOption(p2pListenAddressOptionName, "l", "Match listen address"), - cmdkit.StringOption(p2pTargetAddressOptionName, "t", "Match target address"), + Options: []cmds.Option{ + cmds.BoolOption(p2pAllOptionName, "a", "Close all listeners."), + cmds.StringOption(p2pProtocolOptionName, "p", "Match protocol name"), + cmds.StringOption(p2pListenAddressOptionName, "l", "Match listen address"), + cmds.StringOption(p2pTargetAddressOptionName, "t", "Match target address"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := p2pGetNode(env) @@ -412,7 +411,7 @@ var p2pCloseCmd = &cmds.Command{ // p2pStreamCmd is the 'ipfs p2p stream' command var p2pStreamCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "P2P stream management.", ShortDescription: "Create and manage p2p streams", }, @@ -424,11 +423,11 @@ var p2pStreamCmd = &cmds.Command{ } var p2pStreamLsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List active p2p streams.", }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(p2pHeadersOptionName, "v", "Print table headers (ID, Protocol, Local, Remote)."), + Options: []cmds.Option{ + cmds.BoolOption(p2pHeadersOptionName, "v", "Print table headers (ID, Protocol, Local, Remote)."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := p2pGetNode(env) @@ -473,14 +472,14 @@ var p2pStreamLsCmd = &cmds.Command{ } var p2pStreamCloseCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Close active p2p stream.", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("id", false, false, "Stream identifier"), + Arguments: []cmds.Argument{ + cmds.StringArg("id", false, false, "Stream identifier"), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(p2pAllOptionName, "a", "Close all streams."), + Options: []cmds.Option{ + cmds.BoolOption(p2pAllOptionName, "a", "Close all streams."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := p2pGetNode(env) diff --git a/core/commands/pin.go b/core/commands/pin.go index c10c0bbacc9..c1548904a83 100644 --- a/core/commands/pin.go +++ b/core/commands/pin.go @@ -15,7 +15,6 @@ import ( bserv "github.com/ipfs/go-blockservice" cid "github.com/ipfs/go-cid" cidenc "github.com/ipfs/go-cidutil/cidenc" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" offline "github.com/ipfs/go-ipfs-exchange-offline" dag "github.com/ipfs/go-merkledag" @@ -26,7 +25,7 @@ import ( ) var PinCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Pin (and unpin) objects to local storage.", }, @@ -54,17 +53,17 @@ const ( ) var addPinCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Pin objects to local storage.", ShortDescription: "Stores an IPFS object(s) from a given path locally to disk.", }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("ipfs-path", true, true, "Path to object(s) to be pinned.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("ipfs-path", true, true, "Path to object(s) to be pinned.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(pinRecursiveOptionName, "r", "Recursively pin the object linked to by the specified object(s).").WithDefault(true), - cmdkit.BoolOption(pinProgressOptionName, "Show progress"), + Options: []cmds.Option{ + cmds.BoolOption(pinRecursiveOptionName, "r", "Recursively pin the object linked to by the specified object(s).").WithDefault(true), + cmds.BoolOption(pinProgressOptionName, "Show progress"), }, Type: AddPinOutput{}, 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, } var rmPinCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Remove pinned objects from local storage.", ShortDescription: ` 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.) `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("ipfs-path", true, true, "Path to object(s) to be unpinned.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("ipfs-path", true, true, "Path to object(s) to be unpinned.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(pinRecursiveOptionName, "r", "Recursively unpin the object linked to by the specified object(s).").WithDefault(true), + Options: []cmds.Option{ + cmds.BoolOption(pinRecursiveOptionName, "r", "Recursively unpin the object linked to by the specified object(s).").WithDefault(true), }, Type: PinOutput{}, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { @@ -265,7 +264,7 @@ const ( ) var listPinCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List objects pinned to local storage.", ShortDescription: ` Returns a list of objects that are pinned locally. @@ -308,12 +307,12 @@ Example: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("ipfs-path", false, true, "Path to object(s) to be listed."), + Arguments: []cmds.Argument{ + cmds.StringArg("ipfs-path", false, true, "Path to object(s) to be listed."), }, - Options: []cmdkit.Option{ - cmdkit.StringOption(pinTypeOptionName, "t", "The type of pinned keys to list. Can be \"direct\", \"indirect\", \"recursive\", or \"all\".").WithDefault("all"), - cmdkit.BoolOption(pinQuietOptionName, "q", "Write just hashes of objects."), + Options: []cmds.Option{ + cmds.StringOption(pinTypeOptionName, "t", "The type of pinned keys to list. Can be \"direct\", \"indirect\", \"recursive\", or \"all\".").WithDefault("all"), + cmds.BoolOption(pinQuietOptionName, "q", "Write just hashes of objects."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := cmdenv.GetNode(env) @@ -383,7 +382,7 @@ const ( ) var updatePinCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Update a recursive pin", ShortDescription: ` 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. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("from-path", true, false, "Path to old object."), - cmdkit.StringArg("to-path", true, false, "Path to new object to be pinned."), + Arguments: []cmds.Argument{ + cmds.StringArg("from-path", true, false, "Path to old object."), + cmds.StringArg("to-path", true, false, "Path to new object to be pinned."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(pinUnpinOptionName, "Remove the old pin.").WithDefault(true), + Options: []cmds.Option{ + cmds.BoolOption(pinUnpinOptionName, "Remove the old pin.").WithDefault(true), }, Type: PinOutput{}, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { @@ -443,12 +442,12 @@ const ( ) var verifyPinCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Verify that recursive pins are complete.", }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(pinVerboseOptionName, "Also write the hashes of non-broken pins."), - cmdkit.BoolOption(pinQuietOptionName, "q", "Write just hashes of broken pins."), + Options: []cmds.Option{ + cmds.BoolOption(pinVerboseOptionName, "Also write the hashes of non-broken pins."), + cmds.BoolOption(pinQuietOptionName, "q", "Write just hashes of broken pins."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := cmdenv.GetNode(env) diff --git a/core/commands/ping.go b/core/commands/ping.go index 2165921fd4f..15530448d52 100644 --- a/core/commands/ping.go +++ b/core/commands/ping.go @@ -11,7 +11,6 @@ import ( "github.com/ipfs/go-ipfs/core/commands/cmdenv" iaddr "github.com/ipfs/go-ipfs-addr" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" "github.com/libp2p/go-libp2p-peer" pstore "github.com/libp2p/go-libp2p-peerstore" @@ -35,7 +34,7 @@ const ( var ErrPingSelf = errors.New("error: can't ping self") var PingCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Send echo request packets to IPFS hosts.", ShortDescription: ` '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- trip latency information. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("peer ID", true, true, "ID of peer to be pinged.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("peer ID", true, true, "ID of peer to be pinged.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.IntOption(pingCountOptionName, "n", "Number of ping messages to send.").WithDefault(10), + Options: []cmds.Option{ + cmds.IntOption(pingCountOptionName, "n", "Number of ping messages to send.").WithDefault(10), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := cmdenv.GetNode(env) diff --git a/core/commands/pubsub.go b/core/commands/pubsub.go index 52d78b12304..aaf01672b26 100644 --- a/core/commands/pubsub.go +++ b/core/commands/pubsub.go @@ -10,13 +10,12 @@ import ( cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" options "github.com/ipfs/interface-go-ipfs-core/options" ) var PubsubCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "An experimental publish-subscribe system on ipfs.", ShortDescription: ` ipfs pubsub allows you to publish messages to a given topic, and also to @@ -48,7 +47,7 @@ type pubsubMessage struct { } var PubsubSubCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Subscribe to messages on a given topic.", ShortDescription: ` ipfs pubsub sub subscribes to messages on a given topic. @@ -71,11 +70,11 @@ This command outputs data in the following encodings: (Specified by the "--encoding" or "--enc" flag) `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("topic", true, false, "String name of topic to subscribe to."), + Arguments: []cmds.Argument{ + cmds.StringArg("topic", true, false, "String name of topic to subscribe to."), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(pubsubDiscoverOptionName, "try to discover other peers subscribed to the same topic"), + Options: []cmds.Option{ + cmds.BoolOption(pubsubDiscoverOptionName, "try to discover other peers subscribed to the same topic"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -137,7 +136,7 @@ This command outputs data in the following encodings: } var PubsubPubCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Publish a message to a given pubsub topic.", ShortDescription: ` ipfs pubsub pub publishes a message to a specified topic. @@ -148,9 +147,9 @@ to be used in a production environment. To use, the daemon must be run with '--enable-pubsub-experiment'. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("topic", true, false, "Topic to publish to."), - cmdkit.StringArg("data", true, true, "Payload of message to publish.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("topic", true, false, "Topic to publish to."), + cmds.StringArg("data", true, true, "Payload of message to publish.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -176,7 +175,7 @@ To use, the daemon must be run with '--enable-pubsub-experiment'. } var PubsubLsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List subscribed topics by name.", ShortDescription: ` 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 { } var PubsubPeersCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List peers we are currently pubsubbing with.", ShortDescription: ` ipfs pubsub peers with no arguments lists out the pubsub peers you are @@ -230,8 +229,8 @@ to be used in a production environment. To use, the daemon must be run with '--enable-pubsub-experiment'. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("topic", false, false, "topic to list connected peers of"), + Arguments: []cmds.Argument{ + cmds.StringArg("topic", false, false, "topic to list connected peers of"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) diff --git a/core/commands/refs.go b/core/commands/refs.go index 9a006cb8d9b..acb72537671 100644 --- a/core/commands/refs.go +++ b/core/commands/refs.go @@ -13,7 +13,6 @@ import ( cid "github.com/ipfs/go-cid" cidenc "github.com/ipfs/go-cidutil/cidenc" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ipld "github.com/ipfs/go-ipld-format" path "github.com/ipfs/go-path" @@ -45,7 +44,7 @@ const ( // RefsCmd is the `ipfs refs` command var RefsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List links (references) from an object.", ShortDescription: ` 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'. Subcommands: map[string]*cmds.Command{ "local": RefsLocalCmd, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("ipfs-path", true, true, "Path to the object(s) to list refs from.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("ipfs-path", true, true, "Path to the object(s) to list refs from.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.StringOption(refsFormatOptionName, "Emit edges with given format. Available tokens: .").WithDefault(""), - cmdkit.BoolOption(refsEdgesOptionName, "e", "Emit edge format: ` -> `."), - cmdkit.BoolOption(refsUniqueOptionName, "u", "Omit duplicate refs from output."), - cmdkit.BoolOption(refsRecursiveOptionName, "r", "Recursively list links of child nodes."), - cmdkit.IntOption(refsMaxDepthOptionName, "Only for recursive refs, limits fetch and listing to the given depth").WithDefault(-1), + Options: []cmds.Option{ + cmds.StringOption(refsFormatOptionName, "Emit edges with given format. Available tokens: .").WithDefault(""), + cmds.BoolOption(refsEdgesOptionName, "e", "Emit edge format: ` -> `."), + cmds.BoolOption(refsUniqueOptionName, "u", "Omit duplicate refs from output."), + cmds.BoolOption(refsRecursiveOptionName, "r", "Recursively list links of child nodes."), + cmds.IntOption(refsMaxDepthOptionName, "Only for recursive refs, limits fetch and listing to the given depth").WithDefault(-1), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { err := req.ParseBodyArgs() @@ -133,7 +132,7 @@ NOTE: List all references recursively by using the flag '-r'. } var RefsLocalCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List all local references.", ShortDescription: ` Displays the hashes of all local objects. diff --git a/core/commands/repo.go b/core/commands/repo.go index f7b43160386..7d6b8a499a1 100644 --- a/core/commands/repo.go +++ b/core/commands/repo.go @@ -19,7 +19,6 @@ import ( cid "github.com/ipfs/go-cid" bstore "github.com/ipfs/go-ipfs-blockstore" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" config "github.com/ipfs/go-ipfs-config" ) @@ -29,7 +28,7 @@ type RepoVersion struct { } var RepoCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Manipulate the IPFS repo.", ShortDescription: ` 'ipfs repo' is a plumbing command used to manipulate the repo. @@ -57,7 +56,7 @@ const ( ) var repoGcCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Perform a garbage collection sweep on the repo.", ShortDescription: ` '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 order to reclaim hard disk space. `, }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(repoStreamErrorsOptionName, "Stream errors."), - cmdkit.BoolOption(repoQuietOptionName, "q", "Write minimal output."), + Options: []cmds.Option{ + cmds.BoolOption(repoStreamErrorsOptionName, "Stream errors."), + cmds.BoolOption(repoQuietOptionName, "q", "Write minimal output."), }, Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error { n, err := cmdenv.GetNode(env) @@ -137,7 +136,7 @@ const ( ) var repoStatCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Get stats for the currently used repo.", ShortDescription: ` 'ipfs repo stat' provides information about the local set of @@ -150,9 +149,9 @@ RepoPath string The path to the repo being currently used. Version string The repo version. `, }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(repoSizeOnlyOptionName, "Only report RepoSize and StorageMax."), - cmdkit.BoolOption(repoHumanOptionName, "Print sizes in human readable format (e.g., 1K 234M 2G)"), + Options: []cmds.Option{ + cmds.BoolOption(repoSizeOnlyOptionName, "Only report RepoSize and StorageMax."), + cmds.BoolOption(repoHumanOptionName, "Print sizes in human readable format (e.g., 1K 234M 2G)"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := cmdenv.GetNode(env) @@ -214,7 +213,7 @@ Version string The repo version. } var repoFsckCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Remove repo lockfiles.", ShortDescription: ` '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 } var repoVerifyCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Verify all blocks in repo are not corrupted.", }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { @@ -377,15 +376,15 @@ var repoVerifyCmd = &cmds.Command{ } var repoVersionCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Show the repo version.", ShortDescription: ` 'ipfs repo version' returns the current repo version. `, }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(repoQuietOptionName, "q", "Write minimal output."), + Options: []cmds.Option{ + cmds.BoolOption(repoQuietOptionName, "q", "Write minimal output."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { return cmds.EmitOnce(res, &RepoVersion{ diff --git a/core/commands/resolve.go b/core/commands/resolve.go index 6de05e1f2ea..da11789590f 100644 --- a/core/commands/resolve.go +++ b/core/commands/resolve.go @@ -12,7 +12,6 @@ import ( ns "github.com/ipfs/go-ipfs/namesys" cidenc "github.com/ipfs/go-cidutil/cidenc" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ipfspath "github.com/ipfs/go-path" options "github.com/ipfs/interface-go-ipfs-core/options" @@ -27,7 +26,7 @@ const ( ) var ResolveCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Resolve the value of names to IPFS.", ShortDescription: ` There are a number of mutable name protocols that can link among @@ -66,13 +65,13 @@ Resolve the value of an IPFS DAG path: `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("name", true, false, "The name to resolve.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("name", true, false, "The name to resolve.").EnableStdin(), }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(resolveRecursiveOptionName, "r", "Resolve until the result is an IPFS name.").WithDefault(true), - cmdkit.IntOption(resolveDhtRecordCountOptionName, "dhtrc", "Number of records to request for DHT resolution."), - cmdkit.StringOption(resolveDhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution eg \"30s\". Pass 0 for no timeout."), + Options: []cmds.Option{ + cmds.BoolOption(resolveRecursiveOptionName, "r", "Resolve until the result is an IPFS name.").WithDefault(true), + cmds.IntOption(resolveDhtRecordCountOptionName, "dhtrc", "Number of records to request for DHT resolution."), + cmds.StringOption(resolveDhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution eg \"30s\". Pass 0 for no timeout."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) diff --git a/core/commands/root.go b/core/commands/root.go index 6a7558dc5eb..1a4cd375708 100644 --- a/core/commands/root.go +++ b/core/commands/root.go @@ -9,7 +9,6 @@ import ( ocmd "github.com/ipfs/go-ipfs/core/commands/object" unixfs "github.com/ipfs/go-ipfs/core/commands/unixfs" - "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" logging "github.com/ipfs/go-log" ) @@ -27,7 +26,7 @@ const ( ) var Root = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Global p2p merkle-dag filesystem.", Synopsis: "ipfs [--config= | -c] [--debug | -D] [--help] [-h] [--api=] [--offline] [--cid-base=] [--upgrade-cidv0-in-output] [--encoding= | --enc] [--timeout=] ...", Subcommands: ` @@ -90,14 +89,14 @@ The CLI will exit with one of the following values: 1 Failed executions. `, }, - Options: []cmdkit.Option{ - cmdkit.StringOption(ConfigOption, "c", "Path to the configuration file to use."), - cmdkit.BoolOption(DebugOption, "D", "Operate in debug mode."), - cmdkit.BoolOption(cmds.OptLongHelp, "Show the full command help text."), - cmdkit.BoolOption(cmds.OptShortHelp, "Show a short version of the command help text."), - cmdkit.BoolOption(LocalOption, "L", "Run the command locally, instead of using the daemon. DEPRECATED: use --offline."), - cmdkit.BoolOption(OfflineOption, "Run the command offline."), - cmdkit.StringOption(ApiOption, "Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001)"), + Options: []cmds.Option{ + cmds.StringOption(ConfigOption, "c", "Path to the configuration file to use."), + cmds.BoolOption(DebugOption, "D", "Operate in debug mode."), + cmds.BoolOption(cmds.OptLongHelp, "Show the full command help text."), + cmds.BoolOption(cmds.OptShortHelp, "Show a short version of the command help text."), + cmds.BoolOption(LocalOption, "L", "Run the command locally, instead of using the daemon. DEPRECATED: use --offline."), + cmds.BoolOption(OfflineOption, "Run the command offline."), + cmds.StringOption(ApiOption, "Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001)"), // global options, added to every command cmdenv.OptionCidBase, diff --git a/core/commands/shutdown.go b/core/commands/shutdown.go index 0586e3da436..9ef35cf94d6 100644 --- a/core/commands/shutdown.go +++ b/core/commands/shutdown.go @@ -3,12 +3,11 @@ package commands import ( cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" - "github.com/ipfs/go-ipfs-cmdkit" - cmds "github.com/ipfs/go-ipfs-cmds" + "github.com/ipfs/go-ipfs-cmds" ) var daemonShutdownCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Shut down the ipfs daemon", }, Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error { @@ -18,7 +17,7 @@ var daemonShutdownCmd = &cmds.Command{ } if !nd.IsDaemon { - return cmdkit.Errorf(cmdkit.ErrClient, "daemon not running") + return cmds.Errorf(cmds.ErrClient, "daemon not running") } if err := nd.Close(); err != nil { diff --git a/core/commands/stat.go b/core/commands/stat.go index 3755d83c52f..330217ebfe0 100644 --- a/core/commands/stat.go +++ b/core/commands/stat.go @@ -9,7 +9,6 @@ import ( cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" humanize "github.com/dustin/go-humanize" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" metrics "github.com/libp2p/go-libp2p-metrics" peer "github.com/libp2p/go-libp2p-peer" @@ -17,7 +16,7 @@ import ( ) var StatsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Query IPFS statistics.", ShortDescription: `'ipfs stats' is a set of commands to help look at statistics for your IPFS node. @@ -41,7 +40,7 @@ const ( ) var statBwCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Print ipfs bandwidth information.", ShortDescription: `'ipfs stats bw' prints bandwidth information for the ipfs daemon. It displays: TotalIn, TotalOut, RateIn, RateOut. @@ -77,11 +76,11 @@ Example: RateOut: 0B/s `, }, - Options: []cmdkit.Option{ - cmdkit.StringOption(statPeerOptionName, "p", "Specify a peer to print bandwidth for."), - cmdkit.StringOption(statProtoOptionName, "t", "Specify a protocol to print bandwidth for."), - cmdkit.BoolOption(statPollOptionName, "Print bandwidth at an interval."), - cmdkit.StringOption(statIntervalOptionName, "i", `Time interval to wait between updating output, if 'poll' is true. + Options: []cmds.Option{ + cmds.StringOption(statPeerOptionName, "p", "Specify a peer to print bandwidth for."), + cmds.StringOption(statProtoOptionName, "t", "Specify a protocol to print bandwidth for."), + cmds.BoolOption(statPollOptionName, "Print bandwidth at an interval."), + cmds.StringOption(statIntervalOptionName, "i", `Time interval to wait between updating output, if 'poll' is true. This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are: "ns", "us" (or "µs"), "ms", "s", "m", "h".`).WithDefault("1s"), @@ -95,7 +94,7 @@ Example: // Must be online! if !nd.IsOnline { - return cmdkit.Errorf(cmdkit.ErrClient, ErrNotOnline.Error()) + return cmds.Errorf(cmds.ErrClient, ErrNotOnline.Error()) } if nd.Reporter == nil { @@ -105,7 +104,7 @@ Example: pstr, pfound := req.Options[statPeerOptionName].(string) tstr, tfound := req.Options["proto"].(string) if pfound && tfound { - return cmdkit.Errorf(cmdkit.ErrClient, "please only specify peer OR protocol") + return cmds.Errorf(cmds.ErrClient, "please only specify peer OR protocol") } var pid peer.ID diff --git a/core/commands/swarm.go b/core/commands/swarm.go index 68edd80034c..d444e1c4bb5 100644 --- a/core/commands/swarm.go +++ b/core/commands/swarm.go @@ -16,7 +16,6 @@ import ( fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo" iaddr "github.com/ipfs/go-ipfs-addr" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" config "github.com/ipfs/go-ipfs-config" inet "github.com/libp2p/go-libp2p-net" @@ -41,7 +40,7 @@ type addrMap struct { } var SwarmCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Interact with the swarm.", ShortDescription: ` 'ipfs swarm' is a tool to manipulate the network swarm. The swarm is the @@ -66,17 +65,17 @@ const ( ) var swarmPeersCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List peers with open connections.", ShortDescription: ` 'ipfs swarm peers' lists the set of peers this node is connected to. `, }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(swarmVerboseOptionName, "v", "display all extra information"), - cmdkit.BoolOption(swarmStreamsOptionName, "Also list information about open streams for each peer"), - cmdkit.BoolOption(swarmLatencyOptionName, "Also list information about latency to each peer"), - cmdkit.BoolOption(swarmDirectionOptionName, "Also list information about the direction of connection"), + Options: []cmds.Option{ + cmds.BoolOption(swarmVerboseOptionName, "v", "display all extra information"), + cmds.BoolOption(swarmStreamsOptionName, "Also list information about open streams for each peer"), + cmds.BoolOption(swarmLatencyOptionName, "Also list information about latency to each peer"), + cmds.BoolOption(swarmDirectionOptionName, "Also list information about the direction of connection"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -218,7 +217,7 @@ func directionString(d inet.Direction) string { } var swarmAddrsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List known addresses. Useful for debugging.", ShortDescription: ` 'ipfs swarm addrs' lists all addresses this node is aware of. @@ -273,14 +272,14 @@ var swarmAddrsCmd = &cmds.Command{ } var swarmAddrsLocalCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List local addresses.", ShortDescription: ` 'ipfs swarm addrs local' lists all local listening addresses announced to the network. `, }, - Options: []cmdkit.Option{ - cmdkit.BoolOption("id", "Show peer ID in addresses."), + Options: []cmds.Option{ + cmds.BoolOption("id", "Show peer ID in addresses."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -317,7 +316,7 @@ var swarmAddrsLocalCmd = &cmds.Command{ } var swarmAddrsListenCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List interface listening addresses.", ShortDescription: ` 'ipfs swarm addrs listen' lists all interface addresses the node is listening on. @@ -349,7 +348,7 @@ var swarmAddrsListenCmd = &cmds.Command{ } var swarmConnectCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Open connection to a given address.", ShortDescription: ` 'ipfs swarm connect' opens a new direct connection to a peer address. @@ -359,8 +358,8 @@ The address format is an IPFS multiaddr: ipfs swarm connect /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("address", true, true, "Address of peer to connect to.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("address", true, true, "Address of peer to connect to.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -395,7 +394,7 @@ ipfs swarm connect /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3 } var swarmDisconnectCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Close connection to a given address.", ShortDescription: ` '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, it will reconnect. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("address", true, true, "Address of peer to disconnect from.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("address", true, true, "Address of peer to disconnect from.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) @@ -561,7 +560,7 @@ func resolveAddresses(ctx context.Context, addrs []string) ([]ma.Multiaddr, erro } var swarmFiltersCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Manipulate address filters.", ShortDescription: ` '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. } var swarmFiltersAddCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Add an address filter.", ShortDescription: ` '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, add your filters to the ipfs config file. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("address", true, true, "Multiaddr to filter.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("address", true, true, "Multiaddr to filter.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := cmdenv.GetNode(env) @@ -680,7 +679,7 @@ add your filters to the ipfs config file. } var swarmFiltersRmCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Remove an address filter.", ShortDescription: ` '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, remove your filters from the ipfs config file. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("address", true, true, "Multiaddr filter to remove.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("address", true, true, "Multiaddr filter to remove.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { n, err := cmdenv.GetNode(env) diff --git a/core/commands/sysdiag.go b/core/commands/sysdiag.go index 5f791dfdae1..3fd4fea5f5c 100644 --- a/core/commands/sysdiag.go +++ b/core/commands/sysdiag.go @@ -8,14 +8,13 @@ import ( version "github.com/ipfs/go-ipfs" cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" manet "github.com/multiformats/go-multiaddr-net" sysi "github.com/whyrusleeping/go-sysinfo" ) var sysDiagCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Print system diagnostic information.", ShortDescription: ` Prints out information about your computer to aid in easier debugging. diff --git a/core/commands/tar.go b/core/commands/tar.go index d10c97fddb4..0c12fdfff5c 100644 --- a/core/commands/tar.go +++ b/core/commands/tar.go @@ -8,14 +8,13 @@ import ( "github.com/ipfs/go-ipfs/namesys/resolve" tar "github.com/ipfs/go-ipfs/tar" - "github.com/ipfs/go-ipfs-cmdkit" "github.com/ipfs/go-ipfs-cmds" dag "github.com/ipfs/go-merkledag" "github.com/ipfs/go-path" ) var TarCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Utility functions for tar files in ipfs.", }, @@ -26,7 +25,7 @@ var TarCmd = &cmds.Command{ } var tarAddCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Import a tar file into ipfs.", ShortDescription: ` 'ipfs tar add' will parse a tar file and create a merkledag structure to @@ -34,8 +33,8 @@ represent it. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.FileArg("file", true, false, "Tar file to add.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.FileArg("file", true, false, "Tar file to add.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) @@ -76,15 +75,15 @@ represent it. } var tarCatCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Export a tar file from IPFS.", ShortDescription: ` 'ipfs tar cat' will export a tar file from a previously imported one in IPFS. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("path", true, false, "ipfs path of archive to export.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("path", true, false, "ipfs path of archive to export.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) diff --git a/core/commands/unixfs/ls.go b/core/commands/unixfs/ls.go index 2ca71ccb0e8..58c57797b70 100644 --- a/core/commands/unixfs/ls.go +++ b/core/commands/unixfs/ls.go @@ -8,7 +8,6 @@ import ( cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" merkledag "github.com/ipfs/go-merkledag" unixfs "github.com/ipfs/go-unixfs" @@ -34,7 +33,7 @@ type LsOutput struct { } var LsCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "List directory contents for Unix filesystem objects.", ShortDescription: ` Displays the contents of an IPFS or IPNS object(s) at the given path. @@ -68,8 +67,8 @@ possible, please use 'ipfs ls' instead. `, }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to list links from.").EnableStdin(), + Arguments: []cmds.Argument{ + cmds.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to list links from.").EnableStdin(), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { nd, err := cmdenv.GetNode(env) diff --git a/core/commands/unixfs/unixfs.go b/core/commands/unixfs/unixfs.go index 86c482a242f..f1dfabc91e0 100644 --- a/core/commands/unixfs/unixfs.go +++ b/core/commands/unixfs/unixfs.go @@ -1,12 +1,11 @@ package unixfs import ( - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ) var UnixFSCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Interact with IPFS objects representing Unix filesystems.", ShortDescription: ` 'ipfs file' provides a familiar interface to file systems represented diff --git a/core/commands/urlstore.go b/core/commands/urlstore.go index 4b452c14b33..abebf76dbc8 100644 --- a/core/commands/urlstore.go +++ b/core/commands/urlstore.go @@ -8,14 +8,13 @@ import ( cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" filestore "github.com/ipfs/go-ipfs/filestore" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" files "github.com/ipfs/go-ipfs-files" "github.com/ipfs/interface-go-ipfs-core/options" ) var urlStoreCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Interact with urlstore.", }, Subcommands: map[string]*cmds.Command{ @@ -24,7 +23,7 @@ var urlStoreCmd = &cmds.Command{ } var urlAdd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Add URL via urlstore.", LongDescription: ` 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 settings for 'ipfs add'. `, }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(trickleOptionName, "t", "Use trickle-dag format for dag generation."), - cmdkit.BoolOption(pinOptionName, "Pin this object when adding.").WithDefault(true), + Options: []cmds.Option{ + cmds.BoolOption(trickleOptionName, "t", "Use trickle-dag format for dag generation."), + cmds.BoolOption(pinOptionName, "Pin this object when adding.").WithDefault(true), }, - Arguments: []cmdkit.Argument{ - cmdkit.StringArg("url", true, false, "URL to add to IPFS"), + Arguments: []cmds.Argument{ + cmds.StringArg("url", true, false, "URL to add to IPFS"), }, Type: &BlockStat{}, diff --git a/core/commands/version.go b/core/commands/version.go index 291f5699fde..b1b7ca2c630 100644 --- a/core/commands/version.go +++ b/core/commands/version.go @@ -10,7 +10,6 @@ import ( version "github.com/ipfs/go-ipfs" fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo" - cmdkit "github.com/ipfs/go-ipfs-cmdkit" cmds "github.com/ipfs/go-ipfs-cmds" ) @@ -30,7 +29,7 @@ const ( ) var VersionCmd = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Show ipfs version information.", ShortDescription: "Returns the current version of ipfs and exits.", }, @@ -38,11 +37,11 @@ var VersionCmd = &cmds.Command{ "deps": depsVersionCommand, }, - Options: []cmdkit.Option{ - cmdkit.BoolOption(versionNumberOptionName, "n", "Only show the version number."), - cmdkit.BoolOption(versionCommitOptionName, "Show the commit hash."), - cmdkit.BoolOption(versionRepoOptionName, "Show repo version."), - cmdkit.BoolOption(versionAllOptionName, "Show all version information"), + Options: []cmds.Option{ + cmds.BoolOption(versionNumberOptionName, "n", "Only show the version number."), + cmds.BoolOption(versionCommitOptionName, "Show the commit hash."), + cmds.BoolOption(versionRepoOptionName, "Show repo version."), + cmds.BoolOption(versionAllOptionName, "Show all version information"), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { return cmds.EmitOnce(res, &VersionOutput{ @@ -99,7 +98,7 @@ type Dependency struct { const pkgVersionFmt = "%s@%s" var depsVersionCommand = &cmds.Command{ - Helptext: cmdkit.HelpText{ + Helptext: cmds.HelpText{ Tagline: "Shows information about dependencies used for build", ShortDescription: ` Print out all dependencies and their versions.`, diff --git a/core/coreapi/unixfs.go b/core/coreapi/unixfs.go index e8702837f94..00bc26c9a1e 100644 --- a/core/coreapi/unixfs.go +++ b/core/coreapi/unixfs.go @@ -45,7 +45,7 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options // TODO: this doesn't handle the case if the hashed file is already in blocks (deduplicated) // TODO: conditional GC is disabled due to it is somehow not possible to pass the size to the daemon //if err := corerepo.ConditionalGC(req.Context(), n, uint64(size)); err != nil { - // res.SetError(err, cmdkit.ErrNormal) + // res.SetError(err, cmds.ErrNormal) // return //} diff --git a/go.mod b/go.mod index 9164b52ce58..d66522b56a9 100644 --- a/go.mod +++ b/go.mod @@ -32,8 +32,7 @@ require ( github.com/ipfs/go-ipfs-blockstore v0.0.1 github.com/ipfs/go-ipfs-blocksutil v0.0.1 github.com/ipfs/go-ipfs-chunker v0.0.1 - github.com/ipfs/go-ipfs-cmdkit v0.0.1 - github.com/ipfs/go-ipfs-cmds v0.0.6 + github.com/ipfs/go-ipfs-cmds v0.0.7 github.com/ipfs/go-ipfs-config v0.0.3 github.com/ipfs/go-ipfs-ds-help v0.0.1 github.com/ipfs/go-ipfs-exchange-interface v0.0.1 diff --git a/go.sum b/go.sum index 487f6e5fd5c..f12c92da0d7 100644 --- a/go.sum +++ b/go.sum @@ -178,10 +178,8 @@ github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IW github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk= github.com/ipfs/go-ipfs-chunker v0.0.1 h1:cHUUxKFQ99pozdahi+uSC/3Y6HeRpi9oTeUHbE27SEw= github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw= -github.com/ipfs/go-ipfs-cmdkit v0.0.1 h1:X6YXEAjUljTzevE6DPUKXSqcgf+4FXzcn5B957F5MXo= -github.com/ipfs/go-ipfs-cmdkit v0.0.1/go.mod h1:9FtbMdUabcSqv/G4/8WCxSLxkZxn/aZEFrxxqnVcRbg= -github.com/ipfs/go-ipfs-cmds v0.0.6 h1:qyitSZoV/oLHrl9NvQHOtJNUQLA42IaPoAb5iWWOo4g= -github.com/ipfs/go-ipfs-cmds v0.0.6/go.mod h1:1QVgxSgenZvOMGVC/XUTC7tJxRBGPLxYvpgPpCi3DUk= +github.com/ipfs/go-ipfs-cmds v0.0.7 h1:0N2NXxYAZn1kHpHrZMHZYRcVGJSxQogDD89oKc0GZMg= +github.com/ipfs/go-ipfs-cmds v0.0.7/go.mod h1:E5ou2OpwkAtR8LdneNdq4w1vPcrTWvh/6WPhjxGaX/Y= github.com/ipfs/go-ipfs-config v0.0.1 h1:6ED08emzI1imdsAjixFi2pEyZxTVD5ECKtCOxLBx+Uc= github.com/ipfs/go-ipfs-config v0.0.1/go.mod h1:KDbHjNyg4e6LLQSQpkgQMBz6Jf4LXiWAcmnkcwmH0DU= github.com/ipfs/go-ipfs-config v0.0.3 h1:Ep4tRdP1iVK76BgOprD9B/qtOEdpno+1Xb57BqydgGk= diff --git a/package-list.json b/package-list.json index 62ce82f59fa..5551193d6a7 100644 --- a/package-list.json +++ b/package-list.json @@ -40,7 +40,6 @@ "Commands", ["ipfs/go-ipfs-cmds", "go-ipfs-cmds", "CLI & HTTP commands library"], - ["ipfs/go-ipfs-cmdkit", "go-ipfs-cmdkit", "helper types for the commands library"], ["ipfs/go-ipfs-api", "go-ipfs-api", "a shell for the IPFS HTTP API"], "Metrics & Logging",