GitXplorerGitXplorer
c

cargo-open

public
22 stars
5 forks
10 issues

Commits

List of commits on branch master.
Verified
060bc6623ce416af83fc0f7b50c151d0d5e143e3

Update dependencies again and lock them down a bit more

ccarols10cents committed 5 years ago
Verified
d294759c3c2fb44b2b10544b407d205cd3cdfab3

Add autogenerated cargo notice

ccarols10cents committed 5 years ago
Verified
89df1793cf84177cf36ef0325b6a1f0a9c4751d7

Update code and packages (#15)

ccarols10cents committed 5 years ago
Unverified
95cb374168ea711d43fa644db15e9c437c864806

Update code and packages

AAndrewRadev committed 6 years ago
Unverified
74fb9ffaadb0efde3096c90c1beb4c525c573304

Add packages needed on linux, I think

ccarols10cents committed 9 years ago
Unverified
cd258cd18a206eeff29816b1d5f2bc3f5630d85d

Move the TODO items to issues

ccarols10cents committed 9 years ago

README

The README file for this repository.

cargo open

Build Status

A third-party cargo extension to allow you to open a dependent crate in your $EDITOR. Heavily inspired by bundle open!

Compiling

I'm assuming you already have Rust and cargo set up.

Clone this repository and go into the created directory:

git clone https://github.com/carols10cents/cargo-open.git
cd cargo-open

And compile a release version:

cargo build --release

You should now have an executable in [starting directory]/cargo-open/target/release/cargo-open.

Installing and Using

Compile the code as shown in the previous section, then put the cargo-open executable in your PATH.

My favorite way of doing this is I have a pre-existing directory in ~/bin that contains little scripts of mine, that dir is added to my PATH in my .bashrc so that it's always available, and then I symlink the release version from where it exists to that directory:

ln -s [starting directory]/cargo-open/target/release/cargo-open ~/bin/

Once you've done that, because of the way cargo is set up to use third party extensions, in any other Rust project of yours, you should be able to run:

cargo open [some crate you're using]

and that crate will open in your desired editor.

cargo open determines your desired editor by first checking $CARGO_EDITOR, then $VISUAL, then $EDITOR. It will fail with a hopefully-helpful error message if none of these are set.

Contributing

Pull requests, bug reports, and feature requests are all welcome! <3 <3 <3

If you'd like to work on your own version of the code, fork this repo and follow the Compiling steps above except with your fork.

One weird thing if you're running the binary directly instead of through the cargo plugin system is that clap doesn't think you're using a subcommand. If you try, you'll get:

$ ./target/release/cargo-open whatever
error: Found argument 'whatever', but cargo wasn't expecting any

USAGE:
        cargo <SUBCOMMAND>

For more information try --help

To get around this, either follow the Installation and Usage instructions above and always use cargo open whatever or re-specify open as the subcommand:

./target/release/cargo-open open whatever

Running tests

Because the tests set and get environment variables, and that isn't guaranteed to be safe to access concurrently, the tests will sometimes fail unless you run them with one thread:

$ RUST_TEST_THREADS=1 cargo test

Using this command, the tests should always pass.

TODO

Please see this repo's issues for things I intend to add someday, and file new issues for anything you think is missing!

I've also labeled issues with "E-easy" for ones that I think would be easy to pick up if you would like to help-- please ask for clarification if any of them are unclear!

License

cargo open is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.