]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/ipfs/_ipfs
...
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / ipfs / _ipfs
1 #compdef ipfs
2 #autoload
3
4 local -a _1st_arguments
5 _1st_arguments=(
6   'add:Add a file or directory to ipfs.'
7   'bitswap:Interact with the bitswap agent.'
8   'block:Interact with raw IPFS blocks.'
9   'bootstrap:Show or edit the list of bootstrap peers.'
10   'cat:Show IPFS object data.'
11   'cid:Convert and discover properties of CIDs'
12   'commands:List all available commands.'
13   'config:Get and set ipfs config values.'
14   'daemon:Run a network-connected IPFS node.'
15   'dag:Interact with ipld dag objects. (experimental)'
16   'dht:Issue commands directly through the DHT.'
17   'diag:Generate diagnostic reports.'
18   'dns:Resolve DNS links.'
19   'files:Interact with unixfs files.'
20   'filestore:Interact with filestore objects. (experimental)'
21   'get:Download IPFS objects.'
22   'id:Show ipfs node id info.'
23   'init:Initializes ipfs config file.'
24   'key:Create and list IPNS name keypairs.'
25   'log:Interact with the daemon log output.'
26   'ls:List directory contents for Unix filesystem objects.'
27   'mount:Mounts IPFS to the filesystem (read-only).'
28   'name:Publish and resolve IPNS names.'
29   'object:Interact with IPFS objects.'
30   'p2p:Libp2p stream mounting.'
31   'pin:Pin (and unpin) objects to local storage.'
32   'ping:Send echo request packets to IPFS hosts.'
33   'refs:List links (references) from an object.'
34   'repo:Manipulate the IPFS repo.'
35   'resolve:Resolve the value of names to IPFS.'
36   'stats:Query IPFS statistics.'
37   'swarm:Interact with the swarm.'
38   'tar:Utility functions for tar files in ipfs.'
39   'update:Download and apply go-ipfs updates'
40   'version:Show ipfs version information.'
41 )
42
43 _ipfs_subcommand(){
44   local curcontext="$curcontext" state line
45   typeset -A opt_args
46   _arguments -C ':command:->command' '*::options:->options'
47   case $state in
48     (command)
49       _describe -t commands "ipfs subcommand" $1
50       return
51     ;;
52     (options)
53       case $line[1] in
54         (wantlist)
55           case $MAIN_SUBCOMMAND in
56             (bitswap)
57               _arguments '(-p --peer)'{-p,--peer}'[Specify which peer to show wantlist for. Default: self.]'
58             ;;
59           esac
60         ;;
61         (add)
62           case $MAIN_SUBCOMMAND in
63             (pin)
64               _arguments \
65                 '(-r --recursive)'{-r,--recursive}'[Recursively pin the object linked to by the specified object(s). Default: true.]' \
66                 '--progress[Show progress.]'
67             ;;
68             (bootstrap)
69               local -a _bootstrap_rm_arguments
70               _bootstrap_rm_arguments=(
71                 'default:Add default peers to the bootstrap list.'
72               )
73               _ipfs_subcommand _bootstrap_rm_arguments
74             ;;
75           esac
76         ;;
77         (rm)
78           case $MAIN_SUBCOMMAND in
79             (pin)
80               _arguments '(-r --recursive)'{-r,--recursive}'[Recursively unpin the object linked to by the specified object(s). Default: true.]'
81             ;;
82             (bootstrap)
83               local -a _bootstrap_rm_arguments
84               _bootstrap_rm_arguments=(
85                 'all:Remove all peers from the bootstrap list.'
86               )
87               _ipfs_subcommand _bootstrap_rm_arguments
88             ;;
89           esac
90         ;;
91         (ls)
92           case $MAIN_SUBCOMMAND in
93             (pin)
94               _arguments \
95                 '(-t --type)'{-t,--type}'[The type of pinned keys to list. Can be "direct", "indirect", "recursive", or "all". Default: all.]' \
96                 '(-q --quiet)'{-q,--quiet}'[Write just hashes of objects.]' \
97                 '(-s --stream)'{-s,--stream}'[Enable streaming of pins as they are discovered.]'
98             ;;
99             (p2p)
100               _arguments '(-v --headers)'{-v,--headers}'[Print table headers (Protocol, Listen, Target).]'
101             ;;
102           esac
103         ;;
104         (update)
105           case $MAIN_SUBCOMMAND in
106             (pin)
107               _arguments '--unpin[Remove the old pin. Default: true.]'
108             ;;
109           esac
110         ;;
111         (verify)
112           case $MAIN_SUBCOMMAND in
113             (pin)
114               _arguments \
115                 '--verbose[Also write the hashes of non-broken pins.]' \
116                 '(-q --quiet)'{-q,--quiet}'[Write just hashes of broken pins.]'
117             ;;
118           esac
119         ;;
120         (query|findpeer)
121           case $MAIN_SUBCOMMAND in
122             (dht)
123               _arguments '(-v --verbose)'{-v,--verbose}'[Print extra information.]'
124             ;;
125           esac
126         ;;
127         (get)
128           case $MAIN_SUBCOMMAND in
129             (dht)
130               _arguments '(-v --verbose)'{-v,--verbose}'[Print extra information.]'
131             ;;
132             (object)
133               _arguments '--data-encoding[Encoding type of the data field, either "text" or "base64". Default: text.]'
134             ;;
135           esac
136         ;;
137         (put)
138           case $MAIN_SUBCOMMAND in
139             (dht)
140               _arguments '(-v --verbose)'{-v,--verbose}'[Print extra information.]'
141             ;;
142             (object)
143               _arguments \
144                 '--inputenc[Encoding type of input data. One of: {"protobuf", "json"}. Default: json.]' \
145                 '--datafieldenc[Encoding type of the data field, either "text" or "base64". Default: text.]' \
146                 '--pin[Pin this object when adding.]' \
147                 '(-q --quiet)'{-q,--quiet}'[Write minimal output]'
148             ;;
149           esac
150         ;;
151         (findprovs)
152           case $MAIN_SUBCOMMAND in
153             (dht)
154               _arguments \
155                 '(-v --verbose)'{-v,--verbose}'[Print extra information.]' \
156                 '(-n --num-providers)'{-n,--num-providers}'[The number of providers to find. Default: 20.]'
157             ;;
158           esac
159         ;;
160         (provide)
161           case $MAIN_SUBCOMMAND in
162             (dht)
163               _arguments \
164                 '(-v --verbose)'{-v,--verbose}'[Print extra information.]' \
165                 '(-r --recursive)'{-r,--recursive}'[Recursively provide entire graph.]'
166             ;;
167           esac
168         ;;
169         (cmds)
170           case $MAIN_SUBCOMMAND in
171             (diag)
172               _arguments '(-v --verbose)'{-v,--verbose}'[Print extra information.]'
173             ;;
174           esac
175         ;;
176         (diff)
177           case $MAIN_SUBCOMMAND in
178             (object)
179               _arguments '(-v --verbose)'{-v,--verbose}'[Print extra information.]'
180             ;;
181           esac
182         ;;
183         (stat)
184           case $MAIN_SUBCOMMAND in
185             (dag)
186               _arguments \
187                 '(-p --progress)'{-p,--progress}'[Return progressive data while reading through the DAG. Default: true.]'
188             ;;
189             (object)
190               _arguments '--human[Print sizes in human readable format (e.g., 1K 234M 2G).]'
191             ;;
192             (repo)
193               _arguments \
194                 '(-s --size-only)'{-s,--size-only}'[Only report RepoSize and StorageMax.]' \
195                 '(-H --human)'{-H,--human}'[Print sizes in human readable format (e.g., 1K 234M 2G).]'
196             ;;
197           esac
198         ;;
199         (publish)
200           case $MAIN_SUBCOMMAND in
201             (name)
202               _arguments \
203                 '--resolve[Check if the given path can be resolved before publishing. Default: true.]' \
204                 '(-t --lifetime)'{-t,--lifetime}'[Time duration that the record will be valid for. Default: 24h.]' \
205                 '--allow-offline[When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing.]' \
206                 '--ttl[Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental).]' \
207                 '(-k --key)'{-k,--key}"[Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'. Default: self.]" \
208                 '(-Q --quieter)'{-Q,--quieter}'[Write only final hash.]' \
209                 '--ipns-base[Encoding used for keys: Can either be a multibase encoded CID or a base58btc encoded multihash. Takes {b58mh|base36|k|base32|b...}. Default: base36.]'
210             ;;
211           esac
212         ;;
213         (pubsub)
214           case $MAIN_SUBCOMMAND in
215             (name)
216               local -a _name_pubsub_arguments
217               _name_pubsub_arguments=(
218                 'cancel:Cancel a name subscription'
219                 'state:Query the state of IPNS pubsub'
220                 'subs:Show current name subscriptions'
221               )
222               _ipfs_subcommand _name_pubsub_arguments
223             ;;
224           esac
225         ;;
226         (resolve)
227           case $MAIN_SUBCOMMAND in
228             (name)
229               _arguments \
230                 '(-r --recursive)'{-r,--recursive}'[Resolve until the result is not an IPNS name. Default: true.]' \
231                 '(-n --nocache)'{-n,--nocache}'[Do not use cached entries.]' \
232                 '(--dhtrc --dht-record-count)'{--dhtrc,--dht-record-count}'[Number of records to request for DHT resolution.]' \
233                 '(--dhtt --dht-timeout)'{--dhtt,--dht-timeout}'[Max time to collect values during DHT resolution eg "30s". Pass 0 for no timeout.]' \
234                 '(-s --stream)'{-s,--stream}'[Stream entries as they are found.]'
235             ;;
236           esac
237         ;;
238         (patch)
239           case $MAIN_SUBCOMMAND in
240             (object)
241               local -a _object_patch_arguments
242               _object_patch_arguments=(
243                 'add-link:Add a link to a given object.'
244                 'append-data:Append data to the data segment of a dag node.'
245                 'rm-link:Remove a link from a given object.'
246                 'set-data:Set the data field of an IPFS object.'
247               )
248               _ipfs_subcommand _object_patch_arguments
249             ;;
250           esac
251         ;;
252         (gc)
253           case $MAIN_SUBCOMMAND in
254             (repo)
255               _arguments \
256                 '--stream-errors[Stream errors.]' \
257                 '(-q --quiet)'{-q,--quiet}'[Write minimal output.]'
258             ;;
259           esac
260         ;;
261         (bitswap)
262           case $MAIN_SUBCOMMAND in
263             (stats)
264               _arguments \
265                 '(-v --verbose)'{-v,--verbose}'[Print extra information.]' \
266                 '--human[Print sizes in human readable format (e.g., 1K 234M 2G).]'
267             ;;
268           esac
269         ;;
270         (bw)
271           case $MAIN_SUBCOMMAND in
272             (stats)
273               _arguments \
274                 '(-p --peer)'{-p,--peer}'[Specify a peer to print bandwidth for.]' \
275                 '(-t --proto)'{-t,--proto}'[Specify a protocol to print bandwidth for.]' \
276                 '--poll[Print bandwidth at an interval.]' \
277                 '(-i --interval)'{-i,--interval}"[Time interval to wait between updating output, if 'poll' is true.]"
278             ;;
279           esac
280         ;;
281         (repo)
282           case $MAIN_SUBCOMMAND in
283             (stats)
284               _arguments \
285                 '--size-only[Only report RepoSize and StorageMax.]' \
286                 '--human[Print sizes in human readable format (e.g., 1K 234M 2G).]'
287             ;;
288           esac
289         ;;
290         (bases)
291           case $MAIN_SUBCOMMAND in
292             (cid)
293               _arguments \
294                 '--prefix[also include the single leter prefixes in addition to the code.]' \
295                 '--numeric[also include numeric codes.]'
296             ;;
297           esac
298         ;;
299         (codecs|hashes)
300           case $MAIN_SUBCOMMAND in
301             (cid)
302               _arguments '--numeric[also include numeric codes.]'
303             ;;
304           esac
305         ;;
306         (format)
307           case $MAIN_SUBCOMMAND in
308             (cid)
309               _arguments \
310                 '-f[Printf style format string. Default: %s.]' \
311                 '-v[CID version to convert to.]' \
312                 '--codec[CID codec to convert to.]' \
313                 '-b[Multibase to display CID in.]'
314             ;;
315           esac
316         ;;
317         (close)
318           case $MAIN_SUBCOMMAND in
319             (p2p)
320               _arguments \
321                 '(-a --all)'{-a,--all}'[Close all listeners.]' \
322                 '(-p --protocol)'{-p,--protocol}'[Match protocol name.]' \
323                 '(-l --listen-address)'{-l,--listen-address}'[Match listen address.]' \
324                 '(-t --target-address)'{-t,--target-address}'[Match target address.]'
325             ;;
326           esac
327         ;;
328         (forward)
329           case $MAIN_SUBCOMMAND in
330             (p2p)
331               _arguments "--allow-custom-protocol[Don't require /x/ prefix.]"
332             ;;
333           esac
334         ;;
335         (listen)
336           case $MAIN_SUBCOMMAND in
337             (p2p)
338               _arguments \
339                 "--allow-custom-protocol[Don't require /x/ prefix.]" \
340                 '(-r --report-peer-id)'{-r,--report-peer-id}'[Send remote base58 peerid to target when a new connection is established.]'
341             ;;
342           esac
343         ;;
344         (stream)
345           case $MAIN_SUBCOMMAND in
346             (p2p)
347               local -a _p2p_stream_arguments
348               _p2p_stream_arguments=(
349                 'close:Close active p2p stream.'
350                 'ls:List active p2p streams.'
351               )
352               _ipfs_subcommand _p2p_stream_arguments
353             ;;
354           esac
355         ;;
356         (addrs)
357           case $MAIN_SUBCOMMAND in
358             (swarm)
359               local -a _swarm_addrs_arguments
360               _swarm_addrs_arguments=(
361                 'listen:List interface listening addresses.'
362                 'local:List local addresses.'
363               )
364               _ipfs_subcommand _swarm_addrs_arguments
365             ;;
366           esac
367         ;;
368         (filters)
369           case $MAIN_SUBCOMMAND in
370             (swarm)
371               local -a _swarm_filters_arguments
372               _swarm_filters_arguments=(
373                 'add:Add an address filter.'
374                 'rm:Remove an address filter.'
375               )
376               _ipfs_subcommand _swarm_filters_arguments
377             ;;
378           esac
379         ;;
380         (peers)
381           case $MAIN_SUBCOMMAND in
382             (swarm)
383               _arguments \
384                 '(-v --verbose)'{-v,--verbose}'[display all extra information.]' \
385                 '--streams[Also list information about open streams for each peer.]' \
386                 '--latency[Also list information about latency to each peer.]' \
387                 '--direction[Also list information about the direction of connection.]'
388             ;;
389           esac
390         ;;
391         (export)
392           case $MAIN_SUBCOMMAND in
393             (dag)
394               _arguments \
395                 '(-p --progress)'{-p,--progress}'[Display progress on CLI. Defaults to true when STDERR is a TTY.]'
396             ;;
397             (key)
398               _arguments \
399                 '(-o --output)'{-o,--output}'[The path where the output should be stored.]'
400             ;;
401           esac
402         ;;
403         (import)
404           case $MAIN_SUBCOMMAND in
405             (dag)
406               _arguments \
407                 '--silent[No output.]' \
408                 '--pin-roots[Pin optional roots listed in the .car headers after importing. Default: true.]'
409             ;;
410             (key)
411               _arguments \
412                 '--ipns-base[Encoding used for keys: Can either be a multibase encoded CID or a base58btc encoded multihash. Takes {b58mh|base36|k|base32|b...}. Default: base36.]'
413             ;;
414           esac
415         ;;
416         (remote)
417           case $MAIN_SUBCOMMAND in
418             (pin)
419               local -a _pin_remote_arguments
420               _pin_remote_arguments=(
421                 'add:Pin object to remote pinning service.'
422                 'ls:List objects pinned to remote pinning service.'
423                 'rm:Remove pins from remote pinning service.'
424                 'service:Configure remote pinning services.'
425               )
426               _ipfs_subcommand _pin_remote_arguments
427             ;;
428           esac
429         ;;
430       esac
431     ;;
432   esac
433 }
434
435 local expl
436
437 _arguments \
438   '(-c --config)'{-c,--config}'[Path to the configuration file to use.]' \
439   '(-D --debug)'{-D,--debug}'[Operate in debug mode.]' \
440   '(--help)--help[Show the full command help text.]' \
441   '(--h)-h[Show a short version of the command help text.]' \
442   '(-L --local)'{-L,--local}'[Run the command locally, instead of using the daemon. DEPRECATED: use --offline.]' \
443   '(--offline)--offline[Run the command offline.]' \
444   '(--api)--api[Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001).]' \
445   '(--cid-base)--cid-base[Multibase encoding used for version 1 CIDs in output.]' \
446   '(--upgrade-cidv0-in-output)--upgrade-cidv0-in-output[Upgrade version 0 to version 1 CIDs in output.]' \
447   '(--enc --encoding)'{--enc,--encoding}'[The encoding type the output should be encoded with (json, xml, or text). Default: text.]' \
448   '(--stream-channels)--stream-channels[Stream channel output.]' \
449   '(--timeout)--timeout[Set a global timeout on the command.]' \
450   '*:: :->subcmds' && return 0
451
452 if (( CURRENT == 1 )); then
453   _describe -t commands "ipfs subcommand" _1st_arguments
454   return
455 fi
456
457 MAIN_SUBCOMMAND="$words[1]"
458 case $MAIN_SUBCOMMAND in
459   (add)
460     _arguments \
461       '(-r --recursive)'{-r,--recursive}'[Add directory paths recursively.]' \
462       '(--dereference-args)--dereference-args[Symlinks supplied in arguments are dereferenced.]' \
463       '(--stdin-name)--stdin-name[Assign a name if the file source is stdin.]' \
464       '(-H --hidden)'{-H,--hidden}'[Include files that are hidden. Only takes effect on recursive add.]' \
465       '(--ignore)--ignore[A rule (.gitignore-stype) defining which file(s) should be ignored (variadic, experimental).]' \
466       '(--ignore-rules-path)--ignore-rules-path[A path to a file with .gitignore-style ignore rules (experimental).]' \
467       '(-q --quiet)'{-q,--quiet}'[Write minimal output.]' \
468       '(-Q --quieter)'{-Q,--quieter}'[Write only final hash.]' \
469       '(--silent)--silent[Write no output.]' \
470       '(-p --progress)'{-p,--progress}'[Stream progress data.]' \
471       '(-t --trickle)'{-t,--trickle}'[Use trickle-dag format for dag generation.]' \
472       '(-n --only-hash)'{-n,--only-hash}'[Only chunk and hash - do not write to disk.]' \
473       '(-w --wrap-with-directory)'{-w,--wrap-with-directory}'[Wrap files with a directory object.]' \
474       '(-s --chunker)'{-s,--chunker}'[Chunking algorithm, size-(bytes) or rabin-(min)-(avg)-(max). Default: size-262144.]' \
475       '(--pin)--pin[Pin this object when adding. Default: true.]' \
476       '(--raw-leaves)--raw-leaves[Use raw blocks for leaf nodes. (experimental).]' \
477       '(--nocopy)--nocopy[Add the file using filestore. Implies raw-leaves. (experimental).]' \
478       '(--fscache)--fscache[Check the filestore for pre-existing blocks. (experimental).]' \
479       '(--cid-version)--cid-version[CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. (experimental).]' \
480       '(--hash)--hash[Hash function to use. Implies CIDv1 if not sha2-256. (experimental). Default: sha2-256.]' \
481       '(--inline)--inline[Inline small blocks into CIDs. (experimental).]' \
482       '(--inline-limit)--inline-limit[Maximum block size to inline. (experimental). Default: 32.]'
483   ;;
484   (bitswap)
485     local -a _bitswap_arguments
486     _bitswap_arguments=(
487       'ledger:Show the current ledger for a peer.'
488       'reprovide:Trigger reprovider.'
489       'stat:Show some diagnostic information on the bitswap agent.'
490       'wantlist:Show blocks currently on the wantlist.'
491     )
492     _ipfs_subcommand _bitswap_arguments
493   ;;
494   (block)
495     local -a _block_arguments
496     _block_arguments=(
497       'get:Get a raw IPFS block.'
498       'put:Store input as an IPFS block.'
499       'rm:Remove IPFS block(s).'
500       'stat:Print information of a raw IPFS block.'
501     )
502     _ipfs_subcommand _block_arguments
503   ;;
504   (bootstrap)
505     local -a _bootstrap_arguments
506     _bootstrap_arguments=(
507       'add:Add peers to the bootstrap list.'
508       'list:Show peers in the bootstrap list.'
509       'rm:Remove peers from the bootstrap list.'
510     )
511     _ipfs_subcommand _bootstrap_arguments
512   ;;
513   (cat)
514     _arguments \
515       '(-o --offset)'{-o,--offset}'[Byte offset to begin reading from.]' \
516       '(-l --length)'{-l,--length}'[Maximum number of bytes to read.]'
517   ;;
518   (cid)
519     local -a _cid_arguments
520     _cid_arguments=(
521       'base32:Convert CIDs to Base32 CID version 1.'
522       'bases:List available multibase encodings.'
523       'codecs:List available CID codecs.'
524       'format:Format and convert a CID in various useful ways.'
525       'hashes:List available multihashes.'
526     )
527     _ipfs_subcommand _cid_arguments
528   ;;
529   (commands)
530     _arguments '(-f --flags)'{-f,--flags}'[Show command flags.]'
531   ;;
532   (config)
533     _arguments \
534       '--bool[Set a boolean value.]' \
535       '--json[Parse stringified JSON.]'
536     local -a _config_arguments
537     _config_arguments=(
538       'edit:Open the config file for editing in $EDITOR.'
539       'profile:Apply profiles to config.'
540       'replace:Replace the config with <file>.'
541       'show:Output config file contents.'
542     )
543     _ipfs_subcommand _config_arguments
544   ;;
545   (daemon)
546     _arguments \
547       '--init[Initialize ipfs with default settings if not already initialized.]' \
548       '--init-config[Path to existing configuration file to be loaded during --init.]' \
549       '--init-profile[Configuration profiles to apply for --init. See ipfs init --help for more.]' \
550       '--routing[Overrides the routing option. Default: default.]' \
551       '--mount[Mounts IPFS to the filesystem.]' \
552       '--writable[Enable writing objects (with POST, PUT and DELETE).]' \
553       '--mount-ipfs[Path to the mountpoint for IPFS (if using --mount). Defaults to config setting.]' \
554       '--mount-ipns[Path to the mountpoint for IPNS (if using --mount). Defaults to config setting.]' \
555       '--unrestricted-api[Allow API access to unlisted hashes.]' \
556       '--disable-transport-encryption[Disable transport encryption (for debugging protocols).]' \
557       '--enable-gc[Enable automatic periodic repo garbage collection.]' \
558       '--manage-fdlimit[Check and raise file descriptor limits if needed. Default: true.]' \
559       '--migrate[If true, assume yes at the migrate prompt. If false, assume no.]' \
560       '--enable-pubsub-experiment[Instantiate the ipfs daemon with the experimental pubsub feature enabled.]' \
561       '--enable-namesys-pubsub[Enable IPNS record distribution through pubsub; enables pubsub.]' \
562       '--enable-mplex-experiment[Add the experimental 'go-multiplex' stream muxer to libp2p on construction. Default: true.]'
563   ;;
564   (dag)
565     local -a _dag_arguments
566     _dag_arguments=(
567       'export:Streams the selected DAG as a .car stream on stdout.'
568       'get:Get a dag node from ipfs.'
569       'import:Import the contents of .car files'
570       'put:Add a dag node to ipfs.'
571       'resolve:Resolve ipld block.'
572       'stat:Gets stats for a DAG'
573     )
574     _ipfs_subcommand _dag_arguments
575   ;;
576   (dht)
577     local -a _dht_arguments
578     _dht_arguments=(
579       'findpeer:Find the multiaddresses associated with a Peer ID.'
580       'findprovs:Find peers that can provide a specific value, given a key.'
581       'get:Given a key, query the routing system for its best value.'
582       'provide:Announce to the network that you are providing given values.'
583       'put:Write a key/value pair to the routing system.'
584       'query:Find the closest Peer IDs to a given Peer ID by querying the DHT.'
585     )
586     _ipfs_subcommand _dht_arguments
587   ;;
588   (diag)
589     local -a _diag_arguments
590     _diag_arguments=(
591       'cmds:List commands run on this IPFS node.'
592       'sys:Print system diagnostic information.'
593     )
594     _ipfs_subcommand _diag_arguments
595   ;;
596   (dns)
597     _arguments '(-r --recursive)'{-r,--recursive}'[Resolve until the result is not a DNS link. Default: true.]'
598   ;;
599   (files)
600     _arguments '(-f --flush)'{-f,--flush}'[Flush target and ancestors after write. Default: true.]'
601     local -a _files_arguments
602     _files_arguments=(
603       'chcid:Change the cid version or hash function of the root node of a given path.'
604       'cp:Copy files into mfs.'
605       "flush:Flush a given path's data to disk."
606       'ls:List directories in the local mutable namespace.'
607       'mkdir:Make directories.'
608       'mv:Move files.'
609       'read:Read a file in a given mfs.'
610       'rm:Remove a file.'
611       'stat:Display file status.'
612       'write:Write to a mutable file in a given filesystem.'
613     )
614     _ipfs_subcommand _files_arguments
615   ;;
616   (filestore)
617     local -a _filestore_arguments
618     _filestore_arguments=(
619       'dups:List blocks that are both in the filestore and standard block storage.'
620       'ls:List objects in filestore.'
621       'verify:Verify objects in filestore.'
622     )
623     _ipfs_subcommand _filestore_arguments
624   ;;
625   (get)
626     _arguments \
627       '(-o --output)'{-o,--output}'[The path where the output should be stored.]'\
628       '(-a --archive)'{-a,--archive}'[Output a TAR archive.]' \
629       '(-C --compress)'{-C,--compress}'[Compress the output with GZIP compression.]' \
630       '(-l --compression-level)'{-l,--compression-level}'[The level of compression (1-9).]'
631   ;;
632   (id)
633     _arguments \
634       '(-f --format)'{-f,--format}'[Optional output format.]' \
635       '--peerid-base[Encoding used for peer IDs: Can either be a multibase encoded CID or a base58btc encoded multihash. Takes {b58mh|base36|k|base32|b...}. Default: b58mh.]'
636   ;;
637   (init)
638     _arguments \
639       '(-a --algorithm)'{-a, --algorithm}'[Cryptographic algorithm to use for key generation. Default: ed25519.]' \
640       '(-b --bits)'{-b,--bits}'[Number of bits to use in the generated RSA private key.]' \
641       '(-e --empty-repo)'{-e,--empty-repo}"[Don't add and pin help files to the local storage.]" \
642       '(-p --profile)'{-p,--profile}"[Apply profile settings to config. Multiple profiles can be separated by ','.]"
643   ;;
644   (key)
645     local -a _key_arguments
646     _key_arguments=(
647       'export:Export a keypair'
648       'gen:Create a new keypair'
649       'import:Import a key and prints imported key id'
650       'list:List all local keypairs'
651       'rename:Rename a keypair'
652       'rm:Remove a keypair'
653       'rotate:Rotates the ipfs identity.'
654     )
655     _ipfs_subcommand _key_arguments
656   ;;
657   (log)
658     local -a _log_arguments
659     _log_arguments=(
660       'level:Change the logging level.'
661       'ls:List the logging subsystems.'
662       'tail:Read the event log.'
663     )
664     _ipfs_subcommand _log_arguments
665   ;;
666   (ls)
667     _arguments \
668       '(-v --headers)'{-v,--headers}'[Print table headers (Hash, Size, Name).]' \
669       '--resolve-type[Resolve linked objects to find out their types. Default: true.]' \
670       '--size[Resolve linked objects to find out their file size. Default: true.]' \
671       '(-s --stream)'{-s,--stream}'[Enable experimental streaming of directory entries as they are traversed.]' \
672   ;;
673   (mount)
674     _arguments \
675       '(-f --ipfs-path)'{-f,--ipfs-path}'[The path where IPFS should be mounted.]' \
676       '(-n --ipns-path)'{-n,--ipns-path}'[The path where IPNS should be mounted.]'
677   ;;
678   (name)
679     local -a _name_arguments
680     _name_arguments=(
681       'publish:Publish IPNS names.'
682       'pubsub:IPNS pubsub management.'
683       'resolve:Resolve IPNS names.'
684     )
685     _ipfs_subcommand _name_arguments
686   ;;
687   (object)
688     local -a _object_arguments
689     _object_arguments=(
690       'data:Output the raw bytes of an IPFS object.'
691       'diff:Display the diff between two ipfs objects.'
692       'get:Get and serialize the DAG node named by <key>.'
693       'links:Output the links pointed to by the specified object.'
694       'new:Create a new object from an ipfs template.'
695       'patch:Create a new merkledag object based on an existing one.'
696       'put:Store input as a DAG object, print its key.'
697       'stat:Get stats for the DAG node named by <key>.'
698     )
699     _ipfs_subcommand _object_arguments
700   ;;
701   (p2p)
702     local -a _p2p_arguments
703     _p2p_arguments=(
704       'close:Stop listening for new connections to forward.'
705       'forward:Forward connections to libp2p service'
706       'listen:Create libp2p service'
707       'ls:List active p2p listeners.'
708       'stream:P2P stream management.'
709     )
710     _ipfs_subcommand _p2p_arguments
711   ;;
712   (pin)
713     local -a _pin_arguments
714     _pin_arguments=(
715       'add:Pin objects to local storage.'
716       'ls:List objects pinned to local storage.'
717       'remote:Pin (and unpin) objects to remote pinning service.'
718       'rm:Remove pinned objects from local storage.'
719       'update:Update a recursive pin'
720       'verify:Verify that recursive pins are complete.'
721     )
722     _ipfs_subcommand _pin_arguments
723   ;;
724   (ping)
725     _arguments '(-n --count)'{-n,--count}'[Number of ping messages to send. Default: 10.]'
726   ;;
727   (refs)
728     _arguments \
729       '--format[Emit edges with given format. Available tokens: <src> <dst> <linkname>. Default: <dst>.]' \
730       '(-e --edges)'{-e,--edges}'[Emit edge format: `<from> -> <to>`.]' \
731       '(-u --unique)'{-u,--unique}'[Omit duplicate refs from output.]' \
732       '(-r --recursive)'{-r,--recursive}'[Recursively list links of child nodes.]' \
733       '--max-depth[Only for recursive refs, limits fetch and listing to the given depth. Default: -1.]'
734     local -a _refs_arguments
735     _refs_arguments='local:List all local references.'
736     _ipfs_subcommand _refs_arguments
737   ;;
738   (repo)
739     local -a _repo_arguments
740     _repo_arguments=(
741       'fsck:Remove repo lockfiles.'
742       'gc:Perform a garbage collection sweep on the repo.'
743       'stat:Get stats for the currently used repo.'
744       'verify:Verify all blocks in repo are not corrupted.'
745       'version:Show the repo version.'
746     )
747     _ipfs_subcommand _repo_arguments
748   ;;
749   (resolve)
750     _arguments \
751       '(-r --recursive)'{-r,--recursive}'[Resolve until the result is an IPFS name. Default: true.]' \
752       '(--dhtrc --dht-record-count)'{--dhtrc,--dht-record-count}'[Number of records to request for DHT resolution.]' \
753       '(--dhtt --dht-timeout)'{--dhtt,--dht-timeout}'[Max time to collect values during DHT resolution eg "30s". Pass 0 for no timeout.]'
754   ;;
755   (stats)
756     local -a _stats_arguments
757     _stats_arguments=(
758       'bitswap:Show some diagnostic information on the bitswap agent.'
759       'bw:Print ipfs bandwidth information.'
760       "dht:Returns statistics about the node's DHT(s)"
761       'repo:Get stats for the currently used repo.'
762     )
763     _ipfs_subcommand _stats_arguments
764   ;;
765   (swarm)
766     local -a _swarm_arguments
767     _swarm_arguments=(
768       'addrs:List known addresses. Useful for debugging.'
769       'connect:Open connection to a given address.'
770       'disconnect:Close connection to a given address.'
771       'filters:Manipulate address filters.'
772       'peers:List peers with open connections.'
773     )
774     _ipfs_subcommand _swarm_arguments
775   ;;
776   (tar)
777     local -a _tar_arguments
778     _tar_arguments=(
779       'add:Import a tar file into ipfs.'
780       'cat:Export a tar file from IPFS.'
781     )
782     _ipfs_subcommand _tar_arguments
783   ;;
784   (version)
785     _arguments \
786       '(-n --number)'{-n,--number}'[Only show the version number.]' \
787       '--commit[Show the commit hash.]' \
788       '--repo[Show repo version.]' \
789       '--all[Show all version information.]'
790   ;;
791 esac