Giter Club home page Giter Club logo

cargo-open's Introduction

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.

cargo-open's People

Contributors

carols10cents avatar andrewradev avatar marti1125 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.