* [gentoo-commits] repo/gentoo:master commit in: net-p2p/go-ipfs-bin/files/, net-p2p/go-ipfs-bin/
@ 2018-02-08 20:03 Michał Górny
0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2018-02-08 20:03 UTC (permalink / raw
To: gentoo-commits
commit: dcb439113e0d205f2b83ae15891dce2b85644e49
Author: David Roman <davidroman96 <AT> gmail <DOT> com>
AuthorDate: Tue Feb 6 15:12:32 2018 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Feb 8 20:03:20 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dcb43911
net-p2p/go-ipfs-bin: add bash completion file
Closes: https://bugs.gentoo.org/643636
Closes: https://github.com/gentoo/gentoo/pull/7092
net-p2p/go-ipfs-bin/files/ipfs-completion.bash | 959 +++++++++++++++++++++++
net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.13-r1.ebuild | 28 +
2 files changed, 987 insertions(+)
diff --git a/net-p2p/go-ipfs-bin/files/ipfs-completion.bash b/net-p2p/go-ipfs-bin/files/ipfs-completion.bash
new file mode 100644
index 00000000000..27f83fdef68
--- /dev/null
+++ b/net-p2p/go-ipfs-bin/files/ipfs-completion.bash
@@ -0,0 +1,959 @@
+_ipfs_comp()
+{
+ COMPREPLY=( $(compgen -W "$1" -- ${word}) )
+ if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ; then
+ # If there's only one option, with =, then discard space
+ compopt -o nospace
+ fi
+}
+
+_ipfs_help_only()
+{
+ _ipfs_comp "--help"
+}
+
+_ipfs_add()
+{
+ if [[ "${prev}" == "--chunker" ]] ; then
+ _ipfs_comp "placeholder1 placeholder2 placeholder3" # TODO: a) Give real options, b) Solve autocomplete bug for "="
+ elif [ "${prev}" == "--pin" ] ; then
+ _ipfs_comp "true false"
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--recursive --quiet --silent --progress --trickle --only-hash --wrap-with-directory --hidden --chunker= --pin= --raw-leaves --help "
+ else
+ _ipfs_filesystem_complete
+ fi
+}
+
+_ipfs_bitswap()
+{
+ ipfs_comp "ledger stat unwant wantlist --help"
+}
+
+_ipfs_bitswap_ledger()
+{
+ _ipfs_help_only
+}
+
+_ipfs_bitswap_stat()
+{
+ _ipfs_help_only
+}
+
+_ipfs_bitswap_unwant()
+{
+ _ipfs_help_only
+}
+
+_ipfs_bitswap_wantlist()
+{
+ ipfs_comp "--peer= --help"
+}
+
+_ipfs_bitswap_unwant()
+{
+ _ipfs_help_only
+}
+
+_ipfs_block()
+{
+ _ipfs_comp "get put rm stat --help"
+}
+
+_ipfs_block_get()
+{
+ _ipfs_hash_complete
+}
+
+_ipfs_block_put()
+{
+ if [ "${prev}" == "--format" ] ; then
+ _ipfs_comp "v0 placeholder2 placeholder3" # TODO: a) Give real options, b) Solve autocomplete bug for "="
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--format= --help"
+ else
+ _ipfs_filesystem_complete
+ fi
+}
+
+_ipfs_block_rm()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--force --quiet --help"
+ else
+ _ipfs_hash_complete
+ fi
+}
+
+_ipfs_block_stat()
+{
+ _ipfs_hash_complete
+}
+
+_ipfs_bootstrap()
+{
+ _ipfs_comp "add list rm --help"
+}
+
+_ipfs_bootstrap_add()
+{
+ _ipfs_comp "default --help"
+}
+
+_ipfs_bootstrap_list()
+{
+ _ipfs_help_only
+}
+
+_ipfs_bootstrap_rm()
+{
+ _ipfs_comp "all --help"
+}
+
+_ipfs_cat()
+{
+ if [[ ${prev} == */* ]] ; then
+ COMPREPLY=() # Only one argument allowed
+ elif [[ ${word} == */* ]] ; then
+ _ipfs_hash_complete
+ else
+ _ipfs_pinned_complete
+ fi
+}
+
+_ipfs_commands()
+{
+ _ipfs_comp "--flags --help"
+}
+
+_ipfs_config()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--bool --json"
+ elif [[ ${prev} == *.* ]] ; then
+ COMPREPLY=() # Only one subheader of the config can be shown or edited.
+ else
+ _ipfs_comp "show edit replace"
+ fi
+}
+
+_ipfs_config_edit()
+{
+ _ipfs_help_only
+}
+
+_ipfs_config_replace()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--help"
+ else
+ _ipfs_filesystem_complete
+ fi
+}
+
+_ipfs_config_show()
+{
+ _ipfs_help_only
+}
+
+_ipfs_daemon()
+{
+ if [[ ${prev} == "--routing" ]] ; then
+ _ipfs_comp "dht dhtclient none" # TODO: Solve autocomplete bug for "="
+ elif [[ ${prev} == "--mount-ipfs" ]] || [[ ${prev} == "--mount-ipns" ]] || [[ ${prev} == "=" ]]; then
+ _ipfs_filesystem_complete
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--init --routing= --mount --writable --mount-ipfs= \
+ --mount-ipns= --unrestricted-api --disable-transport-encryption \
+ -- enable-gc --manage-fdlimit --offline --migrate --help"
+ fi
+}
+
+_ipfs_dag()
+{
+ _ipfs_comp "get put --help"
+}
+
+_ipfs_dag_get()
+{
+ _ipfs_help_only
+}
+
+_ipfs_dag_put()
+{
+ if [[ ${prev} == "--format" ]] ; then
+ _ipfs_comp "cbor placeholder1" # TODO: a) Which format more then cbor is valid? b) Solve autocomplete bug for "="
+ elif [[ ${prev} == "--input-enc" ]] ; then
+ _ipfs_comp "json placeholder1" # TODO: a) Which format more then json is valid? b) Solve autocomplete bug for "="
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--format= --input-enc= --help"
+ else
+ _ipfs_filesystem_complete
+ fi
+}
+
+_ipfs_dht()
+{
+ _ipfs_comp "findpeer findprovs get provide put query --help"
+}
+
+_ipfs_dht_findpeer()
+{
+ _ipfs_comp "--verbose --help"
+}
+
+_ipfs_dht_findprovs()
+{
+ _ipfs_comp "--verbose --help"
+}
+
+_ipfs_dht_get()
+{
+ _ipfs_comp "--verbose --help"
+}
+
+_ipfs_dht_provide()
+{
+ _ipfs_comp "--recursive --verbose --help"
+}
+
+_ipfs_dht_put()
+{
+ _ipfs_comp "--verbose --help"
+}
+
+_ipfs_dht_query()
+{
+ _ipfs_comp "--verbose --help"
+}
+
+_ipfs_diag()
+{
+ _ipfs_comp "sys cmds net --help"
+}
+
+_ipfs_diag_cmds()
+{
+ if [[ ${prev} == "clear" ]] ; then
+ return 0
+ elif [[ ${prev} =~ ^-?[0-9]+$ ]] ; then
+ _ipfs_comp "ns us µs ms s m h" # TODO: Trigger with out space, eg. "ipfs diag set-time 10ns" not "... set-time 10 ns"
+ elif [[ ${prev} == "set-time" ]] ; then
+ _ipfs_help_only
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--verbose --help"
+ else
+ _ipfs_comp "clear set-time"
+ fi
+}
+
+_ipfs_diag_sys()
+{
+ _ipfs_help_only
+}
+
+_ipfs_diag_net()
+{
+ if [[ ${prev} == "--vis" ]] ; then
+ _ipfs_comp "d3 dot text" # TODO: Solve autocomplete bug for "="
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--timeout= --vis= --help"
+ fi
+}
+
+_ipfs_dns()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--recursive --help"
+ fi
+}
+
+_ipfs_files()
+{
+ _ipfs_comp "mv rm flush read write cp ls mkdir stat"
+}
+
+_ipfs_files_mv()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--recursive --flush"
+ elif [[ ${word} == /* ]] ; then
+ _ipfs_files_complete
+ else
+ COMPREPLY=( / )
+ [[ $COMPREPLY = */ ]] && compopt -o nospace
+ fi
+}
+
+_ipfs_files_rm()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--recursive --flush"
+ elif [[ ${word} == /* ]] ; then
+ _ipfs_files_complete
+ else
+ COMPREPLY=( / )
+ [[ $COMPREPLY = */ ]] && compopt -o nospace
+ fi
+}
+_ipfs_files_flush()
+{
+ if [[ ${word} == /* ]] ; then
+ _ipfs_files_complete
+ else
+ COMPREPLY=( / )
+ [[ $COMPREPLY = */ ]] && compopt -o nospace
+ fi
+}
+
+_ipfs_files_read()
+{
+ if [[ ${prev} == "--count" ]] || [[ ${prev} == "--offset" ]] ; then
+ COMPREPLY=() # Numbers, just keep it empty
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--offset --count --help"
+ elif [[ ${word} == /* ]] ; then
+ _ipfs_files_complete
+ else
+ COMPREPLY=( / )
+ [[ $COMPREPLY = */ ]] && compopt -o nospace
+ fi
+}
+
+_ipfs_files_write()
+{
+ if [[ ${prev} == "--count" ]] || [[ ${prev} == "--offset" ]] ; then # Dirty check
+ COMPREPLY=() # Numbers, just keep it empty
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--offset --count --create --truncate --help"
+ elif [[ ${prev} == /* ]] ; then
+ _ipfs_filesystem_complete
+ elif [[ ${word} == /* ]] ; then
+ _ipfs_files_complete
+ else
+ COMPREPLY=( / )
+ [[ $COMPREPLY = */ ]] && compopt -o nospace
+ fi
+}
+
+_ipfs_files_cp()
+{
+ if [[ ${word} == /* ]] ; then
+ _ipfs_files_complete
+ else
+ COMPREPLY=( / )
+ [[ $COMPREPLY = */ ]] && compopt -o nospace
+ fi
+}
+
+_ipfs_files_ls()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "-l --help"
+ elif [[ ${prev} == /* ]] ; then
+ COMPREPLY=() # Path exist
+ elif [[ ${word} == /* ]] ; then
+ _ipfs_files_complete
+ else
+ COMPREPLY=( / )
+ [[ $COMPREPLY = */ ]] && compopt -o nospace
+ fi
+}
+
+_ipfs_files_mkdir()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--parents --help"
+
+ elif [[ ${prev} == /* ]] ; then
+ COMPREPLY=() # Path exist
+ elif [[ ${word} == /* ]] ; then
+ _ipfs_files_complete
+ else
+ COMPREPLY=( / )
+ [[ $COMPREPLY = */ ]] && compopt -o nospace
+ fi
+}
+
+_ipfs_files_stat()
+{
+ if [[ ${prev} == /* ]] ; then
+ COMPREPLY=() # Path exist
+ elif [[ ${word} == /* ]] ; then
+ _ipfs_files_complete
+ else
+ COMPREPLY=( / )
+ [[ $COMPREPLY = */ ]] && compopt -o nospace
+ fi
+}
+
+_ipfs_file()
+{
+ if [[ ${prev} == "ls" ]] ; then
+ _ipfs_hash_complete
+ else
+ _ipfs_comp "ls --help"
+ fi
+}
+
+_ipfs_file_ls()
+{
+ _ipfs_help_only
+}
+
+_ipfs_get()
+{
+ if [ "${prev}" == "--output" ] ; then
+ compopt -o default # Re-enable default file read
+ COMPREPLY=()
+ elif [ "${prev}" == "--compression-level" ] ; then
+ _ipfs_comp "-1 1 2 3 4 5 6 7 8 9" # TODO: Solve autocomplete bug for "="
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--output= --archive --compress --compression-level= --help"
+ else
+ _ipfs_hash_complete
+ fi
+}
+
+_ipfs_id()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--format= --help"
+ fi
+}
+
+_ipfs_init()
+{
+ _ipfs_comp "--bits --force --empty-repo --help"
+}
+
+_ipfs_log()
+{
+ _ipfs_comp "level ls tail --help"
+}
+
+_ipfs_log_level()
+{
+ # TODO: auto-complete subsystem and level
+ _ipfs_help_only
+}
+
+_ipfs_log_ls()
+{
+ _ipfs_help_only
+}
+
+_ipfs_log_tail()
+{
+ _ipfs_help_only
+}
+
+_ipfs_ls()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--headers --resolve-type=false --help"
+ else
+ _ipfs_hash_complete
+ fi
+}
+
+_ipfs_mount()
+{
+ if [[ ${prev} == "--ipfs-path" ]] || [[ ${prev} == "--ipns-path" ]] || [[ ${prev} == "=" ]] ; then
+ _ipfs_filesystem_complete
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--ipfs-path= --ipns-path= --help"
+ fi
+}
+
+_ipfs_name()
+{
+ _ipfs_comp "publish resolve --help"
+}
+
+_ipfs_name_publish()
+{
+ if [[ ${prev} == "--lifetime" ]] || [[ ${prev} == "--ttl" ]] ; then
+ COMPREPLY=() # Accept only numbers
+ elif [[ ${prev} =~ ^-?[0-9]+$ ]] ; then
+ _ipfs_comp "ns us µs ms s m h" # TODO: Trigger without space, eg. "ipfs diag set-time 10ns" not "... set-time 10 ns"
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--resolve --lifetime --ttl --help"
+ elif [[ ${word} == */ ]]; then
+ _ipfs_hash_complete
+ else
+ _ipfs_pinned_complete
+ fi
+}
+
+_ipfs_name_resolve()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--recursive --nocache --help"
+ fi
+}
+
+_ipfs_object()
+{
+ _ipfs_comp "data diff get links new patch put stat --help"
+}
+
+_ipfs_object_data()
+{
+ _ipfs_hash_complete
+}
+
+_ipfs_object_diff()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--verbose --help"
+ else
+ _ipfs_hash_complete
+ fi
+}
+
+
+_ipfs_object_get()
+{
+ if [ "${prev}" == "--encoding" ] ; then
+ _ipfs_comp "protobuf json xml"
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--encoding --help"
+ else
+ _ipfs_hash_complete
+ fi
+}
+
+_ipfs_object_links()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--headers --help"
+ else
+ _ipfs_hash_complete
+ fi
+}
+
+_ipfs_object_new()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--help"
+ else
+ _ipfs_comp "unixfs-dir"
+ fi
+}
+
+_ipfs_object_patch()
+{
+ if [[ -n "${COMP_WORDS[3]}" ]] ; then # Root merkledag object exist
+ case "${COMP_WORDS[4]}" in
+ append-data)
+ _ipfs_help_only
+ ;;
+ add-link)
+ if [[ ${word} == -* ]] && [[ ${prev} == "add-link" ]] ; then # Dirty check
+ _ipfs_comp "--create"
+ #else
+ # TODO: Hash path autocomplete. This is tricky, can be hash or a name.
+ fi
+ ;;
+ rm-link)
+ _ipfs_hash_complete
+ ;;
+ set-data)
+ _ipfs_filesystem_complete
+ ;;
+ *)
+ _ipfs_comp "append-data add-link rm-link set-data"
+ ;;
+ esac
+ else
+ _ipfs_hash_complete
+ fi
+}
+
+_ipfs_object_put()
+{
+ if [ "${prev}" == "--inputenc" ] ; then
+ _ipfs_comp "protobuf json"
+ elif [ "${prev}" == "--datafieldenc" ] ; then
+ _ipfs_comp "text base64"
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--inputenc --datafieldenc --help"
+ else
+ _ipfs_hash_complete
+ fi
+}
+
+_ipfs_object_stat()
+{
+ _ipfs_hash_complete
+}
+
+_ipfs_pin()
+{
+ _ipfs_comp "rm ls add --help"
+}
+
+_ipfs_pin_add()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--recursive= --help"
+ elif [[ ${word} == */ ]] && [[ ${word} != "/ipfs/" ]] ; then
+ _ipfs_hash_complete
+ fi
+}
+
+_ipfs_pin_ls()
+{
+ if [[ ${prev} == "--type" ]] || [[ ${prev} == "-t" ]] ; then
+ _ipfs_comp "direct indirect recursive all" # TODO: Solve autocomplete bug for
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--count --quiet --type= --help"
+ elif [[ ${word} == */ ]] && [[ ${word} != "/ipfs/" ]] ; then
+ _ipfs_hash_complete
+ fi
+}
+
+_ipfs_pin_rm()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--recursive --help"
+ elif [[ ${word} == */ ]] && [[ ${word} != "/ipfs/" ]] ; then
+ COMPREPLY=() # TODO: _ipfs_hash_complete() + List local pinned hashes as default?
+ fi
+}
+
+_ipfs_ping()
+{
+ _ipfs_comp "--count= --help"
+}
+
+_ipfs_pubsub()
+{
+ _ipfs_comp "ls peers pub sub --help"
+}
+
+_ipfs_pubsub_ls()
+{
+ _ipfs_help_only
+}
+
+_ipfs_pubsub_peers()
+{
+ _ipfs_help_only
+}
+
+_ipfs_pubsub_pub()
+{
+ _ipfs_help_only
+}
+
+_ipfs_pubsub_sub()
+{
+ _ipfs_comp "--discover --help"
+}
+
+_ipfs_refs()
+{
+ if [ "${prev}" == "--format" ] ; then
+ _ipfs_comp "src dst linkname"
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "local --format= --edges --unique --recursive --help"
+ #else
+ # TODO: Use "ipfs ref" and combine it with autocomplete, see _ipfs_hash_complete
+ fi
+}
+
+_ipfs_refs_local()
+{
+ _ipfs_help_only
+}
+
+_ipfs_repo()
+{
+ _ipfs_comp "fsck gc stat verify version --help"
+}
+
+_ipfs_repo_version()
+{
+ _ipfs_comp "--quiet --help"
+}
+
+_ipfs_repo_verify()
+{
+ _ipfs_help_only
+}
+
+_ipfs_repo_gc()
+{
+ _ipfs_comp "--quiet --help"
+}
+
+_ipfs_repo_stat()
+{
+ _ipfs_comp "--human --help"
+}
+
+_ipfs_repo_fsck()
+{
+ _ipfs_help_only
+}
+
+_ipfs_resolve()
+{
+ if [[ ${word} == /ipfs/* ]] ; then
+ _ipfs_hash_complete
+ elif [[ ${word} == /ipns/* ]] ; then
+ COMPREPLY=() # Can't autocomplete ipns
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--recursive --help"
+ else
+ opts="/ipns/ /ipfs/"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${word}) )
+ [[ $COMPREPLY = */ ]] && compopt -o nospace
+ fi
+}
+
+_ipfs_stats()
+{
+ _ipfs_comp "bitswap bw repo --help"
+}
+
+_ipfs_stats_bitswap()
+{
+ _ipfs_help_only
+}
+
+_ipfs_stats_bw()
+{
+ # TODO: Which protocol is valid?
+ _ipfs_comp "--peer= --proto= --poll --interval= --help"
+}
+
+_ipfs_stats_repo()
+{
+ _ipfs_comp "--human= --help"
+}
+
+_ipfs_swarm()
+{
+ _ipfs_comp "addrs connect disconnect filters peers --help"
+}
+
+_ipfs_swarm_addrs()
+{
+ _ipfs_comp "local --help"
+}
+
+_ipfs_swarm_addrs_local()
+{
+ _ipfs_comp "--id --help"
+}
+
+_ipfs_swarm_connect()
+{
+ _ipfs_multiaddr_complete
+}
+
+_ipfs_swarm_disconnect()
+{
+ local OLDIFS="$IFS" ; local IFS=$'\n' # Change divider for iterator one line below
+ opts=$(for x in `ipfs swarm peers`; do echo ${x} ; done)
+ IFS="$OLDIFS" # Reset divider to space, ' '
+ COMPREPLY=( $(compgen -W "${opts}" -- ${word}) )
+ [[ $COMPREPLY = */ ]] && compopt -o nospace -o filenames
+}
+
+_ipfs_swarm_filters()
+{
+ if [[ ${prev} == "add" ]] || [[ ${prev} == "rm" ]]; then
+ _ipfs_multiaddr_complete
+ else
+ _ipfs_comp "add rm --help"
+ fi
+}
+
+_ipfs_swarm_filters_add()
+{
+ _ipfs_help_only
+}
+
+_ipfs_swarm_filters_rm()
+{
+ _ipfs_help_only
+}
+
+_ipfs_swarm_peers()
+{
+ _ipfs_help_only
+}
+
+_ipfs_tar()
+{
+ _ipfs_comp "add cat --help"
+}
+
+_ipfs_tar_add()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--help"
+ else
+ _ipfs_filesystem_complete
+ fi
+}
+
+_ipfs_tar_cat()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--help"
+ else
+ _ipfs_filesystem_complete
+ fi
+}
+
+_ipfs_update()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--version" # TODO: How does "--verbose" option work?
+ else
+ _ipfs_comp "versions version install stash revert fetch"
+ fi
+}
+
+_ipfs_update_install()
+{
+ if [[ ${prev} == v*.*.* ]] ; then
+ COMPREPLY=()
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--version"
+ else
+ local OLDIFS="$IFS" ; local IFS=$'\n' # Change divider for iterator one line below
+ opts=$(for x in `ipfs update versions`; do echo ${x} ; done)
+ IFS="$OLDIFS" # Reset divider to space, ' '
+ COMPREPLY=( $(compgen -W "${opts}" -- ${word}) )
+ fi
+}
+
+_ipfs_update_stash()
+{
+ if [[ ${word} == -* ]] ; then
+ _ipfs_comp "--tag --help"
+ fi
+}
+_ipfs_update_fetch()
+{
+ if [[ ${prev} == "--output" ]] ; then
+ _ipfs_filesystem_complete
+ elif [[ ${word} == -* ]] ; then
+ _ipfs_comp "--output --help"
+ fi
+}
+
+_ipfs_version()
+{
+ _ipfs_comp "--number --commit --repo"
+}
+
+_ipfs_hash_complete()
+{
+ local lastDir=${word%/*}/
+ echo "LastDir: ${lastDir}" >> ~/Downloads/debug-ipfs.txt
+ local OLDIFS="$IFS" ; local IFS=$'\n' # Change divider for iterator one line below
+ opts=$(for x in `ipfs file ls ${lastDir}`; do echo ${lastDir}${x}/ ; done) # TODO: Implement "ipfs file ls -F" to get rid of frontslash after files. This take long time to run first time on a new shell.
+ echo "Options: ${opts}" >> ~/Downloads/debug-ipfs.txt
+ IFS="$OLDIFS" # Reset divider to space, ' '
+ echo "Current: ${word}" >> ~/Downloads/debug-ipfs.txt
+ COMPREPLY=( $(compgen -W "${opts}" -- ${word}) )
+ echo "Suggestion: ${COMPREPLY}" >> ~/Downloads/debug-ipfs.txt
+ [[ $COMPREPLY = */ ]] && compopt -o nospace -o filenames # Removing whitespace after output & handle output as filenames. (Only printing the latest folder of files.)
+ return 0
+}
+
+_ipfs_files_complete()
+{
+ local lastDir=${word%/*}/
+ local OLDIFS="$IFS" ; local IFS=$'\n' # Change divider for iterator one line below
+ opts=$(for x in `ipfs files ls ${lastDir}`; do echo ${lastDir}${x}/ ; done) # TODO: Implement "ipfs files ls -F" to get rid of frontslash after files. This does currently throw "Error: /cats/foo/ is not a directory"
+ IFS="$OLDIFS" # Reset divider to space, ' '
+ COMPREPLY=( $(compgen -W "${opts}" -- ${word}) )
+ [[ $COMPREPLY = */ ]] && compopt -o nospace -o filenames
+ return 0
+}
+
+_ipfs_multiaddr_complete()
+{
+ local lastDir=${word%/*}/
+ # Special case
+ if [[ ${word} == */"ipcidr"* ]] ; then # TODO: Broken, fix it.
+ opts="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" # TODO: IPv6?
+ COMPREPLY=( $(compgen -W "${opts}" -- ${word}) )
+ # "Loop"
+ elif [[ ${word} == /*/ ]] || [[ ${word} == /*/* ]] ; then
+ if [[ ${word} == /*/*/*/*/*/ ]] ; then
+ COMPREPLY=()
+ elif [[ ${word} == /*/*/*/*/ ]] ; then
+ word=${word##*/}
+ opts="ipfs/ "
+ COMPREPLY=( $(compgen -W "${opts}" -- ${word}) )
+ elif [[ ${word} == /*/*/*/ ]] ; then
+ word=${word##*/}
+ opts="4001/ "
+ COMPREPLY=( $(compgen -W "${opts}" -- ${word}) )
+ elif [[ ${word} == /*/*/ ]] ; then
+ word=${word##*/}
+ opts="udp/ tcp/ ipcidr/"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${word}) )
+ elif [[ ${word} == /*/ ]] ; then
+ COMPREPLY=() # TODO: This need to return something to NOT break the function. Maybe a "/" in the end as well due to -o filename option.
+ fi
+ COMPREPLY=${lastDir}${COMPREPLY}
+ else # start case
+ opts="/ip4/ /ip6/"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${word}) )
+ fi
+ [[ $COMPREPLY = */ ]] && compopt -o nospace -o filenames
+ return 0
+}
+
+_ipfs_pinned_complete()
+{
+ local OLDIFS="$IFS" ; local IFS=$'\n'
+ local pinned=$(ipfs pin ls)
+ COMPREPLY=( $(compgen -W "${pinned}" -- ${word}) )
+ IFS="$OLDIFS"
+ if [[ ${#COMPREPLY[*]} -eq 1 ]]; then # Only one completion, remove pretty output
+ COMPREPLY=( ${COMPREPLY[0]/ *//} ) #Remove ' ' and everything after
+ [[ $COMPREPLY = */ ]] && compopt -o nospace # Removing whitespace after output
+ fi
+}
+_ipfs_filesystem_complete()
+{
+ compopt -o default # Re-enable default file read
+ COMPREPLY=()
+}
+
+_ipfs()
+{
+ COMPREPLY=()
+ compopt +o default # Disable default to not deny completion, see: http://stackoverflow.com/a/19062943/1216348
+
+ local word="${COMP_WORDS[COMP_CWORD]}"
+ local prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+ case "${COMP_CWORD}" in
+ 1)
+ local opts="add bitswap block bootstrap cat commands config daemon dag dht \
+ diag dns file files get id init log ls mount name object pin ping pubsub \
+ refs repo resolve stats swarm tar update version"
+ COMPREPLY=( $(compgen -W "${opts}" -- ${word}) );;
+ 2)
+ local command="${COMP_WORDS[1]}"
+ eval "_ipfs_$command" 2> /dev/null ;;
+ *)
+ local command="${COMP_WORDS[1]}"
+ local subcommand="${COMP_WORDS[2]}"
+ eval "_ipfs_${command}_${subcommand}" 2> /dev/null && return
+ eval "_ipfs_$command" 2> /dev/null ;;
+ esac
+}
+complete -F _ipfs ipfs
diff --git a/net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.13-r1.ebuild b/net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.13-r1.ebuild
new file mode 100644
index 00000000000..5771da30b8d
--- /dev/null
+++ b/net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.13-r1.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit bash-completion-r1
+
+DESCRIPTION="go-ipfs is the main implementation of IPFS."
+HOMEPAGE="https://ipfs.io/"
+SRC_URI="amd64? ( https://dist.ipfs.io/go-ipfs/v${PV}/go-ipfs_v${PV}_linux-amd64.tar.gz )
+ x86? ( https://dist.ipfs.io/go-ipfs/v${PV}/go-ipfs_v${PV}_linux-386.tar.gz )
+ arm? ( https://dist.ipfs.io/go-ipfs/v${PV}/go-ipfs_v${PV}_linux-arm.tar.gz )"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~arm ~x86"
+IUSE="+fuse"
+
+RDEPEND="fuse? ( sys-fs/fuse )"
+S="${WORKDIR}/go-ipfs"
+
+QA_PREBUILT="/usr/bin/ipfs"
+
+src_install() {
+ dobin ipfs
+
+ newbashcomp "${FILESDIR}/ipfs-completion.bash" "${PN}"
+}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: net-p2p/go-ipfs-bin/files/, net-p2p/go-ipfs-bin/
@ 2019-09-28 6:46 Joonas Niilola
0 siblings, 0 replies; 2+ messages in thread
From: Joonas Niilola @ 2019-09-28 6:46 UTC (permalink / raw
To: gentoo-commits
commit: f02a3bf0a1f4c5d58fc553d9a85fe44229e1be76
Author: Kai Krakow <kai <AT> kaishome <DOT> de>
AuthorDate: Thu Sep 19 21:38:43 2019 +0000
Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sat Sep 28 06:46:14 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f02a3bf0
net-p2p/go-ipfs-bin: Bump to 0.4.22
Bump to 0.4.22 and fix systemd unit files on that way. This
revision installs both variants, a user instance unit and a unit
mirroring what the openrc version does (using the "ipfs" user).
Closes: https://bugs.gentoo.org/643634
Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Kai Krakow <kai <AT> kaishome.de>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
net-p2p/go-ipfs-bin/Manifest | 4 ++
.../files/{ipfs.service => ipfs-at.service} | 8 +++-
net-p2p/go-ipfs-bin/files/ipfs.service | 11 +++--
net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.22.ebuild | 51 ++++++++++++++++++++++
net-p2p/go-ipfs-bin/metadata.xml | 8 +++-
5 files changed, 75 insertions(+), 7 deletions(-)
diff --git a/net-p2p/go-ipfs-bin/Manifest b/net-p2p/go-ipfs-bin/Manifest
index d9f57fb27c2..fa04e26d3c7 100644
--- a/net-p2p/go-ipfs-bin/Manifest
+++ b/net-p2p/go-ipfs-bin/Manifest
@@ -1,6 +1,7 @@
DIST go-ipfs-bin-0.4.18.bash 20753 BLAKE2B c34d29a48cf249b7a646a8a7b6015b9c4a4a5d8656187ec5984b0dfb741a8ca7b2f2d0a10bc0288aa862679c6d52145936b46497936565ba7cdb2ba847fda5b8 SHA512 acd3bdb689964aa5e15965bfea3cd1267f54a2014c05f49f4e536902cbdab3e22038f4f5db5ecc273c147135b265fcb82a41db22bfc3fd8f6ddc8ae43fd053ea
DIST go-ipfs-bin-0.4.19.bash 20753 BLAKE2B c34d29a48cf249b7a646a8a7b6015b9c4a4a5d8656187ec5984b0dfb741a8ca7b2f2d0a10bc0288aa862679c6d52145936b46497936565ba7cdb2ba847fda5b8 SHA512 acd3bdb689964aa5e15965bfea3cd1267f54a2014c05f49f4e536902cbdab3e22038f4f5db5ecc273c147135b265fcb82a41db22bfc3fd8f6ddc8ae43fd053ea
DIST go-ipfs-bin-0.4.20.bash 20753 BLAKE2B c34d29a48cf249b7a646a8a7b6015b9c4a4a5d8656187ec5984b0dfb741a8ca7b2f2d0a10bc0288aa862679c6d52145936b46497936565ba7cdb2ba847fda5b8 SHA512 acd3bdb689964aa5e15965bfea3cd1267f54a2014c05f49f4e536902cbdab3e22038f4f5db5ecc273c147135b265fcb82a41db22bfc3fd8f6ddc8ae43fd053ea
+DIST go-ipfs-bin-0.4.22.bash 20753 BLAKE2B c34d29a48cf249b7a646a8a7b6015b9c4a4a5d8656187ec5984b0dfb741a8ca7b2f2d0a10bc0288aa862679c6d52145936b46497936565ba7cdb2ba847fda5b8 SHA512 acd3bdb689964aa5e15965bfea3cd1267f54a2014c05f49f4e536902cbdab3e22038f4f5db5ecc273c147135b265fcb82a41db22bfc3fd8f6ddc8ae43fd053ea
DIST go-ipfs_v0.4.18_linux-386.tar.gz 11128726 BLAKE2B 2f1289bb0aa93d0d03585bb90f577f91c8db922ba7905aab90c6e6b7804b7fab5c52b861aa0cdd927de8ea0b6e20f22f1c42c390628cd2e660fbaecd55b04d24 SHA512 7fff0da87827dcef7c84f959f4cfdc0b5e43e82c636b77fd600d4f62d7b78b8f1660ea346caa5eaf2d791ab275f41c0f83d606e4b36f29f3284a1851a82fbce5
DIST go-ipfs_v0.4.18_linux-amd64.tar.gz 13791729 BLAKE2B 777d20792d089216010574798245e0eac0a5ec46549aef3ec4162c289d1d4fec1b381d8fba39ad2a57d88fcbeee5cdd1bd8509fa8883dd946fb452c4266f95de SHA512 ef5b44a0aaed604890c83322ca02228061204085b87b20dd173edfe6b6631fc7a54724d2e00202488c86886992a0d409f43e09f022cdf8b1138f8419cf7614b0
DIST go-ipfs_v0.4.18_linux-arm.tar.gz 10933477 BLAKE2B b846926b33c78a6d089717689993c6a9c9b6ae03b32f184c2a74ecc1a9c290e7b29a9e35f2e7691e504e86c6f6229d86bbf956d90d939decb91a22fe04f74504 SHA512 c60cf427109c9c08a73a8270fe9d2792932894cfd68c1a90ec159733d121c5c12647e4b8ab2ed24865c9a4b7f8cb94db9dbe47667e48b5525b39f0c3a0acf085
@@ -10,3 +11,6 @@ DIST go-ipfs_v0.4.19_linux-arm.tar.gz 11118746 BLAKE2B 08ea24e8367d22577798636fa
DIST go-ipfs_v0.4.20_linux-386.tar.gz 18312554 BLAKE2B 0da4c23635f4451f4a4156f492fb380a538108b1dd834bbfb35ae1d77543e3d2fb9823431228c5cf6fe6aa6318062dcc4c22e4e3c8775c16ac2b5e876ecfafe3 SHA512 675ab88affa3871ea6ca9cf14150f6ad262ca1c7120ab2dbf15259693754f5372de3958ae9265ac800b21e53f495356dc45f1a67fb01548468dabb6e5d8befd4
DIST go-ipfs_v0.4.20_linux-amd64.tar.gz 20120151 BLAKE2B 3e363fbf244d4d848dbf5e0e13a78804401ea1b3b205683e8ea6d8b2409557b0575bb23149013ebac231523bb7f6278220715f8e20032d0bbb7a420f94e664b5 SHA512 a8a2ec9c04a7aec576f8b86997d5310b77eca2b78df9c269ac9ef478d786277550f09e410e392ede333eb652e8ed136bb58a22f2b3198c94a61649c7a5525b68
DIST go-ipfs_v0.4.20_linux-arm.tar.gz 17668228 BLAKE2B f900ecdbc580e86a476d1d5d64fa54be7856429a33b9fc98d8d8141431be0df2776726c64d81218903c51f648f1ab5256d23daf82e260f4e714c7e4bb169380f SHA512 feb608db7fc9750ca155d008992a93bb5e9e1f53504d224aeb474465c5811ada182770c4a5465331f9d6b2c3472201bb53a1243c0de844f94db4751569db3021
+DIST go-ipfs_v0.4.22_linux-386.tar.gz 18865892 BLAKE2B 4ff67301ce6eec8cb38015f6dba16e10ee1fa3efffb47b2c3a9fe76fba875907ccd53ec011abe5b496de4dd2dff0a30f4e526e232f47c174b83004efdcc30764 SHA512 a6d16217412d1be0cdc0a2df604740054758b767994bbcb7ffc745abd90c64c28031b543bcb5589c715fa7115effc9a3b898ada8ad96c604507b428ed2538378
+DIST go-ipfs_v0.4.22_linux-amd64.tar.gz 20900056 BLAKE2B f068c367fb454a62c76f9828927aae0870f54853d0aeddfe6ca774490107c26df88ce41efa016732dffaf269d3dc2d16e1744f9cc35d4f86e355744eb3172a10 SHA512 49b99fec741d67f7bad8fb6fbbd984967f06dfc3de846d10dca34b166f621a182d12f13cf5ccf4e4f33747b67cede6f4205b4cd9b57ce5244128d1385ec82c85
+DIST go-ipfs_v0.4.22_linux-arm.tar.gz 18199193 BLAKE2B 25316649add6256c4f12efb9bb43848e2049cc7bcbe89dbe77309e1cf793e2ebd28559a05d0974af53488c414a26c28499d80f2f13f80454d4217019c58edc65 SHA512 c803964828ccbac40797e58dc82d10bdf899db26ef71ddd2443882bd4f84ff4a5aee4995a04135cb31b8f991381ce8004c51b06501aaef4d58dbcac239519822
diff --git a/net-p2p/go-ipfs-bin/files/ipfs.service b/net-p2p/go-ipfs-bin/files/ipfs-at.service
similarity index 62%
copy from net-p2p/go-ipfs-bin/files/ipfs.service
copy to net-p2p/go-ipfs-bin/files/ipfs-at.service
index 189ace2fd76..1ad99bd61bc 100644
--- a/net-p2p/go-ipfs-bin/files/ipfs.service
+++ b/net-p2p/go-ipfs-bin/files/ipfs-at.service
@@ -3,10 +3,14 @@ Description=InterPlanetary File System
After=network.target
[Service]
+CPUSchedulingPolicy=batch
+EnvironmentFile=-/etc/conf.d/ipfs.%i
ExecStart=/usr/bin/ipfs daemon --enable-gc --migrate
ExecStop=/usr/bin/ipfs shutdown
-Group=%i
-Restart=always
+LimitNOFILE=8192
+PrivateTmp=yes
+ProtectSystem=full
+Restart=on-failure
Type=simple
User=%i
diff --git a/net-p2p/go-ipfs-bin/files/ipfs.service b/net-p2p/go-ipfs-bin/files/ipfs.service
index 189ace2fd76..d942d5697b6 100644
--- a/net-p2p/go-ipfs-bin/files/ipfs.service
+++ b/net-p2p/go-ipfs-bin/files/ipfs.service
@@ -3,12 +3,17 @@ Description=InterPlanetary File System
After=network.target
[Service]
+CPUSchedulingPolicy=batch
+EnvironmentFile=-/etc/conf.d/ipfs
ExecStart=/usr/bin/ipfs daemon --enable-gc --migrate
ExecStop=/usr/bin/ipfs shutdown
-Group=%i
-Restart=always
+Group=ipfs
+LimitNOFILE=8192
+PrivateTmp=yes
+ProtectSystem=full
+Restart=on-failure
Type=simple
-User=%i
+User=ipfs
[Install]
WantedBy=multi-user.target
diff --git a/net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.22.ebuild b/net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.22.ebuild
new file mode 100644
index 00000000000..c4af0136eb9
--- /dev/null
+++ b/net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.22.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit bash-completion-r1 systemd
+
+DESCRIPTION="Main implementation of IPFS"
+HOMEPAGE="https://ipfs.io/"
+SRC_URI="amd64? ( https://dist.ipfs.io/go-ipfs/v${PV}/go-ipfs_v${PV}_linux-amd64.tar.gz )
+ x86? ( https://dist.ipfs.io/go-ipfs/v${PV}/go-ipfs_v${PV}_linux-386.tar.gz )
+ arm? ( https://dist.ipfs.io/go-ipfs/v${PV}/go-ipfs_v${PV}_linux-arm.tar.gz )
+
+ https://raw.githubusercontent.com/ipfs/go-ipfs/v${PV}/misc/completion/ipfs-completion.bash -> ${P}.bash"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~arm ~x86"
+
+RDEPEND="
+ acct-group/ipfs
+ acct-user/ipfs
+ sys-fs/fuse:0
+"
+
+S="${WORKDIR}/go-ipfs"
+
+QA_PREBUILT="/usr/bin/ipfs"
+
+src_install() {
+ dobin ipfs
+
+ systemd_dounit "${FILESDIR}/ipfs.service"
+ systemd_newunit "${FILESDIR}/ipfs-at.service" "ipfs@.service"
+
+ newinitd "${FILESDIR}/ipfs.init" ipfs
+ newconfd "${FILESDIR}/ipfs.confd" ipfs
+
+ newbashcomp "${DISTDIR}/${P}.bash" "ipfs"
+ keepdir /var/log/ipfs
+}
+
+pkg_preinst() {
+ fowners -R ipfs:ipfs /var/log/ipfs
+}
+
+pkg_postinst() {
+ elog 'To be able to use the ipfs service you will need to create the ipfs repository'
+ elog '(eg: su -s /bin/sh -c "ipfs init -e" ipfs)'
+ elog 'or change IPFS_PATH of /etc/conf.d/ipfs with another with proper permissions.'
+}
diff --git a/net-p2p/go-ipfs-bin/metadata.xml b/net-p2p/go-ipfs-bin/metadata.xml
index 463ccefc2c0..ee40761b5e1 100644
--- a/net-p2p/go-ipfs-bin/metadata.xml
+++ b/net-p2p/go-ipfs-bin/metadata.xml
@@ -5,12 +5,16 @@
<email>davidroman96@gmail.com</email>
<name>David Roman</name>
</maintainer>
+ <maintainer type="person">
+ <email>hurikhan77+bgo@gmail.com</email>
+ <name>Kai Krakow</name>
+ </maintainer>
<maintainer type="project">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<longdescription lang="en">
- IPFS is a decentralized torrent-like networking system with transparent
- file adding/downloading.
+ IPFS is a decentralized torrent-like networking system with transparent
+ file adding/downloading.
</longdescription>
</pkgmetadata>
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-28 6:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-08 20:03 [gentoo-commits] repo/gentoo:master commit in: net-p2p/go-ipfs-bin/files/, net-p2p/go-ipfs-bin/ Michał Górny
-- strict thread matches above, loose matches on Subject: below --
2019-09-28 6:46 Joonas Niilola
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox