_ipfs 27.1 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717
#compdef ipfs
#autoload

local -a _1st_arguments
_1st_arguments=(
  'add:Add a file or directory to ipfs.'
  'bitswap:Interact with the bitswap agent.'
  'block:Interact with raw IPFS blocks.'
  'bootstrap:Show or edit the list of bootstrap peers.'
  'cat:Show IPFS object data.'
  'cid:Convert and discover properties of CIDs'
  'commands:List all available commands.'
  'config:Get and set ipfs config values.'
  'daemon:Run a network-connected IPFS node.'
  'dag:Interact with ipld dag objects. (experimental)'
  'dht:Issue commands directly through the DHT.'
  'diag:Generate diagnostic reports.'
  'dns:Resolve DNS links.'
  'files:Interact with unixfs files.'
  'filestore:Interact with filestore objects. (experimental)'
  'get:Download IPFS objects.'
  'id:Show ipfs node id info.'
  'init:Initializes ipfs config file.'
  'key:Create and list IPNS name keypairs.'
  'log:Interact with the daemon log output.'
  'ls:List directory contents for Unix filesystem objects.'
  'mount:Mounts IPFS to the filesystem (read-only).'
  'name:Publish and resolve IPNS names.'
  'object:Interact with IPFS objects.'
  'p2p:Libp2p stream mounting.'
  'pin:Pin (and unpin) objects to local storage.'
  'ping:Send echo request packets to IPFS hosts.'
  'refs:List links (references) from an object.'
  'repo:Manipulate the IPFS repo.'
  'resolve:Resolve the value of names to IPFS.'
  'stats:Query IPFS statistics.'
  'swarm:Interact with the swarm.'
  'tar:Utility functions for tar files in ipfs.'
  'update:Download and apply go-ipfs updates'
  'version:Show ipfs version information.'
)

