7fce07a50cce6897efabe094b7c3272326955eb0

Author
Angel Ramboi <angel@ramboi.com>
Committer
GitHub <noreply@github.com>
Date

Message

Add completion plugin for IPFS (InterPlanetary File System) (#4737)

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/ipfs/LICENSE b/plugins/ipfs/LICENSE
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..cf84491bb7a3ad892b9de487758ddd5ba3b51688
  4--- /dev/null
  5+++ b/plugins/ipfs/LICENSE
  6@@ -0,0 +1,22 @@
  7+The MIT License (MIT)
  8+
  9+Copyright (c) 2015 Angel Ramboi
 10+
 11+Permission is hereby granted, free of charge, to any person obtaining a copy
 12+of this software and associated documentation files (the "Software"), to deal
 13+in the Software without restriction, including without limitation the rights
 14+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 15+copies of the Software, and to permit persons to whom the Software is
 16+furnished to do so, subject to the following conditions:
 17+
 18+The above copyright notice and this permission notice shall be included in all
 19+copies or substantial portions of the Software.
 20+
 21+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 22+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 23+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 24+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 25+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 26+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 27+SOFTWARE.
 28+
 29diff --git a/plugins/ipfs/README.md b/plugins/ipfs/README.md
 30new file mode 100644
 31index 0000000000000000000000000000000000000000..0808a26c150def108fd5e3aa1160f6214345aa9a
 32--- /dev/null
 33+++ b/plugins/ipfs/README.md
 34@@ -0,0 +1,17 @@
 35+# zsh-ipfs
 36+
 37+zsh completion plugin for [The InterPlanetary File System (IPFS)][1]
 38+
 39+Please submit issues and pull requests to the [main zsh-ipfs repo][2].
 40+
 41+### About
 42+
 43+[IPFS (InterPlanetary File System)][1] is a peer-to-peer hypermedia protocol
 44+designed to make the web faster, safer, and more open.
 45+
 46+### License
 47+
 48+See: https://github.com/hellounicorn/zsh-ipfs/blob/master/LICENSE
 49+
 50+[1]: http://ipfs.io/
 51+[2]: https://github.com/hellounicorn/zsh-ipfs
 52diff --git a/plugins/ipfs/_ipfs b/plugins/ipfs/_ipfs
 53new file mode 100644
 54index 0000000000000000000000000000000000000000..9ee8bd79c8f541099900d456da315cc0f6679652
 55--- /dev/null
 56+++ b/plugins/ipfs/_ipfs
 57@@ -0,0 +1,717 @@
 58+#compdef ipfs
 59+#autoload
 60+
 61+local -a _1st_arguments
 62+_1st_arguments=(
 63+  'add:Add a file or directory to ipfs.'
 64+  'bitswap:Interact with the bitswap agent.'
 65+  'block:Interact with raw IPFS blocks.'
 66+  'bootstrap:Show or edit the list of bootstrap peers.'
 67+  'cat:Show IPFS object data.'
 68+  'cid:Convert and discover properties of CIDs'
 69+  'commands:List all available commands.'
 70+  'config:Get and set ipfs config values.'
 71+  'daemon:Run a network-connected IPFS node.'
 72+  'dag:Interact with ipld dag objects. (experimental)'
 73+  'dht:Issue commands directly through the DHT.'
 74+  'diag:Generate diagnostic reports.'
 75+  'dns:Resolve DNS links.'
 76+  'files:Interact with unixfs files.'
 77+  'filestore:Interact with filestore objects. (experimental)'
 78+  'get:Download IPFS objects.'
 79+  'id:Show ipfs node id info.'
 80+  'init:Initializes ipfs config file.'
 81+  'key:Create and list IPNS name keypairs.'
 82+  'log:Interact with the daemon log output.'
 83+  'ls:List directory contents for Unix filesystem objects.'
 84+  'mount:Mounts IPFS to the filesystem (read-only).'
 85+  'name:Publish and resolve IPNS names.'
 86+  'object:Interact with IPFS objects.'
 87+  'p2p:Libp2p stream mounting.'
 88+  'pin:Pin (and unpin) objects to local storage.'
 89+  'ping:Send echo request packets to IPFS hosts.'
 90+  'refs:List links (references) from an object.'
 91+  'repo:Manipulate the IPFS repo.'
 92+  'resolve:Resolve the value of names to IPFS.'
 93+  'stats:Query IPFS statistics.'
 94+  'swarm:Interact with the swarm.'
 95+  'tar:Utility functions for tar files in ipfs.'
 96+  'update:Download and apply go-ipfs updates'
 97+  'version:Show ipfs version information.'
 98+)
 99+
100+_ipfs_subcommand(){
101+  local curcontext="$curcontext" state line
102+  typeset -A opt_args
103+  _arguments -C ':command:->command' '*::options:->options'
104+  case $state in
105+    (command)
106+      _describe -t commands "ipfs subcommand" $1
107+      return
108+    ;;
109+    (options)
110+      case $line[1] in
111+        (wantlist)
112+          case $MAIN_SUBCOMMAND in
113+            (bitswap)
114+              _arguments '(-p --peer)'{-p,--peer}'[Specify which peer to show wantlist for. Default: self.]'
115+            ;;
116+          esac
117+        ;;
118+        (add)
119+          case $MAIN_SUBCOMMAND in
120+            (pin)
121+              _arguments \
122+                '(-r --recursive)'{-r,--recursive}'[Recursively pin the object linked to by the specified object(s). Default: true.]' \
123+                '--progress[Show progress.]'
124+            ;;
125+            (bootstrap)
126+              local -a _bootstrap_rm_arguments
127+              _bootstrap_rm_arguments=(
128+                'default:Add default peers to the bootstrap list.'
129+              )
130+              _ipfs_subcommand _bootstrap_rm_arguments
131+            ;;
132+          esac
133+        ;;
134+        (rm)
135+          case $MAIN_SUBCOMMAND in
136+            (pin)
137+              _arguments '(-r --recursive)'{-r,--recursive}'[Recursively unpin the object linked to by the specified object(s). Default: true.]'
138+            ;;
139+            (bootstrap)
140+              local -a _bootstrap_rm_arguments
141+              _bootstrap_rm_arguments=(
142+                'all:Remove all peers from the bootstrap list.'
143+              )
144+              _ipfs_subcommand _bootstrap_rm_arguments
145+            ;;
146+          esac
147+        ;;
148+        (ls)
149+          case $MAIN_SUBCOMMAND in
150+            (pin)
151+              _arguments \
152+                '(-t --type)'{-t,--type}'[The type of pinned keys to list. Can be "direct", "indirect", "recursive", or "all". Default: all.]' \
153+                '(-q --quiet)'{-q,--quiet}'[Write just hashes of objects.]'
154+            ;;
155+            (p2p)
156+              _arguments '(-v --headers)'{-v,--headers}'[Print table headers (Protocol, Listen, Target).]'