ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.03k stars 3k forks source link

git fashion extension support #2309

Open Kubuxu opened 8 years ago

Kubuxu commented 8 years ago

As user of many scripts it would be great to have extension/script support in main command. It would work as ipfs unknown -> ipfs-unknown.

Proposed solution for now is to allow white-list unknown command to be passed to external script.

In future official extension list (in weechat scripts fashion) would be really nice.

cc @whyrusleeping

whyrusleeping commented 8 years ago

So we currently have ipfs update set up this way, but i purposefully didnt open it up fully. If we want, it should be pretty easy to add it in. @jbenet @diasdavid @RichardLitt thoughts?

RichardLitt commented 8 years ago

I don't understand. Can you point to an example elsewhere (is this like man git-squash or so, for instance)?

Kubuxu commented 8 years ago

You can for example install git add-on named flow. As its executable is named git-flow you can call its commands using: git flow ....

RichardLitt commented 8 years ago

Ah. That sounds good to me. I also think listing out extensions somewhere (maybe on awesome-ipfs) makes sense.

hackergrrl commented 8 years ago

@Kubuxu did you have a specific use case in mind?

Kubuxu commented 8 years ago

Yes, I have already quite a lot of scripts flowing around and it would be much simpler to used them if they were under common name of ipfs (ipfs-size, ipfs-repin, ipfs-publish, ipfs-updateboot and so on).

They are small automations that are in most cases are to small or to specific to be in IPFS itself but work great as small plug-ins.

Example ipfs-repin:

#!/usr/bin/env bash
echo -n "adding "
ipfs add -r -q $1 | tail -1 | tee .ipfspin.new || exit 1
if [ -e .ipfspin ] && ! cmp .ipfspin .ipfspin.new >/dev/null 2>&1; then
    cat .ipfspin | ipfs pin rm
fi
mv -f .ipfspin.new .ipfspin