_ipfs_subcommand(){
  local curcontext="$curcontext" state line
  typeset -A opt_args
  _arguments -C ':command:->command' '*::options:->options'
  case $state in
    (command)
      _describe -t commands "ipfs subcommand" $1
      return
    ;;
    (options)
      case $line[1] in
        (wantlist)
          case $MAIN_SUBCOMMAND in
            (bitswap)
              _arguments '(-p --peer)'{-p,--peer}'[Specify which peer to show wantlist for. Default: self.]'
            ;;
          esac
        ;;
        (add)
          case $MAIN_SUBCOMMAND in
            (pin)
              _arguments \
                '(-r --recursive)'{-r,--recursive}'[Recursively pin the object linked to by the specified object(s). Default: true.]' \
                '--progress[Show progress.]'
            ;;
            (bootstrap)
              local -a _bootstrap_rm_arguments
              _bootstrap_rm_arguments=(
                'default:Add default peers to the bootstrap list.'
              )
              _ipfs_subcommand _bootstrap_rm_arguments
            ;;
          esac
        ;;
        (rm)
          case $MAIN_SUBCOMMAND in
            (pin)
              _arguments '(-r --recursive)'{-r,--recursive}'[Recursively unpin the object linked to by the specified object(s). Default: true.]'
            ;;
            (bootstrap)
              local -a _bootstrap_rm_arguments
              _bootstrap_rm_arguments=(
                'all:Remove all peers from the bootstrap list.'
              )
              _ipfs_subcommand _bootstrap_rm_arguments
            ;;
          esac
        ;;
        (ls)
          case $MAIN_SUBCOMMAND in
            (pin)
              _arguments \
                '(-t --type)'{-t,--type}'[The type of pinned keys to list. Can be "direct", "indirect", "recursive", or "all". Default: all.]' \
                '(-q --quiet)'{-q,--quiet}'[Write just hashes of objects.]'
            ;;
            (p2p)
              _arguments '(-v --headers)'{-v,--headers}'[Print table headers (Protocol, Listen, Target).]'
            ;;
          esac
        ;;
        (update)
          case $MAIN_SUBCOMMAND in
            (pin)
              _arguments '--unpin[Remove the old pin. Default: true.]'
            ;;
          esac
        ;;
        (verify)
          case $MAIN_SUBCOMMAND in
            (pin)
              _arguments \
                '--verbose[Also write the hashes of non-broken pins.]' \
                '(-q --quiet)'{-q,--quiet}'[Write just hashes of broken pins.]'
            ;;
          esac
        ;;
        (get|query|findpeer)
          case $MAIN_SUBCOMMAND in
            (dht)
              _arguments '(-v --verbose)'{-v,--verbose}'[Print extra information.]'
            ;;
            (object)
              _arguments '--data-encoding[Encoding type of the data field, either "text" or "base64". Default: text.]'
            ;;
          esac
        ;;
        (put)
          case $MAIN_SUBCOMMAND in
            (dht)
              _arguments '(-v --verbose)'{-v,--verbose}'[Print extra information.]'
            ;;
            (object)
              _arguments \
                '--inputenc[Encoding type of input data. One of: {"protobuf", "json"}. Default: json.]' \
                '--datafieldenc[Encoding type of the data field, either "text" or "base64". Default: text.]' \
                '--pin[Pin this object when adding.]' \
                '(-q --quiet)'{-q,--quiet}'[Write minimal output]'
            ;;
          esac
        ;;
        (findprovs)
          case $MAIN_SUBCOMMAND in
            (dht)
              _arguments \
                '(-v --verbose)'{-v,--verbose}'[Print extra information.]' \
                '(-n --num-providers)'{-n,--num-providers}'[The number of providers to find. Default: 20.]'
            ;;
          esac
        ;;
        (provide)
          case $MAIN_SUBCOMMAND in
            (dht)
              _arguments \
                '(-v --verbose)'{-v,--verbose}'[Print extra information.]' \
                '(-r --recursive)'{-r,--recursive}'[Recursively provide entire graph.]'
            ;;
          esac
        ;;
        (cmds|diff)
          case $MAIN_SUBCOMMAND in
            (diag|object)
              _arguments '(-v --verbose)'{-v,--verbose}'[Print extra information.]'
            ;;
          esac
        ;;
        (stat)
          case $MAIN_SUBCOMMAND in
            (object)
              _arguments '--human[Print sizes in human readable format (e.g., 1K 234M 2G).]'
            ;;
            (repo)
              _arguments \
                '--size-only[Only report RepoSize and StorageMax.]' \
                '--human[Print sizes in human readable format (e.g., 1K 234M 2G).]'
            ;;
          esac
        ;;
        (publish)
          case $MAIN_SUBCOMMAND in
            (name)
              _arguments \
                '--resolve[Check if the given path can be resolved before publishing. Default: true.]' \
                '(-t --lifetime)'{-t,--lifetime}'[Time duration that the record will be valid for. Default: 24h.]' \
                '--allow-offline[When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing.]' \
                '--ttl[Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental).]' \
                '(-k --key)'{-k,--key}"[Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'. Default: self.]" \
                '(-Q --quieter)'{-Q,--quieter}'[Write only final hash.]'
            ;;
          esac
        ;;
        (pubsub)
          case $MAIN_SUBCOMMAND in
            (name)
              local -a _name_pubsub_arguments
              _name_pubsub_arguments=(
                'cancel:Cancel a name subscription'
                'state:Query the state of IPNS pubsub'
                'subs:Show current name subscriptions'
              )
              _ipfs_subcommand _name_pubsub_arguments
            ;;
          esac
        ;;
        (resolve)
          case $MAIN_SUBCOMMAND in
            (name)
              _arguments \
                '(-r --recursive)'{-r,--recursive}'[Resolve until the result is not an IPNS name. Default: true.]' \
                '(-n --nocache)'{-n,--nocache}'[Do not use cached entries.]' \
                '(--dhtrc --dht-record-count)'{--dhtrc,--dht-record-count}'[Number of records to request for DHT resolution.]' \
                '(--dhtt --dht-timeout)'{--dhtt,--dht-timeout}'[Max time to collect values during DHT resolution eg "30s". Pass 0 for no timeout.]' \
                '(-s --stream)'{-s,--stream}'[Stream entries as they are found.]'
            ;;
          esac
        ;;
        (patch)
          case $MAIN_SUBCOMMAND in
            (object)
              local -a _object_patch_arguments
              _object_patch_arguments=(
                'add-link:Add a link to a given object.'
                'append-data:Append data to the data segment of a dag node.'
                'rm-link:Remove a link from a given object.'
                'set-data:Set the data field of an IPFS object.'
              )
              _ipfs_subcommand _object_patch_arguments
            ;;
          esac
        ;;
        (gc)
          case $MAIN_SUBCOMMAND in
            (repo)
              _arguments \
                '--stream-errors[Stream errors.]' \
                '(-q --quiet)'{-q,--quiet}'[Write minimal output.]'
            ;;
          esac
        ;;
        (bitswap)
          case $MAIN_SUBCOMMAND in
            (stats)
              _arguments \
                '(-v --verbose)'{-v,--verbose}'[Print extra information.]' \
                '--human[Print sizes in human readable format (e.g., 1K 234M 2G).]'
            ;;
          esac
        ;;
        (bw)
          case $MAIN_SUBCOMMAND in
            (stats)
              _arguments \
                '(-p --peer)'{-p,--peer}'[Specify a peer to print bandwidth for.]' \
                '(-t --proto)'{-t,--proto}'[Specify a protocol to print bandwidth for.]' \
                '--poll[Print bandwidth at an interval.]' \
                '(-i --interval)'{-i,--interval}'[Time interval to wait between updating output, if 'poll' is true.]'
            ;;
          esac
        ;;
        (repo)
          case $MAIN_SUBCOMMAND in
            (stats)
              _arguments \
                '--size-only[Only report RepoSize and StorageMax.]' \
                '--human[Print sizes in human readable format (e.g., 1K 234M 2G).]'
            ;;
          esac
        ;;
        (bases)
          case $MAIN_SUBCOMMAND in
            (cid)
              _arguments \
                '--prefix[also include the single leter prefixes in addition to the code.]' \
                '--numeric[also include numeric codes.]'
            ;;
          esac
        ;;
        (codecs|hashes)
          case $MAIN_SUBCOMMAND in
            (cid)
              _arguments '--numeric[also include numeric codes.]'
            ;;
          esac
        ;;
        (format)
          case $MAIN_SUBCOMMAND in
            (cid)
              _arguments \
                '-f[Printf style format string. Default: %s.]' \
                '-v[CID version to convert to.]' \
                '-b[Multibase to display CID in.]'
            ;;
          esac
        ;;
        (close)
          case $MAIN_SUBCOMMAND in
            (p2p)
              _arguments \
                '(-a --all)'{-a,--all}'[Close all listeners.]' \
                '(-p --protocol)'{-p,--protocol}'[Match protocol name.]' \
                '(-l --listen-address)'{-l,--listen-address}'[Match listen address.]' \
                '(-t --target-address)'{-t,--target-address}'[Match target address.]'
            ;;
          esac
        ;;
        (forward)
          case $MAIN_SUBCOMMAND in
            (p2p)
              _arguments "--allow-custom-protocol[Don't require /x/ prefix.]"
            ;;
          esac
        ;;
        (listen)
          case $MAIN_SUBCOMMAND in
            (p2p)
              _arguments \
                "--allow-custom-protocol[Don't require /x/ prefix.]" \
                '(-r --report-peer-id)'{-r,--report-peer-id}'[Send remote base58 peerid to target when a new connection is established.]'
            ;;
          esac
        ;;
        (stream)
          case $MAIN_SUBCOMMAND in
            (p2p)
              local -a _p2p_stream_arguments
              _p2p_stream_arguments=(
                'close:Close active p2p stream.'
                'ls:List active p2p streams.'
              )
              _ipfs_subcommand _p2p_stream_arguments
            ;;
          esac
        ;;
        (addrs)
          case $MAIN_SUBCOMMAND in
            (swarm)
              local -a _swarm_addrs_arguments
              _swarm_addrs_arguments=(
                'listen:List interface listening addresses.'
                'local:List local addresses.'
              )
              _ipfs_subcommand _swarm_addrs_arguments
            ;;
          esac
        ;;
        (filters)
          case $MAIN_SUBCOMMAND in
            (swarm)
              local -a _swarm_filters_arguments
              _swarm_filters_arguments=(
                'add:Add an address filter.'
                'rm:Remove an address filter.'
              )
              _ipfs_subcommand _swarm_filters_arguments
            ;;
          esac
        ;;
        (peers)
          case $MAIN_SUBCOMMAND in
            (swarm)
              _arguments \
                '(-v --verbose)'{-v,--verbose}'[display all extra information.]' \
                '--streams[Also list information about open streams for each peer.]' \
                '--latency[Also list information about latency to each peer.]' \
                '--direction[Also list information about the direction of connection.]'
            ;;
          esac
        ;;
      esac
    ;;
  esac
}

local expl

_arguments \
  '(-c --config)'{-c,--config}'[Path to the configuration file to use.]' \
  '(-D --debug)'{-D,--debug}'[Operate in debug mode.]' \
  '(--help)--help[Show the full command help text.]' \
  '(--h)-h[Show a short version of the command help text.]' \
  '(-L --local)'{-L,--local}'[Run the command locally, instead of using the daemon. DEPRECATED: use --offline.]' \
  '(--offline)--offline[Run the command offline.]' \
  '(--api)--api[Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001).]' \
  '(--cid-base)--cid-base[Multibase encoding used for version 1 CIDs in output.]' \
  '(--upgrade-cidv0-in-output)--upgrade-cidv0-in-output[Upgrade version 0 to version 1 CIDs in output.]' \
  '(--enc --encoding)'{--enc,--encoding}'[The encoding type the output should be encoded with (json, xml, or text). Default: text.]' \
  '(--stream-channels)--stream-channels[Stream channel output.]' \
  '(--timeout)--timeout[Set a global timeout on the command.]' \
  '*:: :->subcmds' && return 0

if (( CURRENT == 1 )); then
  _describe -t commands "ipfs subcommand" _1st_arguments
  return
fi

MAIN_SUBCOMMAND="$words[1]"
case $MAIN_SUBCOMMAND in
  (add)
    _arguments \
      '(-r --recursive)'{-r,--recursive}'[Add directory paths recursively.]' \
      '(--dereference-args)--dereference-args[Symlinks supplied in arguments are dereferenced.]' \
      '(--stdin-name)--stdin-name[Assign a name if the file source is stdin.]' \
      '(-H --hidden)'{-H,--hidden}'[Include files that are hidden. Only takes effect on recursive add.]' \
      '(-q --quiet)'{-q,--quiet}'[Write minimal output.]' \
      '(-Q --quieter)'{-Q,--quieter}'[Write only final hash.]' \
      '(--silent)--silent[Write no output.]' \
      '(-p --progress)'{-p,--progress}'[Stream progress data.]' \
      '(-t --trickle)'{-t,--trickle}'[Use trickle-dag format for dag generation.]' \
      '(-n --only-hash)'{-n,--only-hash}'[Only chunk and hash - do not write to disk.]' \
      '(-w --wrap-with-directory)'{-w,--wrap-with-directory}'[Wrap files with a directory object.]' \
      '(-s --chunker)'{-s,--chunker}'[Chunking algorithm, size-(bytes) or rabin-(min)-(avg)-(max). Default: size-262144.]' \
      '(--pin)--pin[Pin this object when adding. Default: true.]' \
      '(--raw-leaves)--raw-leaves[Use raw blocks for leaf nodes. (experimental).]' \
      '(--nocopy)--nocopy[Add the file using filestore. Implies raw-leaves. (experimental).]' \
      '(--fscache)--fscache[Check the filestore for pre-existing blocks. (experimental).]' \
      '(--cid-version)--cid-version[CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. (experimental).]' \
      '(--hash)--hash[Hash function to use. Implies CIDv1 if not sha2-256. (experimental). Default: sha2-256.]' \
      '(--inline)--inline[Inline small blocks into CIDs. (experimental).]' \
      '(--inline-limit)--inline-limit[Maximum block size to inline. (experimental). Default: 32.]'
  ;;
  (bitswap)
    local -a _bitswap_arguments
    _bitswap_arguments=(
      'ledger:Show the current ledger for a peer.'
      'reprovide:Trigger reprovider.'
      'stat:Show some diagnostic information on the bitswap agent.'
      'wantlist:Show blocks currently on the wantlist.'
    )
    _ipfs_subcommand _bitswap_arguments
  ;;
  (block)
    local -a _block_arguments
    _block_arguments=(
      'get:Get a raw IPFS block.'
      'put:Store input as an IPFS block.'
      'rm:Remove IPFS block(s).'
      'stat:Print information of a raw IPFS block.'
    )
    _ipfs_subcommand _block_arguments
  ;;
  (bootstrap)
    local -a _bootstrap_arguments
    _bootstrap_arguments=(
      'add:Add peers to the bootstrap list.'
      'list:Show peers in the bootstrap list.'
      'rm:Remove peers from the bootstrap list.'
    )
    _ipfs_subcommand _bootstrap_arguments
  ;;
  (cat)
    _arguments \
      '(-o --offset)'{-o,--offset}'[Byte offset to begin reading from.]' \
      '(-l --length)'{-l,--length}'[Maximum number of bytes to read.]'
  ;;
  (cid)
    local -a _cid_arguments
    _cid_arguments=(
      'base32:Convert CIDs to Base32 CID version 1.'
      'bases:List available multibase encodings.'
      'codecs:List available CID codecs.'
      'format:Format and convert a CID in various useful ways.'
      'hashes:List available multihashes.'
    )
    _ipfs_subcommand _cid_arguments
  ;;
  (commands)
    _arguments '(-f --flags)'{-f,--flags}'[Show command flags.]'
  ;;
  (config)
    _arguments \
      '--bool[Set a boolean value.]' \
      '--json[Parse stringified JSON.]'
    local -a _config_arguments
    _config_arguments=(
      'edit:Open the config file for editing in $EDITOR.'
      'profile:Apply profiles to config.'
      'replace:Replace the config with <file>.'
      'show:Output config file contents.'
    )
    _ipfs_subcommand _config_arguments
  ;;
  (daemon)
    _arguments \
      '--init[Initialize ipfs with default settings if not already initialized.]' \
      '--init-profile[Configuration profiles to apply for --init. See ipfs init --help for more.]' \
      '--routing[Overrides the routing option. Default: default.]' \
      '--mount[Mounts IPFS to the filesystem.]' \
      '--writable[Enable writing objects (with POST, PUT and DELETE).]' \
      '--mount-ipfs[Path to the mountpoint for IPFS (if using --mount). Defaults to config setting.]' \
      '--mount-ipns[Path to the mountpoint for IPNS (if using --mount). Defaults to config setting.]' \
      '--unrestricted-api[Allow API access to unlisted hashes.]' \
      '--disable-transport-encryption[Disable transport encryption (for debugging protocols).]' \
      '--enable-gc[Enable automatic periodic repo garbage collection.]' \
      '--manage-fdlimit[Check and raise file descriptor limits if needed. Default: true.]' \
      '--migrate[If true, assume yes at the migrate prompt. If false, assume no.]' \
      '--enable-pubsub-experiment[Instantiate the ipfs daemon with the experimental pubsub feature enabled.]' \
      '--enable-namesys-pubsub[Enable IPNS record distribution through pubsub; enables pubsub.]' \
      '--enable-mplex-experiment[Add the experimental 'go-multiplex' stream muxer to libp2p on construction. Default: true.]'
  ;;
  (dag)
    local -a _dag_arguments
    _dag_arguments=(
      'get:Get a dag node from ipfs.'
      'put:Add a dag node to ipfs.'
      'resolve:Resolve ipld block.'
    )
    _ipfs_subcommand _dag_arguments
  ;;
  (dht)
    local -a _dht_arguments
    _dht_arguments=(
      'findpeer:Find the multiaddresses associated with a Peer ID.'
      'findprovs:Find peers that can provide a specific value, given a key.'
      'get:Given a key, query the routing system for its best value.'
      'provide:Announce to the network that you are providing given values.'
      'put:Write a key/value pair to the routing system.'
      'query:Find the closest Peer IDs to a given Peer ID by querying the DHT.'
    )
    _ipfs_subcommand _dht_arguments
  ;;
  (diag)
    local -a _diag_arguments
    _diag_arguments=(
      'cmds:List commands run on this IPFS node.'
      'sys:Print system diagnostic information.'
    )
    _ipfs_subcommand _diag_arguments
  ;;
  (dns)
    _arguments '(-r --recursive)'{-r,--recursive}'[Resolve until the result is not a DNS link. Default: true.]'
  ;;
  (files)
    _arguments '(-f --flush)'{-f,--flush}'[Flush target and ancestors after write. Default: true.]'
    local -a _files_arguments
    _files_arguments=(
      'chcid:Change the cid version or hash function of the root node of a given path.'
      'cp:Copy files into mfs.'
      "flush:Flush a given path's data to disk."
      'ls:List directories in the local mutable namespace.'
      'mkdir:Make directories.'
      'mv:Move files.'
      'read:Read a file in a given mfs.'
      'rm:Remove a file.'
      'stat:Display file status.'
      'write:Write to a mutable file in a given filesystem.'
    )
    _ipfs_subcommand _files_arguments
  ;;
  (filestore)
    local -a _filestore_arguments
    _filestore_arguments=(
      'dups:List blocks that are both in the filestore and standard block storage.'
      'ls:List objects in filestore.'
      'verify:Verify objects in filestore.'
    )
    _ipfs_subcommand _filestore_arguments
  ;;
  (get)
    _arguments \
      '(-o --output)'{-o,--output}'[The path where the output should be stored.]'\
      '(-a --archive)'{-a,--archive}'[Output a TAR archive.]' \
      '(-C --compress)'{-C,--compress}'[Compress the output with GZIP compression.]' \
      '(-l --compression-level)'{-l,--compression-level}'[The level of compression (1-9).]'
  ;;
  (id)
    _arguments '(-f --format)'{-f,--format}'[Optional output format.]'
  ;;
  (init)
    _arguments \
      '(-b --bits)'{-b,--bits}'[Number of bits to use in the generated RSA private key. Default: 2048.]' \
      '(-e --empty-repo)'{-e,--empty-repo}"[Don't add and pin help files to the local storage.]" \
      '(-p --profile)'{-p,--profile}"[Apply profile settings to config. Multiple profiles can be separated by ','.]"
  ;;
  (key)
    local -a _key_arguments
    _key_arguments=(
      'gen:Create a new keypair'
      'list:List all local keypairs'
      'rename:Rename a keypair'
      'rm:Remove a keypair'
    )
    _ipfs_subcommand _key_arguments
  ;;
  (log)
    local -a _log_arguments
    _log_arguments=(
      'level:Change the logging level.'
      'ls:List the logging subsystems.'
      'tail:Read the event log.'
    )
    _ipfs_subcommand _log_arguments
  ;;
  (ls)
    _arguments \
      '(-v --headers)'{-v,--headers}'[Print table headers (Hash, Size, Name).]' \
      '--resolve-type[Resolve linked objects to find out their types. Default: true.]' \
      '--size[Resolve linked objects to find out their file size. Default: true.]' \
      '(-s --stream)'{-s,--stream}'[Enable exprimental streaming of directory entries as they are traversed.]' \
  ;;
  (mount)
    _arguments \
      '(-f --ipfs-path)'{-f,--ipfs-path}'[The path where IPFS should be mounted.]' \
      '(-n --ipns-path)'{-n,--ipns-path}'[The path where IPNS should be mounted.]'
  ;;
  (name)
    local -a _name_arguments
    _name_arguments=(
      'publish:Publish IPNS names.'
      'pubsub:IPNS pubsub management.'
      'resolve:Resolve IPNS names.'
    )
    _ipfs_subcommand _name_arguments
  ;;
  (object)
    local -a _object_arguments
    _object_arguments=(
      'data:Output the raw bytes of an IPFS object.'
      'diff:Display the diff between two ipfs objects.'
      'get:Get and serialize the DAG node named by <key>.'
      'links:Output the links pointed to by the specified object.'
      'new:Create a new object from an ipfs template.'
      'patch:Create a new merkledag object based on an existing one.'
      'put:Store input as a DAG object, print its key.'
      'stat:Get stats for the DAG node named by <key>.'
    )
    _ipfs_subcommand _object_arguments
  ;;
  (p2p)
    local -a _p2p_arguments
    _p2p_arguments=(
      'close:Stop listening for new connections to forward.'
      'forward:Forward connections to libp2p service'
      'listen:Create libp2p service'
      'ls:List active p2p listeners.'
      'stream:P2P stream management.'
    )
    _ipfs_subcommand _p2p_arguments
  ;;
  (pin)
    local -a _pin_arguments
    _pin_arguments=(
      'add:Pin objects to local storage.'
      'ls:List objects pinned to local storage.'
      'rm:Remove pinned objects from local storage.'
      'update:Update a recursive pin'
      'verify:Verify that recursive pins are complete.'
    )
    _ipfs_subcommand _pin_arguments
  ;;
  (ping)
    _arguments '(-n --count)'{-n,--count}'[Number of ping messages to send. Default: 10.]'
  ;;
  (refs)
    _arguments \
      '--format[Emit edges with given format. Available tokens: <src> <dst> <linkname>. Default: <dst>.]' \
      '(-e --edges)'{-e,--edges}'[Emit edge format: `<from> -> <to>`.]' \
      '(-u --unique)'{-u,--unique}'[Omit duplicate refs from output.]' \
      '(-r --recursive)'{-r,--recursive}'[Recursively list links of child nodes.]' \
      '--max-depth[Only for recursive refs, limits fetch and listing to the given depth. Default: -1.]'
    local -a _refs_arguments
    _refs_arguments='local:List all local references.'
    _ipfs_subcommand _refs_arguments
  ;;
  (repo)
    local -a _repo_arguments
    _repo_arguments=(
      'fsck:Remove repo lockfiles.'
      'gc:Perform a garbage collection sweep on the repo.'
      'stat:Get stats for the currently used repo.'
      'verify:Verify all blocks in repo are not corrupted.'
      'version:Show the repo version.'
    )
    _ipfs_subcommand _repo_arguments
  ;;
  (resolve)
    _arguments \
      '(-r --recursive)'{-r,--recursive}'[Resolve until the result is an IPFS name. Default: true.]' \
      '(--dhtrc --dht-record-count)'{--dhtrc,--dht-record-count}'[Number of records to request for DHT resolution.]' \
      '(--dhtt --dht-timeout)'{--dhtt,--dht-timeout}'[Max time to collect values during DHT resolution eg "30s". Pass 0 for no timeout.]'
  ;;
  (stats)
    local -a _stats_arguments
    _stats_arguments=(
      'bitswap:Show some diagnostic information on the bitswap agent.'
      'bw:Print ipfs bandwidth information.'
      'repo:Get stats for the currently used repo.'
    )
    _ipfs_subcommand _stats_arguments
  ;;
  (swarm)
    local -a _swarm_arguments
    _swarm_arguments=(
      'addrs:List known addresses. Useful for debugging.'
      'connect:Open connection to a given address.'
      'disconnect:Close connection to a given address.'
      'filters:Manipulate address filters.'
      'peers:List peers with open connections.'
    )
    _ipfs_subcommand _swarm_arguments
  ;;
  (tar)
    local -a _tar_arguments
    _tar_arguments=(
      'add:Import a tar file into ipfs.'
      'cat:Export a tar file from IPFS.'
    )
    _ipfs_subcommand _tar_arguments
  ;;
  (version)
    _arguments \
      '(-n --number)'{-n,--number}'[Only show the version number.]' \
      '--commit[Show the commit hash.]' \
      '--repo[Show repo version.]' \
      '--all[Show all version information.]'
  ;;
esac