Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial support for commands to use external binaries #1961

Merged
merged 4 commits into from
Dec 7, 2015

Conversation

whyrusleeping
Copy link
Member

Allows us to have ipfs-update as a separate binary be called as ipfs update

License: MIT
Signed-off-by: Jeromy jeromyj@gmail.com

@jbenet jbenet added the status/in-progress In progress label Nov 11, 2015
@ghost
Copy link

ghost commented Nov 11, 2015

Also ipfs screencap and ipfs paste eh?

@whyrusleeping
Copy link
Member Author

@lgierth maybe in the future. Right now its done via whitelisting commands manually (the easiest route).

The git style subcommand extension is really nice, but we do want to be careful with what 'our tool' does, if the user has an out of date ipfs-XYZ binary, and it breaks, that looks bad for us.

@chriscool
Copy link
Contributor

There is a related discussion currently on the Git mailing list:

http://thread.gmane.org/gmane.comp.version-control.git/281124

@rht
Copy link
Contributor

rht commented Nov 12, 2015

The git style subcommand extension is really nice, but we do want to be careful with what 'our tool' does, if the user has an out of date ipfs-XYZ binary, and it breaks, that looks bad for us.

External commands are wired in git alias through the '!' prefix. This is explicit, and I don't think any user would mistakenly mix between the built-in tools and the external ones.
Also, git allows redefining shorthand verbs from the built-in ones + flags, if this is going to be added.

@whyrusleeping
Copy link
Member Author

@rht if i make a script named git-amazing that does rm -rf / --no-preserve-root and put it in my path, then run git amazing, my harddrive is now kill, and it 'looks' like git did it.

I want to make sure that running the ipfs tool doesn't accidentally cause bad things.

@rht
Copy link
Contributor

rht commented Nov 12, 2015

In that case, it does 'look' like git did it, but git still allows such script. Maybe because people have done less bad things through git than through the web. And I take it that ipfs, in the context as a git+web, is restricted (of what it allows people can do) by the potential bad things people would do through the web?
(while the web already has plenty of symlinks)

Would be nice to have the shorthand aliases, though it is not required to deliver ipfs-update.
Alternatively, as from the git built-ins override discussion, some of the default built-ins can already be modified through config options (e.g. branch.autosetuprebase), that it is not necessary.

@whyrusleeping
Copy link
Member Author

@rht yeah, i'm not totally against having the mechanism be more generic, but i definitely think it needs some more thought. For now, this works so we can ship ipfs-update, in the future we can look at making it more extensible.

if req.Arguments()[0] == "--help" {
buf := new(bytes.Buffer)
fmt.Fprintf(buf, "%s is an 'external' command.\n", binname)
fmt.Fprintf(buf, "it does not currently appear to be installated.\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"installed"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

installificated!

@jbenet
Copy link
Member

jbenet commented Nov 16, 2015

@whyrusleeping this LGTM. but should the ipfs-update bin be referenced (at least with gx so it's pinned?) not sure.

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
@whyrusleeping
Copy link
Member Author

@jbenet for now, i'm thinking that we use gobuilder for ipfs-update at least until we have our own build system set up.

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
@@ -76,6 +76,11 @@ dependencies as well.
* Shell command completion is available in `misc/completion/ipfs-completion.bash`. Read [docs/command-completion.md](docs/command-completion.md) to learn how to install it.
* See the [init examples](https://github.com/ipfs/examples/tree/master/examples/init) for how to connect IPFS to systemd or whatever init system your distro uses.

### Updating
ipfs has an updating tool that can be accessed through `ipfs update`. The tool is
not installed alongside ipfs in order to keep that logic indepedent of the main
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"independent"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch.

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
@whyrusleeping
Copy link
Member Author

@jbenet final thoughts here? Lets merge this so we can ship 0.3.10

@@ -262,3 +269,67 @@ func checkArgValue(v string, found bool, def Argument) error {
func ClientError(msg string) error {
return &Error{Code: ErrClient, Message: msg}
}

func ExternalBinary() *Command {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole function is very ipfs-specific. it does not belong in the commands lib

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(or make it general, but may be harder atm)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed.

@jbenet
Copy link
Member

jbenet commented Dec 4, 2015

responded

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
@whyrusleeping whyrusleeping added this to the IPFS 0.3.10 milestone Dec 6, 2015
@whyrusleeping
Copy link
Member Author

@jbenet LGTY?

@jbenet
Copy link
Member

jbenet commented Dec 7, 2015

@whyrusleeping LGTM

jbenet added a commit that referenced this pull request Dec 7, 2015
initial support for commands to use external binaries
@jbenet jbenet merged commit d58053b into master Dec 7, 2015
@jbenet jbenet removed the status/in-progress In progress label Dec 7, 2015
@jbenet jbenet deleted the feat/external-bins branch December 7, 2015 05:34
@jbenet jbenet mentioned this pull request Dec 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants